Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Accept actors with url objects instead of string

Chocobozzzd765fafc3faf
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts
index 7494aadbb8..c708b38ba1 100644
--- a/server/lib/activitypub/actor.ts
+++ b/server/lib/activitypub/actor.ts
@@ -252,7 +252,7 @@ async function fetchRemoteActor (actorUrl: string): Promise<FetchRemoteActorResu
logger.info('Fetching remote actor %s.', actorUrl)
const requestResult = await doRequest(options)
- const actorJSON: ActivityPubActor = requestResult.body
+ const actorJSON: ActivityPubActor = normalizeActor(requestResult.body)
if (isActorObjectValid(actorJSON) === false) {
logger.debug('Remote actor JSON is not valid.', { actorJSON: actorJSON })
@@ -358,3 +358,10 @@ async function refreshActorIfNeeded (actor: ActorModel) {
return actor
})
}
+
+function normalizeActor (actor: any) {
+ if (actor && actor.url && typeof actor.url === 'string') return actor
+
+ actor.url = actor.url.href || actor.url.url
+ return actor
+}