aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/activitypub.ts6
-rw-r--r--server/helpers/custom-validators/activitypub/actor.ts3
2 files changed, 5 insertions, 4 deletions
diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts
index 8b56d2d50..fe721cbac 100644
--- a/server/helpers/activitypub.ts
+++ b/server/helpers/activitypub.ts
@@ -187,10 +187,10 @@ function buildSignedActivity <T> (byActor: MActor, data: T, contextType?: Contex
187 return signJsonLDObject(byActor, activity) 187 return signJsonLDObject(byActor, activity)
188} 188}
189 189
190function getAPId (activity: string | { id: string }) { 190function getAPId (object: string | { id: string }) {
191 if (typeof activity === 'string') return activity 191 if (typeof object === 'string') return object
192 192
193 return activity.id 193 return object.id
194} 194}
195 195
196function checkUrlsSameHost (url1: string, url2: string) { 196function checkUrlsSameHost (url1: string, url2: string) {
diff --git a/server/helpers/custom-validators/activitypub/actor.ts b/server/helpers/custom-validators/activitypub/actor.ts
index 675a7b663..a4b152722 100644
--- a/server/helpers/custom-validators/activitypub/actor.ts
+++ b/server/helpers/custom-validators/activitypub/actor.ts
@@ -60,11 +60,12 @@ function isActorDeleteActivityValid (activity: any) {
60} 60}
61 61
62function sanitizeAndCheckActorObject (actor: any) { 62function sanitizeAndCheckActorObject (actor: any) {
63 if (!isActorTypeValid(actor.type)) return false
64
63 normalizeActor(actor) 65 normalizeActor(actor)
64 66
65 return exists(actor) && 67 return exists(actor) &&
66 isActivityPubUrlValid(actor.id) && 68 isActivityPubUrlValid(actor.id) &&
67 isActorTypeValid(actor.type) &&
68 isActivityPubUrlValid(actor.inbox) && 69 isActivityPubUrlValid(actor.inbox) &&
69 isActorPreferredUsernameValid(actor.preferredUsername) && 70 isActorPreferredUsernameValid(actor.preferredUsername) &&
70 isActivityPubUrlValid(actor.url) && 71 isActivityPubUrlValid(actor.url) &&