diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts index 2182b42f5..e29a8fe1d 100644 --- a/server/controllers/feeds.ts +++ b/server/controllers/feeds.ts @@ -255,7 +255,7 @@ function addVideosToFeed (feed, videos: VideoModel[]) { * Adding video items to the feed object, one at a time */ for (const video of videos) { - const formattedVideoFiles = video.getFormattedVideoFilesJSON() + const formattedVideoFiles = video.getFormattedVideoFilesJSON(false) const torrents = formattedVideoFiles.map(videoFile => ({ title: video.name, diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts index 9dc3e7722..455597d22 100644 --- a/server/models/video/video-format-utils.ts +++ b/server/models/video/video-format-utils.ts @@ -188,9 +188,12 @@ function sortByResolutionDesc (fileA: MVideoFile, fileB: MVideoFile) { function videoFilesModelToFormattedJSON ( video: MVideoFormattableDetails, - videoFiles: MVideoFileRedundanciesOpt[] + videoFiles: MVideoFileRedundanciesOpt[], + includeMagnet = true ): VideoFile[] { - const trackerUrls = video.getTrackerUrls() + const trackerUrls = includeMagnet + ? video.getTrackerUrls() + : [] return [ ...videoFiles ] .filter(f => !f.isLive()) @@ -202,8 +205,9 @@ function videoFilesModelToFormattedJSON ( label: videoFile.resolution + 'p' }, - // FIXME: deprecated in 3.2 - magnetUri: generateMagnetUri(video, videoFile, trackerUrls), + magnetUri: includeMagnet + ? generateMagnetUri(video, videoFile, trackerUrls) + : undefined, size: videoFile.size, fps: videoFile.fps, diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 9e67ca0f4..48d4ba47a 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -1904,16 +1904,16 @@ export class VideoModel extends Model { return videoModelToFormattedDetailsJSON(this) } - getFormattedVideoFilesJSON (): VideoFile[] { + getFormattedVideoFilesJSON (includeMagnet = true): VideoFile[] { let files: VideoFile[] = [] if (Array.isArray(this.VideoFiles)) { - const result = videoFilesModelToFormattedJSON(this, this.VideoFiles) + const result = videoFilesModelToFormattedJSON(this, this.VideoFiles, includeMagnet) files = files.concat(result) } for (const p of (this.VideoStreamingPlaylists || [])) { - const result = videoFilesModelToFormattedJSON(this, p.VideoFiles) + const result = videoFilesModelToFormattedJSON(this, p.VideoFiles, includeMagnet) files = files.concat(result) } diff --git a/shared/models/videos/video-file.model.ts b/shared/models/videos/video-file.model.ts index f3d93f0ed..1e830b19c 100644 --- a/shared/models/videos/video-file.model.ts +++ b/shared/models/videos/video-file.model.ts @@ -17,6 +17,5 @@ export interface VideoFile { metadata?: VideoFileMetadata metadataUrl?: string - // FIXME: deprecated in 3.2 - magnetUri: string + magnetUri: string | null }