@rmdes/indiekit-endpoint-activitypub 1.0.23 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -185,13 +185,11 @@ export default class ActivityPubEndpoint {
185
185
  router.use((req, res, next) => {
186
186
  if (!self._fedifyMiddleware) return next();
187
187
  if (req.method !== "GET" && req.method !== "HEAD") return next();
188
- // Skip Fedify for admin routes handled by authenticated router.
189
- // This router is mounted at "/" so paths include the full mountPath prefix
190
- // (e.g. /activitypub/admin/...), not just /admin/...
191
- const mp = self.options.mountPath;
192
- if (req.path.startsWith("/admin") || req.path.startsWith(`${mp}/admin`)) return next();
193
- // Skip Fedify for the bare dashboard path (e.g. /activitypub)
194
- if (req.path === mp || req.path === `${mp}/`) return next();
188
+ // Only delegate to Fedify for NodeInfo data endpoint (/nodeinfo/2.1).
189
+ // All other paths in this root-mounted router are handled by the
190
+ // content negotiation catch-all below. Passing arbitrary paths like
191
+ // /notes/... to Fedify causes harmless but noisy 404 warnings.
192
+ if (!req.path.startsWith("/nodeinfo/")) return next();
195
193
  return self._fedifyMiddleware(req, res, next);
196
194
  });
197
195
 
@@ -212,13 +212,14 @@ export function setupFederation(options) {
212
212
  return null;
213
213
  })
214
214
  .mapAlias((_ctx, alias) => {
215
- // Resolve profile URL and /@handle patterns via WebFinger
215
+ // Resolve profile URL and /@handle patterns via WebFinger.
216
+ // Must return { identifier } or { username }, not a bare string.
216
217
  if (!publicationUrl) return null;
217
218
  try {
218
219
  const pub = new URL(publicationUrl);
219
220
  if (alias.hostname !== pub.hostname) return null;
220
221
  const path = alias.pathname.replace(/\/$/, "");
221
- if (path === "" || path === `/@${handle}`) return handle;
222
+ if (path === "" || path === `/@${handle}`) return { identifier: handle };
222
223
  } catch { /* ignore */ }
223
224
  return null;
224
225
  })
@@ -296,17 +297,17 @@ export function setupFederation(options) {
296
297
  }
297
298
 
298
299
  return keyPairs;
299
- })
300
- .authorize(async (ctx, identifier, signedKey, _signedKeyOwner) => {
301
- // Instance actor is always publicly accessible (prevents infinite loops)
302
- const hostname = ctx.url?.hostname || "";
303
- if (identifier === hostname) return true;
304
- // Check if authorized fetch is enabled
305
- const profile = await getProfile(collections);
306
- if (!profile.authorizedFetch) return true;
307
- // When enabled, require a valid HTTP Signature
308
- return signedKey != null;
309
300
  });
301
+ // NOTE: .authorize() is intentionally NOT chained here.
302
+ // Fedify's authorize predicate triggers HTTP Signature verification on
303
+ // every GET to the actor endpoint. When a remote server that requires
304
+ // authorized fetch (e.g. kobolds.online, void.ello.tech) requests our
305
+ // actor, Fedify tries to fetch THEIR public key to verify the signature.
306
+ // Those instances return 401, causing a FetchError that Fedify doesn't
307
+ // catch — resulting in 500s for those servers and error log spam.
308
+ // Authorized fetch requires authenticated document loading (using the
309
+ // instance actor's keys for outgoing fetches), which Fedify doesn't yet
310
+ // support out of the box. Re-enable once Fedify adds this capability.
310
311
 
311
312
  // --- Inbox listeners ---
312
313
  const inboxChain = federation.setInboxListeners(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
5
5
  "keywords": [
6
6
  "indiekit",