aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/video.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/video.ts')
-rw-r--r--server/helpers/video.ts20
1 files changed, 18 insertions, 2 deletions
diff --git a/server/helpers/video.ts b/server/helpers/video.ts
index 6f76cbdfc..4bcc6d0b9 100644
--- a/server/helpers/video.ts
+++ b/server/helpers/video.ts
@@ -15,7 +15,8 @@ import {
15import { Response } from 'express' 15import { Response } from 'express'
16import { DEFAULT_AUDIO_RESOLUTION } from '@server/initializers/constants' 16import { DEFAULT_AUDIO_RESOLUTION } from '@server/initializers/constants'
17import { JobQueue } from '@server/lib/job-queue' 17import { JobQueue } from '@server/lib/job-queue'
18import { VideoTranscodingPayload } from '@shared/models' 18import { VideoPrivacy, VideoTranscodingPayload } from '@shared/models'
19import { CONFIG } from "@server/initializers/config"
19 20
20type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' | 'only-immutable-attributes' 21type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' | 'only-immutable-attributes'
21 22
@@ -96,6 +97,19 @@ function extractVideo (videoOrPlaylist: MVideo | MStreamingPlaylistVideo) {
96 : videoOrPlaylist 97 : videoOrPlaylist
97} 98}
98 99
100function isPrivacyForFederation (privacy: VideoPrivacy) {
101 const castedPrivacy = parseInt(privacy + '', 10)
102
103 return castedPrivacy === VideoPrivacy.PUBLIC ||
104 (CONFIG.FEDERATION.VIDEOS.FEDERATE_UNLISTED === true && castedPrivacy === VideoPrivacy.UNLISTED)
105}
106
107function getPrivaciesForFederation () {
108 return (CONFIG.FEDERATION.VIDEOS.FEDERATE_UNLISTED === true)
109 ? [ { privacy: VideoPrivacy.PUBLIC }, { privacy: VideoPrivacy.UNLISTED } ]
110 : [ { privacy: VideoPrivacy.PUBLIC } ]
111}
112
99export { 113export {
100 VideoFetchType, 114 VideoFetchType,
101 VideoFetchByUrlType, 115 VideoFetchByUrlType,
@@ -103,5 +117,7 @@ export {
103 getVideoWithAttributes, 117 getVideoWithAttributes,
104 fetchVideoByUrl, 118 fetchVideoByUrl,
105 addOptimizeOrMergeAudioJob, 119 addOptimizeOrMergeAudioJob,
106 extractVideo 120 extractVideo,
121 isPrivacyForFederation,
122 getPrivaciesForFederation
107} 123}