diff --git a/src/main.ts b/src/main.ts index 356e6d6..e619da0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,4 @@ -import {createFederation} from "@fedify/fedify" +import {createFederation, Service} from "@fedify/fedify" import {configure, getConsoleSink, getLogger} from "@logtape/logtape" import {RedisKvStore} from "https://jsr.io/@fedify/redis/0.3.0/src/kv.ts" import {Redis} from "ioredis" @@ -25,6 +25,24 @@ const kv = new RedisKvStore(redis, {}) l.debug`Creating federation object...` const federation = createFederation({kv}) +l.debug`Creating actor dispatcher...` +const actorDispatcher = async function actorDispatcher(ctx: any, id: string) { + if(id !== "service") { + return null + } + + return new Service({ + id: ctx.getActorUri(id), + name: "[TEST] Dotino Service", + summary: "Core account of a Dotino Veloce instance.", + preferredUsername: id, + url: new URL("/", ctx.url), + }) +} + +l.debug`Connecting actor dispatcher to federation object...` +federation.setActorDispatcher("/users/{identifier}", actorDispatcher) + l.debug`Creating Deno handler...` const handler: Deno.ServeHandler = function handler(request) { const response = federation.fetch(