From 525abcbf845ab960ecc187311d6310eb36441204 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Fri, 27 Feb 2026 11:01:56 +0100 Subject: [PATCH] feat: expose signed avatar resolver for cross-plugin use Register resolveActorAvatar() on Indiekit.config.application during init(). Uses Fedify's authenticated document loader to fetch actor profiles from servers with Authorized Fetch enabled (e.g., hachyderm.io, indieweb.social). Called by the conversations plugin's avatar backfill. --- index.js | 23 +++++++++++++++++++++++ package.json | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index c8b5a7c..14c04a5 100644 --- a/index.js +++ b/index.js @@ -1047,6 +1047,29 @@ export default class ActivityPubEndpoint { this._federation = federation; this._fedifyMiddleware = createFedifyMiddleware(federation, () => ({})); + // Expose signed avatar resolver for cross-plugin use (e.g., conversations backfill) + Indiekit.config.application.resolveActorAvatar = async (actorUrl) => { + try { + const handle = this.options.actor.handle; + const ctx = this._federation.createContext( + new URL(this._publicationUrl), + { handle, publicationUrl: this._publicationUrl }, + ); + const documentLoader = await ctx.getDocumentLoader({ + identifier: handle, + }); + const actor = await ctx.lookupObject(new URL(actorUrl), { + documentLoader, + }); + if (!actor) return ""; + const { extractActorInfo } = await import("./lib/timeline-store.js"); + const info = await extractActorInfo(actor, { documentLoader }); + return info.photo || ""; + } catch { + return ""; + } + }; + // Register as endpoint (mounts routesPublic, routesWellKnown, routes) Indiekit.addEndpoint(this); diff --git a/package.json b/package.json index 0f9090a..579f5e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rmdes/indiekit-endpoint-activitypub", - "version": "2.0.29", + "version": "2.0.30", "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.", "keywords": [ "indiekit",