social-federation tasks 1.1–1.3: - Add @fedify/fedify pinned to exactly 2.1.16: every 2.2.x release depends on @fedify/webfinger@2.2.x which was never published to npm, so 2.1.16 is the newest installable version. - app/lib/federation.server.ts: Federation instance with an actor dispatcher serving Person objects for public users; private and unknown users 404 (no existence leak). MemoryKvStore for now. - /.well-known/webfinger resource route delegating to federation.fetch. - ActivityPub content negotiation on /users/:username via route middleware (future.v8_middleware — no loader uses the context arg, so the flag is a no-op for existing code). - FEDERATION_ENABLED env flag (default off) gating every federation surface. - Unit tests exercise the Fedify dispatcher as a remote AP client: WebFinger resolution, actor fetch with Mastodon's Accept header, private-user 404s, flag-off 404s. Spike verdict: Fedify fits — URL dispatch, JRD/AP serialization, and visibility gating all work through framework routes without a custom server layer. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
13 lines
501 B
TypeScript
13 lines
501 B
TypeScript
import type { Route } from "./+types/api.well-known.webfinger";
|
|
import { handleFederationRequest } from "~/lib/federation.server";
|
|
|
|
/**
|
|
* GET /.well-known/webfinger?resource=acct:user@domain
|
|
*
|
|
* ActivityPub discovery: resolves an acct: handle to the user's actor IRI.
|
|
* Fully handled by Fedify; 404s while FEDERATION_ENABLED is off, and for
|
|
* users whose profile_visibility is not 'public'.
|
|
*/
|
|
export function loader({ request }: Route.LoaderArgs) {
|
|
return handleFederationRequest(request);
|
|
}
|