aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-10-23 11:33:53 +0200
committerChocobozzz <me@florianbigard.com>2019-10-23 11:33:53 +0200
commit47581df0737ebcc058a5863143c752f9112a4424 (patch)
tree3b64e3fc49de4bea41d8fd852201ba3abb6b4994 /server/helpers
parenta0e6d267598839c8a5508a65876ce0e07d1b3d74 (diff)
downloadPeerTube-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.ts15
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'
6import { peertubeTruncate } from '@server/helpers/core-utils' 6import { peertubeTruncate } from '@server/helpers/core-utils'
7 7
8function isActorEndpointsObjectValid (endpointObject: any) { 8function 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
12function isActorPublicKeyObjectValid (publicKeyObject: any) { 17function isActorPublicKeyObjectValid (publicKeyObject: any) {
@@ -16,7 +21,7 @@ function isActorPublicKeyObjectValid (publicKeyObject: any) {
16} 21}
17 22
18function isActorTypeValid (type: string) { 23function 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
22function isActorPublicKeyValid (publicKey: string) { 27function isActorPublicKeyValid (publicKey: string) {
@@ -81,9 +86,11 @@ function sanitizeAndCheckActorObject (object: any) {
81} 86}
82 87
83function normalizeActor (actor: any) { 88function 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