Fix embed on mastodon

This commit is contained in:
Chocobozzz 2020-02-04 09:19:56 +01:00
parent 9c9a166783
commit 22f18a4a19
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 9 additions and 8 deletions

View File

@ -270,7 +270,15 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoTorrentObject {
} }
} }
const url: ActivityUrlObject[] = [] const url: ActivityUrlObject[] = [
// HTML url should be the first element in the array so Mastodon correctly displays the embed
{
type: 'Link',
mediaType: 'text/html',
href: WEBSERVER.URL + '/videos/watch/' + video.uuid
}
]
addVideoFilesInAPAcc(url, video, baseUrlHttp, baseUrlWs, video.VideoFiles || []) addVideoFilesInAPAcc(url, video, baseUrlHttp, baseUrlWs, video.VideoFiles || [])
for (const playlist of (video.VideoStreamingPlaylists || [])) { for (const playlist of (video.VideoStreamingPlaylists || [])) {
@ -296,13 +304,6 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoTorrentObject {
}) })
} }
// Add video url too
url.push({
type: 'Link',
mediaType: 'text/html',
href: WEBSERVER.URL + '/videos/watch/' + video.uuid
})
const subtitleLanguage = [] const subtitleLanguage = []
for (const caption of video.VideoCaptions) { for (const caption of video.VideoCaptions) {
subtitleLanguage.push({ subtitleLanguage.push({