FediShoop/fedishoop/federation.ts

22 lines
661 B
TypeScript

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;