aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-07 15:27:41 +0200
committerChocobozzz <me@florianbigard.com>2020-04-07 15:32:20 +0200
commit8c9e7875269a990ed3000e1d4995d808e4ff50f7 (patch)
tree896f60aedf0fac0dc64b57ff76a63e7a718c0a5b /server/lib/activitypub
parentbc30363602ad504d784662a9373c0a114d05042c (diff)
downloadPeerTube-8c9e7875269a990ed3000e1d4995d808e4ff50f7.tar.gz
PeerTube-8c9e7875269a990ed3000e1d4995d808e4ff50f7.tar.zst
PeerTube-8c9e7875269a990ed3000e1d4995d808e4ff50f7.zip
Add ability to accept or not remote redundancies
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r--server/lib/activitypub/process/process-create.ts3
-rw-r--r--server/lib/activitypub/process/process-update.ts3
2 files changed, 6 insertions, 0 deletions
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts
index bee853721..d375e29e3 100644
--- a/server/lib/activitypub/process/process-create.ts
+++ b/server/lib/activitypub/process/process-create.ts
@@ -12,6 +12,7 @@ import { PlaylistObject } from '../../../../shared/models/activitypub/objects/pl
12import { createOrUpdateVideoPlaylist } from '../playlist' 12import { createOrUpdateVideoPlaylist } from '../playlist'
13import { APProcessorOptions } from '../../../typings/activitypub-processor.model' 13import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
14import { MActorSignature, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../../typings/models' 14import { MActorSignature, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../../typings/models'
15import { isRedundancyAccepted } from '@server/lib/redundancy'
15 16
16async function processCreateActivity (options: APProcessorOptions<ActivityCreate>) { 17async function processCreateActivity (options: APProcessorOptions<ActivityCreate>) {
17 const { activity, byActor } = options 18 const { activity, byActor } = options
@@ -60,6 +61,8 @@ async function processCreateVideo (activity: ActivityCreate, notify: boolean) {
60} 61}
61 62
62async function processCreateCacheFile (activity: ActivityCreate, byActor: MActorSignature) { 63async function processCreateCacheFile (activity: ActivityCreate, byActor: MActorSignature) {
64 if (await isRedundancyAccepted(activity, byActor) !== true) return
65
63 const cacheFile = activity.object as CacheFileObject 66 const cacheFile = activity.object as CacheFileObject
64 67
65 const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: cacheFile.object }) 68 const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: cacheFile.object })
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts
index a47d605d8..9579512b7 100644
--- a/server/lib/activitypub/process/process-update.ts
+++ b/server/lib/activitypub/process/process-update.ts
@@ -16,6 +16,7 @@ import { PlaylistObject } from '../../../../shared/models/activitypub/objects/pl
16import { createOrUpdateVideoPlaylist } from '../playlist' 16import { createOrUpdateVideoPlaylist } from '../playlist'
17import { APProcessorOptions } from '../../../typings/activitypub-processor.model' 17import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
18import { MActorSignature, MAccountIdActor } from '../../../typings/models' 18import { MActorSignature, MAccountIdActor } from '../../../typings/models'
19import { isRedundancyAccepted } from '@server/lib/redundancy'
19 20
20async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) { 21async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) {
21 const { activity, byActor } = options 22 const { activity, byActor } = options
@@ -78,6 +79,8 @@ async function processUpdateVideo (actor: MActorSignature, activity: ActivityUpd
78} 79}
79 80
80async function processUpdateCacheFile (byActor: MActorSignature, activity: ActivityUpdate) { 81async function processUpdateCacheFile (byActor: MActorSignature, activity: ActivityUpdate) {
82 if (await isRedundancyAccepted(activity, byActor) !== true) return
83
81 const cacheFileObject = activity.object as CacheFileObject 84 const cacheFileObject = activity.object as CacheFileObject
82 85
83 if (!isCacheFileObjectValid(cacheFileObject)) { 86 if (!isCacheFileObjectValid(cacheFileObject)) {