X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo.ts;h=5e4b7d44c0b86f0162bbd02912a801258216276c;hb=8319d6ae72d4da6de51bd3d4b5c68040fc8dc3b4;hp=7f94e834ad7f27688b53612df17ea3e0b263fdf3;hpb=6b842050f7b0820bbd3051d9bfec1fffdf6d8df4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 7f94e834a..5e4b7d44c 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -216,7 +216,7 @@ export type AvailableForListIDsOptions = { if (options.withFiles === true) { query.include.push({ - model: VideoFileModel.unscoped(), + model: VideoFileModel, required: true }) } @@ -337,7 +337,7 @@ export type AvailableForListIDsOptions = { return { include: [ { - model: VideoFileModel.unscoped(), + model: VideoFileModel, separate: true, // We may have multiple files, having multiple redundancies so let's separate this join required: false, include: subInclude @@ -348,7 +348,7 @@ export type AvailableForListIDsOptions = { [ScopeNames.WITH_STREAMING_PLAYLISTS]: (withRedundancies = false) => { const subInclude: IncludeOptions[] = [ { - model: VideoFileModel.unscoped(), + model: VideoFileModel, required: false } ] @@ -1847,6 +1847,13 @@ export class VideoModel extends Model { return baseUrlHttp + STATIC_PATHS.WEBSEED + getVideoFilename(this, videoFile) } + getVideoFileMetadataUrl (videoFile: MVideoFile, baseUrlHttp: string) { + const path = '/api/v1/videos/' + return videoFile.metadata + ? baseUrlHttp + path + this.uuid + '/metadata/' + videoFile.id + : videoFile.metadataUrl + } + getVideoRedundancyUrl (videoFile: MVideoFile, baseUrlHttp: string) { return baseUrlHttp + STATIC_PATHS.REDUNDANCY + getVideoFilename(this, videoFile) }