aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-streaming-playlist.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video-streaming-playlist.ts')
-rw-r--r--server/models/video/video-streaming-playlist.ts21
1 files changed, 15 insertions, 6 deletions
diff --git a/server/models/video/video-streaming-playlist.ts b/server/models/video/video-streaming-playlist.ts
index 2b6771f27..b919046ed 100644
--- a/server/models/video/video-streaming-playlist.ts
+++ b/server/models/video/video-streaming-playlist.ts
@@ -17,6 +17,7 @@ import {
17} from 'sequelize-typescript' 17} from 'sequelize-typescript'
18import { getHLSPublicFileUrl } from '@server/lib/object-storage' 18import { getHLSPublicFileUrl } from '@server/lib/object-storage'
19import { generateHLSMasterPlaylistFilename, generateHlsSha256SegmentsFilename } from '@server/lib/paths' 19import { generateHLSMasterPlaylistFilename, generateHlsSha256SegmentsFilename } from '@server/lib/paths'
20import { isVideoInPrivateDirectory } from '@server/lib/video-privacy'
20import { VideoFileModel } from '@server/models/video/video-file' 21import { VideoFileModel } from '@server/models/video/video-file'
21import { MStreamingPlaylist, MStreamingPlaylistFilesVideo, MVideo } from '@server/types/models' 22import { MStreamingPlaylist, MStreamingPlaylistFilesVideo, MVideo } from '@server/types/models'
22import { sha1 } from '@shared/extra-utils' 23import { sha1 } from '@shared/extra-utils'
@@ -250,7 +251,7 @@ export class VideoStreamingPlaylistModel extends Model<Partial<AttributesOnly<Vi
250 return getHLSPublicFileUrl(this.playlistUrl) 251 return getHLSPublicFileUrl(this.playlistUrl)
251 } 252 }
252 253
253 return WEBSERVER.URL + this.getMasterPlaylistStaticPath(video.uuid) 254 return WEBSERVER.URL + this.getMasterPlaylistStaticPath(video)
254 } 255 }
255 256
256 return this.playlistUrl 257 return this.playlistUrl
@@ -262,7 +263,7 @@ export class VideoStreamingPlaylistModel extends Model<Partial<AttributesOnly<Vi
262 return getHLSPublicFileUrl(this.segmentsSha256Url) 263 return getHLSPublicFileUrl(this.segmentsSha256Url)
263 } 264 }
264 265
265 return WEBSERVER.URL + this.getSha256SegmentsStaticPath(video.uuid) 266 return WEBSERVER.URL + this.getSha256SegmentsStaticPath(video)
266 } 267 }
267 268
268 return this.segmentsSha256Url 269 return this.segmentsSha256Url
@@ -287,11 +288,19 @@ export class VideoStreamingPlaylistModel extends Model<Partial<AttributesOnly<Vi
287 return Object.assign(this, { Video: video }) 288 return Object.assign(this, { Video: video })
288 } 289 }
289 290
290 private getMasterPlaylistStaticPath (videoUUID: string) { 291 private getMasterPlaylistStaticPath (video: MVideo) {
291 return join(STATIC_PATHS.STREAMING_PLAYLISTS.HLS, videoUUID, this.playlistFilename) 292 if (isVideoInPrivateDirectory(video.privacy)) {
293 return join(STATIC_PATHS.STREAMING_PLAYLISTS.PRIVATE_HLS, video.uuid, this.playlistFilename)
294 }
295
296 return join(STATIC_PATHS.STREAMING_PLAYLISTS.HLS, video.uuid, this.playlistFilename)
292 } 297 }
293 298
294 private getSha256SegmentsStaticPath (videoUUID: string) { 299 private getSha256SegmentsStaticPath (video: MVideo) {
295 return join(STATIC_PATHS.STREAMING_PLAYLISTS.HLS, videoUUID, this.segmentsSha256Filename) 300 if (isVideoInPrivateDirectory(video.privacy)) {
301 return join(STATIC_PATHS.STREAMING_PLAYLISTS.PRIVATE_HLS, video.uuid, this.segmentsSha256Filename)
302 }
303
304 return join(STATIC_PATHS.STREAMING_PLAYLISTS.HLS, video.uuid, this.segmentsSha256Filename)
296 } 305 }
297} 306}