diff options
author | Chocobozzz <me@florianbigard.com> | 2022-10-19 10:43:53 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-10-24 14:48:24 +0200 |
commit | 9ab330b90decf4edf152ff8e1d2948c065766b2c (patch) | |
tree | 29d924f50f7307e8e828a57ecb9ea78623487ce0 /shared/core-utils/videos | |
parent | 3545e72c686ff1725bbdfd8d16d693e2f4aa75a3 (diff) | |
download | PeerTube-9ab330b90decf4edf152ff8e1d2948c065766b2c.tar.gz PeerTube-9ab330b90decf4edf152ff8e1d2948c065766b2c.tar.zst PeerTube-9ab330b90decf4edf152ff8e1d2948c065766b2c.zip |
Use private ACL for private videos in s3
Diffstat (limited to 'shared/core-utils/videos')
-rw-r--r-- | shared/core-utils/videos/common.ts (renamed from shared/core-utils/videos/privacy.ts) | 15 | ||||
-rw-r--r-- | shared/core-utils/videos/index.ts | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/shared/core-utils/videos/privacy.ts b/shared/core-utils/videos/common.ts index f33487b49..2c6efdb7f 100644 --- a/shared/core-utils/videos/privacy.ts +++ b/shared/core-utils/videos/common.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { VideoDetails } from '../../models/videos/video.model' | 1 | import { VideoStreamingPlaylistType } from '@shared/models' |
2 | import { VideoPrivacy } from '../../models/videos/video-privacy.enum' | 2 | import { VideoPrivacy } from '../../models/videos/video-privacy.enum' |
3 | import { VideoDetails } from '../../models/videos/video.model' | ||
3 | 4 | ||
4 | function getAllPrivacies () { | 5 | function getAllPrivacies () { |
5 | return [ VideoPrivacy.PUBLIC, VideoPrivacy.INTERNAL, VideoPrivacy.PRIVATE, VideoPrivacy.UNLISTED ] | 6 | return [ VideoPrivacy.PUBLIC, VideoPrivacy.INTERNAL, VideoPrivacy.PRIVATE, VideoPrivacy.UNLISTED ] |
@@ -8,14 +9,18 @@ function getAllPrivacies () { | |||
8 | function getAllFiles (video: Partial<Pick<VideoDetails, 'files' | 'streamingPlaylists'>>) { | 9 | function getAllFiles (video: Partial<Pick<VideoDetails, 'files' | 'streamingPlaylists'>>) { |
9 | const files = video.files | 10 | const files = video.files |
10 | 11 | ||
11 | if (video.streamingPlaylists[0]) { | 12 | const hls = getHLS(video) |
12 | return files.concat(video.streamingPlaylists[0].files) | 13 | if (hls) return files.concat(hls.files) |
13 | } | ||
14 | 14 | ||
15 | return files | 15 | return files |
16 | } | 16 | } |
17 | 17 | ||
18 | function getHLS (video: Partial<Pick<VideoDetails, 'streamingPlaylists'>>) { | ||
19 | return video.streamingPlaylists.find(p => p.type === VideoStreamingPlaylistType.HLS) | ||
20 | } | ||
21 | |||
18 | export { | 22 | export { |
19 | getAllPrivacies, | 23 | getAllPrivacies, |
20 | getAllFiles | 24 | getAllFiles, |
25 | getHLS | ||
21 | } | 26 | } |
diff --git a/shared/core-utils/videos/index.ts b/shared/core-utils/videos/index.ts index 620e3a716..2cf319395 100644 --- a/shared/core-utils/videos/index.ts +++ b/shared/core-utils/videos/index.ts | |||
@@ -1,2 +1,2 @@ | |||
1 | export * from './bitrate' | 1 | export * from './bitrate' |
2 | export * from './privacy' | 2 | export * from './common' |