aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-03-22 18:40:33 +0100
committerChocobozzz <me@florianbigard.com>2018-03-22 18:40:56 +0100
commit6be84cbcea99518e8eca58c76259effd0dd992fd (patch)
treec2b4b22c8b60528025b172013d72c12f8ba06192 /server/helpers/custom-validators
parent9e841674da612b68bf84a427a8710a44347083f5 (diff)
downloadPeerTube-6be84cbcea99518e8eca58c76259effd0dd992fd.tar.gz
PeerTube-6be84cbcea99518e8eca58c76259effd0dd992fd.tar.zst
PeerTube-6be84cbcea99518e8eca58c76259effd0dd992fd.zip
Improve activity pub actors implementation
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r--server/helpers/custom-validators/activitypub/activity.ts2
-rw-r--r--server/helpers/custom-validators/activitypub/misc.ts2
2 files changed, 2 insertions, 2 deletions
diff --git a/server/helpers/custom-validators/activitypub/activity.ts b/server/helpers/custom-validators/activitypub/activity.ts
index 632f14223..7e4dccefb 100644
--- a/server/helpers/custom-validators/activitypub/activity.ts
+++ b/server/helpers/custom-validators/activitypub/activity.ts
@@ -26,7 +26,7 @@ function isRootActivityValid (activity: any) {
26 ) || 26 ) ||
27 ( 27 (
28 isActivityPubUrlValid(activity.id) && 28 isActivityPubUrlValid(activity.id) &&
29 isActivityPubUrlValid(activity.actor) 29 (isActivityPubUrlValid(activity.actor) || isActivityPubUrlValid(activity.actor.id))
30 ) 30 )
31} 31}
32 32
diff --git a/server/helpers/custom-validators/activitypub/misc.ts b/server/helpers/custom-validators/activitypub/misc.ts
index 75d308e9d..2dac8e1ad 100644
--- a/server/helpers/custom-validators/activitypub/misc.ts
+++ b/server/helpers/custom-validators/activitypub/misc.ts
@@ -24,7 +24,7 @@ function isBaseActivityValid (activity: any, type: string) {
24 return (activity['@context'] === undefined || Array.isArray(activity['@context'])) && 24 return (activity['@context'] === undefined || Array.isArray(activity['@context'])) &&
25 activity.type === type && 25 activity.type === type &&
26 isActivityPubUrlValid(activity.id) && 26 isActivityPubUrlValid(activity.id) &&
27 isActivityPubUrlValid(activity.actor) && 27 (isActivityPubUrlValid(activity.actor) || isActivityPubUrlValid(activity.actor.id)) &&
28 ( 28 (
29 activity.to === undefined || 29 activity.to === undefined ||
30 (Array.isArray(activity.to) && activity.to.every(t => isActivityPubUrlValid(t))) 30 (Array.isArray(activity.to) && activity.to.every(t => isActivityPubUrlValid(t)))