]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/formatter/video-format-utils.ts
Merge branch 'release/3.3.0' into develop
[github/Chocobozzz/PeerTube.git] / server / models / video / formatter / video-format-utils.ts
index 6b1e5906333f5142ffe26948005bb9b69d154ab3..8a54de3b031e13c475b160eda7f86376c3921fd7 100644 (file)
@@ -182,8 +182,8 @@ function streamingPlaylistsModelToFormattedJSON (
       return {
         id: playlist.id,
         type: playlist.type,
-        playlistUrl: playlist.playlistUrl,
-        segmentsSha256Url: playlist.segmentsSha256Url,
+        playlistUrl: playlist.getMasterPlaylistUrl(video),
+        segmentsSha256Url: playlist.getSha256SegmentsUrl(video),
         redundancies,
         files
       }
@@ -205,7 +205,7 @@ function videoFilesModelToFormattedJSON (
     ? video.getTrackerUrls()
     : []
 
-  return [ ...videoFiles ]
+  return (videoFiles || [])
     .filter(f => !f.isLive())
     .sort(sortByResolutionDesc)
     .map(videoFile => {
@@ -240,7 +240,7 @@ function addVideoFilesInAPAcc (
 ) {
   const trackerUrls = video.getTrackerUrls()
 
-  const sortedFiles = [ ...files ]
+  const sortedFiles = (files || [])
     .filter(f => !f.isLive())
     .sort(sortByResolutionDesc)
 
@@ -331,7 +331,7 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoObject {
       type: 'Link',
       name: 'sha256',
       mediaType: 'application/json' as 'application/json',
-      href: playlist.segmentsSha256Url
+      href: playlist.getSha256SegmentsUrl(video)
     })
 
     addVideoFilesInAPAcc(tag, video, playlist.VideoFiles || [])
@@ -339,7 +339,7 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoObject {
     url.push({
       type: 'Link',
       mediaType: 'application/x-mpegURL' as 'application/x-mpegURL',
-      href: playlist.playlistUrl,
+      href: playlist.getMasterPlaylistUrl(video),
       tag
     })
   }