aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/videos.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-26 11:50:18 +0100
committerChocobozzz <me@florianbigard.com>2021-02-26 11:50:18 +0100
commit92315d979c3f424d81f8fca3c8831d81e4e2a6d6 (patch)
treefab1a460dba5efc217a5be91e0ed7303cd5d3633 /server/lib/activitypub/videos.ts
parent23ac334389a6b11ba0656a18ff760fb45f7bec57 (diff)
downloadPeerTube-92315d979c3f424d81f8fca3c8831d81e4e2a6d6.tar.gz
PeerTube-92315d979c3f424d81f8fca3c8831d81e4e2a6d6.tar.zst
PeerTube-92315d979c3f424d81f8fca3c8831d81e4e2a6d6.zip
More robust channel change federation
Diffstat (limited to 'server/lib/activitypub/videos.ts')
-rw-r--r--server/lib/activitypub/videos.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts
index c38edad56..c29bcc528 100644
--- a/server/lib/activitypub/videos.ts
+++ b/server/lib/activitypub/videos.ts
@@ -336,10 +336,15 @@ async function updateVideoFromAP (options: {
336 336
337 videoFieldsSave = video.toJSON() 337 videoFieldsSave = video.toJSON()
338 338
339 // Check actor has the right to update the video 339 // Check we can update the channel: we trust the remote server
340 const videoChannel = video.VideoChannel 340 const oldVideoChannel = video.VideoChannel
341 if (videoChannel.Account.id !== account.id) { 341
342 throw new Error('Account ' + account.Actor.url + ' does not own video channel ' + videoChannel.Actor.url) 342 if (!oldVideoChannel.Actor.serverId || !channel.Actor.serverId) {
343 throw new Error('Cannot check old channel/new channel validity because `serverId` is null')
344 }
345
346 if (oldVideoChannel.Actor.serverId !== channel.Actor.serverId) {
347 throw new Error('New channel ' + channel.Actor.url + ' is not on the same server than new channel ' + oldVideoChannel.Actor.url)
343 } 348 }
344 349
345 const to = overrideTo || videoObject.to 350 const to = overrideTo || videoObject.to