mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
1 line
26 KiB
JavaScript
1 line
26 KiB
JavaScript
|
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[479],{19455:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>f});s(22362);var i=s(21443),a=s.n(i),n=s(67631),r=s.n(n),o=s(78657),d=s(52526),l=s(23952),c=s(80041),u=s(39169),m=s(65981);const f={props:{id:{type:String}},components:{"stream-loading":o.default,"stream-offline":d.default,"profile-card":l.default,"stream-info-card":c.default,"stream-comments":u.default,"settings-card":m.default},data:function(){return{enabled:!0,isLoaded:!1,user:void 0,profile:void 0,stream:{name:"Offline",description:void 0},streamState:"loading",streamSource:void 0,showSettingsCard:!1}},mounted:function(){this.fetchProfile()},methods:{fetchProfile:function(){var t=this;axios.get("/api/pixelfed/v1/accounts/"+this.id).then((function(e){t.profile=e.data,t.user=e.data,t.fetchAuthState()}))},fetchAuthState:function(){var t=this;axios.get("/api/v1/accounts/verify_credentials").then((function(e){window._sharedData.curUser=e.data,window._sharedData.user=e.data,t.fetchInitialStreamState(!0)})).catch((function(e){t.fetchInitialStreamState(!1)}))},fetchInitialStreamState:function(t){var e=this,s=1==t?"/api/live/accounts/stream":"/api/live/accounts/stream/guest";axios.get(s,{params:{profile_id:this.profile.id}}).then((function(t){if(e.isLoaded=!0,t.data&&t.data.hls_url&&t.data.hls_url.length){e.stream=t.data;var s=t.data.hls_url;axios.head(t.data.hls_url).then((function(t){e.streamState="ready",e.streamSource=s,e.initVideo()})).catch((function(t){e.streamState="offline"}))}else e.streamState="offline"})).catch((function(t){e.isLoaded=!0}))},initVideo:function(){var t=this;this.$nextTick((function(){var e=t.$refs.liveVid,s=(new(a())(e,{controls:["play","mute","volume","fullscreen"]}),t.streamSource);if(r().isSupported())try{var i=new(r());i.loadSource(s),i.attachMedia(e),window.hls=i}catch(t){console.log("Error loading manifest")}else e.src=s}))},openSettings:function(){this.showSettingsCard=!this.showSettingsCard},closeSettings:function(){this.showSettingsCard=!1}}}},1791:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>i});const i={props:{profile:{type:Object},stream:{type:Object},showSettings:{type:Boolean,default:!1}},computed:{isOwner:function(){return window._sharedData.user.id===this.profile.id&&this.stream.hls_url}},methods:{openSettings:function(){event.currentTarget.blur(),this.$emit("settings")}}}},40038:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>i});const i={props:{profile:{type:Object},stream:{type:Object}},data:function(){return{hasChanged:!1}},watch:{stream:{deep:!0,handler:function(t,e){this.hasChanged=JSON.stringify(t)===JSON.stringify(this.getOriginal)}}},computed:{getOriginal:function(){return this.originalStream}},mounted:function(){this.originalStream=this.stream},methods:{closeSettings:function(){event.currentTarget.blur(),this.$emit("close")},updateSettings:function(){var t=this;event.currentTarget.blur(),axios.post("/api/live/stream/edit",{name:this.stream.name,description:this.stream.description}).then((function(e){t.$emit("close")}))}}}},53282:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>a});var i=s(84554);window.Pusher=s(86606),window.Echo=new i.default({broadcaster:"pusher",key:window._pushr.key,wsHost:window.location.hostname,wsPort:6001,wssPort:6001,disableStats:!0,enabledTransports:["ws","wss"],forceTLS:!0});const a={props:{profile:{type:Object},stream:{type:Object}},data:function(){return{user:{id:-1},comment:void 0,comments:[],state:"loading",modMode:!1,viewerCount:1,isBannedFromChat:!1,commentMenuIndex:void 0,commentMenuObject:void 0,pinnedMessage:void 0,commentFormDisabled:!1,isUnpinning:!1,formError:void 0}},computed:{isOwner:function(){return!!window._sharedData.curUser&&window._sharedData.curUser.id==this.profile.id}},mounted:function(){this.user=window._sharedData.curUser?window._sharedData.curUser:{id:-1},this.fetchComments(),this.bootWebsockets()},methods:{addComment:function(t){var e=this;t.currentTarget.blur(),this.commentFormDisabled=!0,axios.post("/api/live/chat/message",{profile_id:this.profile.id,message:this.comment}).then((function
|