diff options
Diffstat (limited to 'server/helpers/video.ts')
-rw-r--r-- | server/helpers/video.ts | 20 |
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 { | |||
15 | import { Response } from 'express' | 15 | import { Response } from 'express' |
16 | import { DEFAULT_AUDIO_RESOLUTION } from '@server/initializers/constants' | 16 | import { DEFAULT_AUDIO_RESOLUTION } from '@server/initializers/constants' |
17 | import { JobQueue } from '@server/lib/job-queue' | 17 | import { JobQueue } from '@server/lib/job-queue' |
18 | import { VideoTranscodingPayload } from '@shared/models' | 18 | import { VideoPrivacy, VideoTranscodingPayload } from '@shared/models' |
19 | import { CONFIG } from "@server/initializers/config" | ||
19 | 20 | ||
20 | type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' | 'only-immutable-attributes' | 21 | type 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 | ||
100 | function 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 | |||
107 | function getPrivaciesForFederation () { | ||
108 | return (CONFIG.FEDERATION.VIDEOS.FEDERATE_UNLISTED === true) | ||
109 | ? [ { privacy: VideoPrivacy.PUBLIC }, { privacy: VideoPrivacy.UNLISTED } ] | ||
110 | : [ { privacy: VideoPrivacy.PUBLIC } ] | ||
111 | } | ||
112 | |||
99 | export { | 113 | export { |
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 | } |