]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-format-utils.ts
parseQueryStringFilter cleanup
[github/Chocobozzz/PeerTube.git] / server / models / video / video-format-utils.ts
index 365c9581e60ff25aa687a7d11d97e1d92db3cd1f..d71a3a5dbee34b3e5a1c8719e646b3f3b3827bf0 100644 (file)
@@ -8,7 +8,7 @@ import {
   getVideoDislikesActivityPubUrl,
   getVideoLikesActivityPubUrl,
   getVideoSharesActivityPubUrl
-} from '../../lib/activitypub'
+} from '../../lib/activitypub/url'
 import { isArray } from '../../helpers/custom-validators/misc'
 import { VideoStreamingPlaylist } from '../../../shared/models/videos/video-streaming-playlist.model'
 import {
@@ -23,7 +23,7 @@ import {
 import { MVideoFileRedundanciesOpt } from '../../typings/models/video/video-file'
 import { VideoFile } from '@shared/models/videos/video-file.model'
 import { generateMagnetUri } from '@server/helpers/webtorrent'
-import { extractVideo } from '@server/lib/videos'
+import { extractVideo } from '@server/helpers/video'
 
 export type VideoFormattingJSONOptions = {
   completeDescription?: boolean
@@ -323,7 +323,10 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoTorrentObject {
     })
   }
 
-  const icons = [ video.getMiniature(), video.getPreview() ]
+  // FIXME: remove and uncomment in PT 2.3
+  // Breaks compatibility with PT <= 2.1
+  // const icons = [ video.getMiniature(), video.getPreview() ]
+  const miniature = video.getMiniature()
 
   return {
     type: 'Video' as 'Video',
@@ -348,13 +351,20 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoTorrentObject {
     content: video.getTruncatedDescription(),
     support: video.support,
     subtitleLanguage,
-    icon: icons.map(i => ({
+    icon: {
       type: 'Image',
-      url: i.getFileUrl(video),
+      url: miniature.getFileUrl(video),
       mediaType: 'image/jpeg',
-      width: i.width,
-      height: i.height
-    })),
+      width: miniature.width,
+      height: miniature.height
+    } as any,
+    // icon: icons.map(i => ({
+    //   type: 'Image',
+    //   url: i.getFileUrl(video),
+    //   mediaType: 'image/jpeg',
+    //   width: i.width,
+    //   height: i.height
+    // })),
     url,
     likes: getVideoLikesActivityPubUrl(video),
     dislikes: getVideoDislikesActivityPubUrl(video),