PageSourceSearch

https://peertube.tv/client/en-US/chunk-BMuRnDpn.js

js peertube.tv collected 2026-09-25 20:05:50 UTC 11,753 bytes, 3 lines download raw bytes

1import{c as x,l as y,s as w}from"./chunk-C6uGsfWa.js";import{$a as hf,Aa as et,Co as je,Hi as _m,Is as se,It as Im,Jn as Og,Js as tl,Kn as OM,Kr as Ube,L as Cm,M as C0e,Nc as yn,Or as T,Pi as Za,Pr as Te,Qa as he,Vn as O,Vo as m,Zn as Or,ct as Fbe,ec as uDe,fi as Wn,ht as GQ,in as Kt,ka as er,kt as Ht,ma as cwe,pa as cr,ro as hwe,ss as on,t as $,ta as bd,vt as Gc,xc as xM}from"./chunk-BqEHMywo.js";import{t as a}from"./chunk-BlgmuV9w.js";import{n as G,r as j,t as C}from"./chunk-Bpwbfk6Q.js";var _=class extends j{support;downloadEnabled;commentsPolicy;likesPercent;dislikesPercent;trackerUrls;inputFileUpdatedAt;embedPrivacyPolicy;constructor(e,t={}){super(e,t),this.channel=new a(e.channel),this.account=new bd(e.account),this.tags=e.tags,this.support=e.support,this.commentsPolicy=e.commentsPolicy,this.downloadEnabled=e.downloadEnabled,this.inputFileUpdatedAt=e.inputFileUpdatedAt,this.trackerUrls=e.trackerUrls,this.embedPrivacyPolicy=e.embedPrivacyPolicy,this.buildLikeAndDislikePercents()}buildLikeAndDislikePercents(){this.likesPercent=this.likes/(this.likes+this.dislikes)*100,this.dislikesPercent=this.dislikes/(this.likes+this.dislikes)*100}getHlsPlaylist(){return this.streamingPlaylists.find(e=>e.type===xM.HLS)}hasHlsPlaylist(){return!!this.getHlsPlaylist()}hasEmbedRestrictions(){return this.embedPrivacyPolicy.id!==Cm.ALL_ALLOWED}hasEmbedDisabled(){return this.embedPrivacyPolicy.id===Cm.DISABLED}getFilesForDownload(){let e=this.files;for(let t of this.getHlsPlaylist()?.files||[])e.some(i=>i.resolution.id===t.resolution.id&&i.fps===t.fps)||e.push(t);return OM(e,`resolution`,`id`).reverse()}};var H=class a{auth=m(et);authHttp=m(Wn);restExtractor=m(er);restService=m(Og);serverService=m(Kt);confirmService=m(Gc);userService=m(tl);static BASE_VIDEO_URL=se.apiUrl+`/api/v1/videos`;static BASE_FEEDS_URL=se.apiUrl+`/feeds/videos.`;static PODCAST_FEEDS_URL=se.apiUrl+`/feeds/podcast/videos.xml`;static BASE_SUBSCRIPTION_FEEDS_URL=se.apiUrl+`/feeds/subscriptions.`;getVideoViewUrl(e){return`${a.BASE_VIDEO_URL}/${e}/views`}getVideo(e){let t=b.buildVideoPasswordHeader(e.videoPassword);return this.serverService.getServerLocale().pipe(je(i=>this.authHttp.get(`${a.BASE_VIDEO_URL}/${e.videoId}`,{headers:t}).pipe($(r=>({videoHash:r,translations:i})))),$(({videoHash:i,translations:r})=>new _(i,r)),he(i=>this.restExtractor.handleError(i)))}updateVideo(e,t){let i=GQ(t);return this.authHttp.put(`${a.BASE_VIDEO_URL}/${e}`,i).pipe(he(r=>this.restExtractor.handleError(r)))}uploadVideo(e){let t=new Za(`POST`,`${a.BASE_VIDEO_URL}/upload`,e,{reportProgress:!0});return this.authHttp.request(t).pipe(he(i=>this.restExtractor.handleError(i)))}
1removeVideo(e){return Te(_m(e)).pipe(cr(i=>this.authHttp.delete(`${a.BASE_VIDEO_URL}/${i}`)),hf(),he(i=>this.restExtractor.handleError(i)))}listMyVideos(e){let{videoPagination:t,restPagination:i,sort:r,channelNameOneOf:s,privacyOneOf:o,tagsOneOf:l,search:c,includeCollaborations:V}=e,x=t?this.restService.componentToRestPagination(t):i,u=new yn;u=this.restService.addRestGetParams(u,x,this.buildListSort(r));let g={};return cwe(e.isLive)&&(g.isLive=e.isLive),e.search&&(g.search=c),e.privacyOneOf&&(g.privacyOneOf=o),e.tagsOneOf&&(g.tagsOneOf=l),u=this.restService.addObjectParams(u,g),s!==void 0&&s.length!==0&&(u=this.restService.addArrayParams(u,`channelNameOneOf`,s)),V&&(u=u.set(`includeCollaborations`,`true`)),this.authHttp.get(tl.BASE_USERS_URL+`me/videos`,{params:u}).pipe(je(m=>this.extractVideos(m)),he(m=>this.restExtractor.handleError(m)))}listAccountVideos(e){return this.listVideos(x(w({},e),{account:e.account}))}listChannelVideos(e){return this.listVideos(x(w({},e),{videoChannel:e.videoChannel}))}listVideos(e){let l=e,{account:t,videoChannel:i}=l,r=y(l,[`account`,`videoChannel`]),s=new yn;s=this.buildVideoListParams(w({params:s},r));let o;return i?o=G.BASE_VIDEO_CHANNEL_URL+i.nameWithHost+`/videos`:t?o=C.BASE_ACCOUNT_URL+t.nameWithHost+`/videos`:o=a.BASE_VIDEO_URL,this.authHttp.get(o,{params:s}).pipe(je(c=>this.extractVideos(c)),he(c=>this.restExtractor.handleError(c)))}buildVideoListParams(e){let W=e,{params:t,videoPagination:i,sort:r,categoryOneOf:s,languageOneOf:o,privacyOneOf:l,skipCount:c,search:V,nsfw:x,nsfwFlagsExcluded:u,nsfwFlagsIncluded:g,autoTagOneOf:m,stateOneOf:z}=W,de=y(W,[`params`,`videoPagination`,`sort`,`categoryOneOf`,`languageOneOf`,`privacyOneOf`,`skipCount`,`search`,`nsfw`,`nsfwFlagsExcluded`,`nsfwFlagsIncluded`,`autoTagOneOf`,`stateOneOf`]),le=i?this.restService.componentToRestPagination(i):void 0,n=this.restService.addRestGetParams(t,le,this.buildListSort(r));return c&&(n=n.set(`skipCount`,c+``)),Array.isArray(o)&&(n=this.restService.addArrayParams(n,`languageOneOf`,o)),Array.isArray(s)&&(n=this.restService.addArrayParams(n,`categoryOneOf`,s)),Array.isArray(l)&&(n=this.restService.addArrayParams(n,`privacyOneOf`,l)),Array.isArray(m)&&(n=this.restService.addArrayParams(n,`autoTagOneOf`,m)),Array.isArray(m)&&(n=this.restService.addArrayParams(n,`autoTagOneOf`,m)),Array.isArray(z)&&(n=this.restService.addArrayParams(n,`stateOneOf`,z)),V&&(n=n.set(`search`,V)),n=this.buildNSFWParams(n,{nsfw:x,nsfwFlagsExcluded:u,nsfwFlagsIncluded:g}),this.restService.addObjectParams(n,de)}buildNSFWParams(e,t={}){let{nsfw:i,nsfwFlagsExcluded:r,nsfwFlagsIncluded:s}=t,o=this.auth.isLoggedIn()?void 0:this.userService.getAnonymousUser(),l=o?o.nsfwFlagsHidden:void 0,c=o?o.nsfwFlagsDisplayed|o.nsfwFlagsBlurred|o.nsfwFlagsWarned:void 0;return i!==void 0?e=e.set(`nsfw`,i):o?.nsfwPolicy&&(e=e.set(`nsfw`,this.nsfwPolicyToParam(o.nsfwPolicy))),r!==void 0?e=e.set(`nsfwFlagsExcluded`,r):l!==void 0&&(e=e.set(`nsfwFlagsExcluded`,l)),s!==void 0?e=e.set(`nsfwFlagsIncluded`,s):c!==void 0&&(e=e.set(`nsfwFlagsIncluded`,c)),e}buildListSort(e){let t=this.restService.buildSortString(e);if(typeof t==`string`)return this.auth.isLoggedIn()&&(t===`hot`||t===`-hot`)?t.replace(`hot`,`best`):t}buildBaseFeedUrls(e,t=a.BASE_FEEDS_URL){let i=[{type:Ube.VIDEOS,format:Fbe.RSS,label:`media rss 2.0`,url:t+Fbe.RSS.toLowerCase()},{type:Ube.VIDEOS,format:Fbe.ATOM,label:`atom 1.0`,url:t+Fbe.ATOM.toLowerCase()},{type:Ube.VIDEOS,format:Fbe.JSON,label:`json 1.0`,url:t+Fbe.JSON.toLowerCase()}];if(e&&e.keys().length!==0)for(let r of i)r.url+=`?`+e.toString();return i}getVideoFeedUrls(e,t,i){let r=this.restService.addRestGetParams(new yn,void 0,e);if(t&&(r=r.set(`isLocal`,t)),i)for(let s of i)r=r.append(`categoryOneOf[]`,s+``);return this.buildBaseFeedUrls(r)}getAccountFeedUrls(e){let t=this.restService.addRestGetParams(new yn);return t=t.set(`accountId`,e.toString()),this.buildBaseFeedUrls(t)}getVideoChannelFeedUrls(e){let t=this.restService.addRestGetParams(new yn);t=t.set(`videoChannelId`,e.toString());let i=this.buildBaseFeedUrls(t);return i.push({type:Ube.PODCAST,format:Fbe.PODCAST,label:`podcast rss 2.0`,url:a.PODCAST_FEEDS_URL+`?videoChannelId=${e}`}),i}getVideoSubscriptionFeedUrls(e,t){let i=this.restService.addRestGetParams(new yn);return i=i.set(`accountId`,e.toString()),i=i.set(`token`,t),this.buildBaseFeedUrls(i,a.BASE_SUBSCRIPTION_FEEDS_URL)}getVideoFileMetadata(e){return this.authHttp.get(e).pipe(he(t=>this.restExtractor.handleError(t)))}
1removeVideoFiles(e,t){return Te(e).pipe(cr(i=>this.authHttp.delete(a.BASE_VIDEO_URL+`/`+i+`/`+t)),hf(),he(i=>this.restExtractor.handleError(i)))}removeFile(e,t,i){return this.authHttp.delete(a.BASE_VIDEO_URL+`/`+e+`/`+i+`/`+t).pipe(he(r=>this.restExtractor.handleError(r)))}removeSourceFile(e){return this.authHttp.delete(a.BASE_VIDEO_URL+`/`+e+`/source/file`).pipe(he(t=>this.restExtractor.handleError(t)))}runTranscoding(e){let{videos:t,type:i,forceTranscoding:r}=e,s={transcodingType:i,forceTranscoding:r};return Te(t).pipe(cr(o=>this.authHttp.post(a.BASE_VIDEO_URL+`/`+o.uuid+`/transcoding`,s).pipe(he(l=>{if(l.error?.code===uDe.VIDEO_ALREADY_BEING_TRANSCODED&&!r){let c=`PeerTube considers video "${o.name}" is already being transcoded.`+" If you think PeerTube is wrong (video in broken state after a crash etc.), you can force transcoding on this video."+` Do you still want to run transcoding?`;return Te(this.confirmService.confirm(c,"Force transcoding")).pipe(je(V=>V===!1?Or(()=>l):this.runTranscoding({videos:[o],type:i,forceTranscoding:!0})))}return Or(()=>l)}))),hf(),he(o=>this.restExtractor.handleError(o)))}generateDownloadUrl(e){let{video:t,files:i,videoFileToken:r}=e;return hwe({baseUrl:se.originServerUrl,videoFiles:i.map(s=>s.id),videoUUID:t.uuid,videoFileToken:r})}getStoryboards(e,t){let i=b.buildVideoPasswordHeader(t);return this.authHttp.get(a.BASE_VIDEO_URL+`/`+e+`/storyboards`,{headers:i}).pipe($(({storyboards:r})=>r),he(r=>r.status===404?O([]):this.restExtractor.handleError(r)))}getSource(e){return this.authHttp.get(a.BASE_VIDEO_URL+`/`+e+`/source`).pipe(he(t=>t.status===404?O(void 0):this.restExtractor.handleError(t)))}setVideoLike(e,t){return this.setVideoRate(e,`like`,t)}setVideoDislike(e,t){return this.setVideoRate(e,`dislike`,t)}unsetVideoLike(e,t){return this.setVideoRate(e,`none`,t)}getUserVideoRating(e){let t=tl.BASE_USERS_URL+`me/videos/`+e+`/rating`;return this.authHttp.get(t).pipe(he(i=>this.restExtractor.handleError(i)))}extractVideos(e){return this.serverService.getServerLocale().pipe($(t=>{let i=e.data,r=e.total,s=[];for(let o of i)s.push(new j(o,t));return{total:r,data:s}}))}explainedPrivacyLabels(e,t=on.PUBLIC){let i={[on.PRIVATE]:"Only I can see this video",[on.UNLISTED]:"Only shareable via a private link",[on.PUBLIC]:"Anyone can see this video",[on.INTERNAL]:"Only users of this platform can see this video",[on.PASSWORD_PROTECTED]:"Only users with the appropriate password can see this video"};return{videoPrivacies:e.map(s=>x(w({},s),{description:i[s.id]})),defaultPrivacyId:e.find(s=>s.id===t)?.id||e[0].id}}explainedLicenceLabels(e){let t={[C0e[`CC-BY`]]:"CC-BY",[C0e[`CC-BY-SA`]]:"CC-BY-SA",[C0e[`CC-BY-ND`]]:"CC-BY-ND",[C0e[`CC-BY-NC`]]:"CC-BY-NC",[C0e[`CC-BY-NC-SA`]]:"CC-BY-NC-SA",[C0e[`CC-BY-NC-ND`]]:"CC-BY-NC-ND",[C0e.CC0]:``,[C0e.PDM]:"Public domain mark",[C0e.ALL_RIGHTS_RESERVED]:"You are the owner of the content or you have the rights of the copyright holders"};return e.map(i=>x(w({},i),{description:t[i.id]}))}buildNSFWTooltip(e){let t=[];return(e.nsfwFlags&Im.VIOLENT)===Im.VIOLENT&&t.push("violence"),(e.nsfwFlags&Im.EXPLICIT_SEX)===Im.EXPLICIT_SEX&&t.push("explicit sex"),t.length===0?"This video contains sensitive content":`This video contains sensitive content: ${t.join(` - `)}`}getMostPrivatePrivacy(e){let t=[on.PRIVATE,on.INTERNAL,on.UNLISTED,on.PUBLIC];return this.getPrivacyFromOrder(e,t)}getPrivacyFromOrder(e,t){for(let i of t)if(e.find(r=>r.id===i))return i;throw new Error(`No privacy available`)}nsfwPolicyToParam(e){return e===`do_not_list`?`false`:`both`}buildDefaultOwnerDisplayType(e){let t=e.account.name;return e.channel.displayName===`Default ${t} channel`||e.channel.displayName===`Main ${t} channel`||e.channel.name.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/)?`account`:`videoChannel`}setVideoRate(e,t,i){let r=`${a.BASE_VIDEO_URL}/${e}/rate`,s={rating:t},o=b.buildVideoPasswordHeader(i);return this.authHttp.put(r,s,{headers:o}).pipe(he(l=>this.restExtractor.handleError(l)))}static ɵfac=function(t){return new(t||a)};static ɵprov=T({token:a,factory:a.ɵfac})};var b=class a{authHttp=m(Wn);restExtractor=m(er);static buildVideoPasswordHeader(e){return e?new Ht().set(`x-peertube-video-password`,e):void 0}getVideoPasswords(e){return this.authHttp.get(`${H.BASE_VIDEO_URL}/${e.videoUUID}/passwords`).pipe($(t=>t.data),he(t=>this.restExtractor.handleError(t)))}static ɵfac=function(t){return new(t||a)};static ɵprov=T({token:a,factory:a.ɵfac})};export{_ as n,b as r,H as t};
2//# debugId=ca9b5a9c-d75a-5b9b-a573-ace9decf7163
3//# sourceMappingURL=chunk-BMuRnDpn.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.