aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r--server/lib/activitypub/process/process-update.ts2
-rw-r--r--server/lib/activitypub/send/misc.ts4
-rw-r--r--server/lib/activitypub/videos.ts20
3 files changed, 8 insertions, 18 deletions
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts
index 566e5938b..24e5589d4 100644
--- a/server/lib/activitypub/process/process-update.ts
+++ b/server/lib/activitypub/process/process-update.ts
@@ -71,7 +71,7 @@ async function updateRemoteVideo (actor: ActorModel, activity: ActivityUpdate) {
71 throw new Error('Account ' + actor.url + ' does not own video channel ' + videoChannel.Actor.url) 71 throw new Error('Account ' + actor.url + ' does not own video channel ' + videoChannel.Actor.url)
72 } 72 }
73 73
74 const videoData = await videoActivityObjectToDBAttributes(videoChannel, videoAttributesToUpdate, activity.to, activity.cc) 74 const videoData = await videoActivityObjectToDBAttributes(videoChannel, videoAttributesToUpdate, activity.to)
75 videoInstance.set('name', videoData.name) 75 videoInstance.set('name', videoData.name)
76 videoInstance.set('uuid', videoData.uuid) 76 videoInstance.set('uuid', videoData.uuid)
77 videoInstance.set('url', videoData.url) 77 videoInstance.set('url', videoData.url)
diff --git a/server/lib/activitypub/send/misc.ts b/server/lib/activitypub/send/misc.ts
index 7a21f0c94..607822d16 100644
--- a/server/lib/activitypub/send/misc.ts
+++ b/server/lib/activitypub/send/misc.ts
@@ -153,8 +153,8 @@ function buildAudience (followerInboxUrls: string[], isPublic = true) {
153 to = [ ACTIVITY_PUB.PUBLIC ] 153 to = [ ACTIVITY_PUB.PUBLIC ]
154 cc = followerInboxUrls 154 cc = followerInboxUrls
155 } else { // Unlisted 155 } else { // Unlisted
156 to = followerInboxUrls 156 to = [ ]
157 cc = [ ACTIVITY_PUB.PUBLIC ] 157 cc = [ ]
158 } 158 }
159 159
160 return { to, cc } 160 return { to, cc }
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts
index e65362190..e7b516129 100644
--- a/server/lib/activitypub/videos.ts
+++ b/server/lib/activitypub/videos.ts
@@ -56,11 +56,8 @@ function generateThumbnailFromUrl (video: VideoModel, icon: ActivityIconObject)
56 56
57async function videoActivityObjectToDBAttributes (videoChannel: VideoChannelModel, 57async function videoActivityObjectToDBAttributes (videoChannel: VideoChannelModel,
58 videoObject: VideoTorrentObject, 58 videoObject: VideoTorrentObject,
59 to: string[] = [], 59 to: string[] = []) {
60 cc: string[] = []) { 60 const privacy = to.indexOf(ACTIVITY_PUB.PUBLIC) !== -1 ? VideoPrivacy.PUBLIC : VideoPrivacy.UNLISTED
61 let privacy = VideoPrivacy.PRIVATE
62 if (to.indexOf(ACTIVITY_PUB.PUBLIC) !== -1) privacy = VideoPrivacy.PUBLIC
63 else if (cc.indexOf(ACTIVITY_PUB.PUBLIC) !== -1) privacy = VideoPrivacy.UNLISTED
64 61
65 const duration = videoObject.duration.replace(/[^\d]+/, '') 62 const duration = videoObject.duration.replace(/[^\d]+/, '')
66 let language = null 63 let language = null
@@ -78,15 +75,8 @@ async function videoActivityObjectToDBAttributes (videoChannel: VideoChannelMode
78 licence = parseInt(videoObject.licence.identifier, 10) 75 licence = parseInt(videoObject.licence.identifier, 10)
79 } 76 }
80 77
81 let description = null 78 const description = videoObject.content || null
82 if (videoObject.content) { 79 const support = videoObject.support || null
83 description = videoObject.content
84 }
85
86 let support = null
87 if (videoObject.support) {
88 support = videoObject.support
89 }
90 80
91 return { 81 return {
92 name: videoObject.name, 82 name: videoObject.name,
@@ -157,7 +147,7 @@ async function getOrCreateVideo (videoObject: VideoTorrentObject, channelActor:
157 const videoFromDatabase = await VideoModel.loadByUUIDOrURLAndPopulateAccount(videoObject.uuid, videoObject.id, t) 147 const videoFromDatabase = await VideoModel.loadByUUIDOrURLAndPopulateAccount(videoObject.uuid, videoObject.id, t)
158 if (videoFromDatabase) return videoFromDatabase 148 if (videoFromDatabase) return videoFromDatabase
159 149
160 const videoData = await videoActivityObjectToDBAttributes(channelActor.VideoChannel, videoObject, videoObject.to, videoObject.cc) 150 const videoData = await videoActivityObjectToDBAttributes(channelActor.VideoChannel, videoObject, videoObject.to)
161 const video = VideoModel.build(videoData) 151 const video = VideoModel.build(videoData)
162 152
163 // Don't block on request 153 // Don't block on request