Accept actors with url objects instead of string
This commit is contained in:
parent
529479f924
commit
d765fafc3f
1 changed files with 8 additions and 1 deletions
|
@ -252,7 +252,7 @@ async function fetchRemoteActor (actorUrl: string): Promise<FetchRemoteActorResu
|
||||||
logger.info('Fetching remote actor %s.', actorUrl)
|
logger.info('Fetching remote actor %s.', actorUrl)
|
||||||
|
|
||||||
const requestResult = await doRequest(options)
|
const requestResult = await doRequest(options)
|
||||||
const actorJSON: ActivityPubActor = requestResult.body
|
const actorJSON: ActivityPubActor = normalizeActor(requestResult.body)
|
||||||
|
|
||||||
if (isActorObjectValid(actorJSON) === false) {
|
if (isActorObjectValid(actorJSON) === false) {
|
||||||
logger.debug('Remote actor JSON is not valid.', { actorJSON: actorJSON })
|
logger.debug('Remote actor JSON is not valid.', { actorJSON: actorJSON })
|
||||||
|
@ -358,3 +358,10 @@ async function refreshActorIfNeeded (actor: ActorModel) {
|
||||||
return actor
|
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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue