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",