feat: support actor URL as a way to add federated event source

This commit is contained in:
lesion 2025-01-22 13:08:11 +01:00
parent 6a102a95f3
commit 7e19f7d91c
No known key found for this signature in database
GPG key ID: 352918250B012177

View file

@ -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)