FediShoop/fedishoop/federation.ts

22 lines
661 B
TypeScript
Raw Permalink Normal View History

2024-10-07 14:25:10 +02:00
import { createFederation, Person } from "@fedify/fedify";
import { getLogger } from "@logtape/logtape";
import { RedisKvStore, RedisMessageQueue } from "@fedify/redis";
import { Redis } from "ioredis";
const logger = getLogger("fedishoop");
const federation = createFederation({
kv: new RedisKvStore(new Redis(Deno.env.get("REDIS_URL"))),
queue: new RedisMessageQueue(() => new Redis(Deno.env.get("REDIS_URL"))),
});
federation.setActorDispatcher("/users/{identifier}", async (ctx, identifier) => {
return new Person({
id: ctx.getActorUri(identifier),
preferredUsername: identifier,
name: identifier,
});
});
export default federation;