aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r--server/models/video/video.ts19
1 files changed, 17 insertions, 2 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 457bfce77..4956b57ee 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -32,6 +32,7 @@ import { isVideoNameValid, isVideoLicenceValid, isVideoNSFWValid, isVideoDescrip
32import { logger } from '../../helpers/logger' 32import { logger } from '../../helpers/logger'
33import { generateImageFromVideoFile, transcode, getVideoFileHeight } from '../../helpers/ffmpeg-utils' 33import { generateImageFromVideoFile, transcode, getVideoFileHeight } from '../../helpers/ffmpeg-utils'
34import { createTorrentPromise, writeFilePromise, unlinkPromise, renamePromise, statPromise } from '../../helpers/core-utils' 34import { createTorrentPromise, writeFilePromise, unlinkPromise, renamePromise, statPromise } from '../../helpers/core-utils'
35import { getAnnounceActivityPubUrl } from '../../lib/activitypub/url'
35 36
36let Video: Sequelize.Model<VideoInstance, VideoAttributes> 37let Video: Sequelize.Model<VideoInstance, VideoAttributes>
37let getOriginalFile: VideoMethods.GetOriginalFile 38let getOriginalFile: VideoMethods.GetOriginalFile
@@ -573,6 +574,18 @@ toActivityPubObject = function (this: VideoInstance) {
573 dislikesObject = activityPubCollection(dislikes) 574 dislikesObject = activityPubCollection(dislikes)
574 } 575 }
575 576
577 let sharesObject
578 if (Array.isArray(this.VideoShares)) {
579 const shares: string[] = []
580
581 for (const videoShare of this.VideoShares) {
582 const shareUrl = getAnnounceActivityPubUrl(this.url, videoShare.Account)
583 shares.push(shareUrl)
584 }
585
586 sharesObject = activityPubCollection(shares)
587 }
588
576 const url = [] 589 const url = []
577 for (const file of this.VideoFiles) { 590 for (const file of this.VideoFiles) {
578 url.push({ 591 url.push({
@@ -630,7 +643,8 @@ toActivityPubObject = function (this: VideoInstance) {
630 }, 643 },
631 url, 644 url,
632 likes: likesObject, 645 likes: likesObject,
633 dislikes: dislikesObject 646 dislikes: dislikesObject,
647 shares: sharesObject
634 } 648 }
635 649
636 return videoObject 650 return videoObject
@@ -823,7 +837,8 @@ listAllAndSharedByAccountForOutbox = function (accountId: number, start: number,
823 accountId 837 accountId
824 } 838 }
825 ] 839 ]
826 } 840 },
841 include: [ Video['sequelize'].models.Account ]
827 }, 842 },
828 { 843 {
829 model: Video['sequelize'].models.VideoChannel, 844 model: Video['sequelize'].models.VideoChannel,