From 7e19f7d91c43585f7dd6ac0d00ed09a5e26260f3 Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 22 Jan 2025 13:08:11 +0100 Subject: [PATCH] feat: support actor URL as a way to add federated event source --- server/api/controller/instance.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/server/api/controller/instance.js b/server/api/controller/instance.js index fb2d98cb..6b716abf 100644 --- a/server/api/controller/instance.js +++ b/server/api/controller/instance.js @@ -178,19 +178,19 @@ const instancesController = { let actor // should we try to use URL as actor? to review - // try { - // log.debug('[FEDI] Trying to use %s as actor', url) - // actor = await getActor(url, instance) - // log.debug('[FEDI] Actor %s', actor) - // await actor.update({ trusted: true }) - // await followActor(actor) - // return res.json(actor) - // } catch (e) { - // log.debug('[FEDI] %s is probably not an actor: %s', url, e) - // } + try { + log.debug('[FEDI] Trying to use %s as actor', url) + actor = await getActor(url, instance) + log.debug('[FEDI] Actor %s', actor) + await actor.update({ trusted: true }) + await followActor(actor) + return res.json(actor) + } catch (e) { + log.debug('[FEDI] %s is probably not an actor: %s', url, e) + } // ok this wasn't an actor, let's use the applicationActor if exists - if (instance?.applicationActor) { + if (!actor && instance?.applicationActor) { log.debug('[FEDI] This node supports FEP-2677 and applicationActor is: %s', instance.applicationActor) actor = await getActor(instance.applicationActor, instance, true) log.debug('[FEDI] Actor %s', actor)