diff options
author | Chocobozzz <me@florianbigard.com> | 2019-10-23 11:33:53 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-10-23 11:33:53 +0200 |
commit | 47581df0737ebcc058a5863143c752f9112a4424 (patch) | |
tree | 3b64e3fc49de4bea41d8fd852201ba3abb6b4994 /server/helpers | |
parent | a0e6d267598839c8a5508a65876ce0e07d1b3d74 (diff) | |
download | PeerTube-47581df0737ebcc058a5863143c752f9112a4424.tar.gz PeerTube-47581df0737ebcc058a5863143c752f9112a4424.tar.zst PeerTube-47581df0737ebcc058a5863143c752f9112a4424.zip |
Fix federation with some actors
That don't have a shared inbox, or a URL
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/custom-validators/activitypub/actor.ts | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/server/helpers/custom-validators/activitypub/actor.ts b/server/helpers/custom-validators/activitypub/actor.ts index 4e9aabf0e..ec4dd6f96 100644 --- a/server/helpers/custom-validators/activitypub/actor.ts +++ b/server/helpers/custom-validators/activitypub/actor.ts | |||
@@ -6,7 +6,12 @@ import { isHostValid } from '../servers' | |||
6 | import { peertubeTruncate } from '@server/helpers/core-utils' | 6 | import { peertubeTruncate } from '@server/helpers/core-utils' |
7 | 7 | ||
8 | function isActorEndpointsObjectValid (endpointObject: any) { | 8 | function isActorEndpointsObjectValid (endpointObject: any) { |
9 | return isActivityPubUrlValid(endpointObject.sharedInbox) | 9 | if (endpointObject && endpointObject.sharedInbox) { |
10 | return isActivityPubUrlValid(endpointObject.sharedInbox) | ||
11 | } | ||
12 | |||
13 | // Shared inbox is optional | ||
14 | return true | ||
10 | } | 15 | } |
11 | 16 | ||
12 | function isActorPublicKeyObjectValid (publicKeyObject: any) { | 17 | function isActorPublicKeyObjectValid (publicKeyObject: any) { |
@@ -16,7 +21,7 @@ function isActorPublicKeyObjectValid (publicKeyObject: any) { | |||
16 | } | 21 | } |
17 | 22 | ||
18 | function isActorTypeValid (type: string) { | 23 | function isActorTypeValid (type: string) { |
19 | return type === 'Person' || type === 'Application' || type === 'Group' | 24 | return type === 'Person' || type === 'Application' || type === 'Group' || type === 'Service' || type === 'Organization' |
20 | } | 25 | } |
21 | 26 | ||
22 | function isActorPublicKeyValid (publicKey: string) { | 27 | function isActorPublicKeyValid (publicKey: string) { |
@@ -81,9 +86,11 @@ function sanitizeAndCheckActorObject (object: any) { | |||
81 | } | 86 | } |
82 | 87 | ||
83 | function normalizeActor (actor: any) { | 88 | function normalizeActor (actor: any) { |
84 | if (!actor || !actor.url) return | 89 | if (!actor) return |
85 | 90 | ||
86 | if (typeof actor.url !== 'string') { | 91 | if (!actor.url) { |
92 | actor.url = actor.id | ||
93 | } else if (typeof actor.url !== 'string') { | ||
87 | actor.url = actor.url.href || actor.url.url | 94 | actor.url = actor.url.href || actor.url.url |
88 | } | 95 | } |
89 | 96 | ||