From 7557704eec3995092136b87154a1fbe644bc0fec Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 5 May 2020 09:15:41 +0200 Subject: Fix compat with peertube 2.1 --- server/models/video/video-format-utils.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'server/models/video') diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts index 0d3c5a8ac..d71a3a5db 100644 --- a/server/models/video/video-format-utils.ts +++ b/server/models/video/video-format-utils.ts @@ -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), -- cgit v1.2.3