diff --git a/.vscode/launch.json b/.vscode/launch.json index b373eb9..72c3ea5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,35 +8,32 @@ "request": "launch", "name": "Reinitialize database", "type": "node", - "program": "${workspaceFolder}/src/entry/dbInit.ts", - "cwd": "${workspaceFolder}", - "envFile": "${workspaceFolder}/local.env", "runtimeExecutable": "/usr/bin/deno", "runtimeArgs": [ "run", - "--watch", "--no-prompt", "--allow-all", "--inspect-wait" ], + "program": "${workspaceFolder}/src/entry/dbInit.ts", + "cwd": "${workspaceFolder}", + "envFile": "${workspaceFolder}/local.env", "attachSimplePort": 9229 }, { "request": "launch", "name": "Dev Server", "type": "node", - "program": "${workspaceFolder}/src/entry/server.ts", - "cwd": "${workspaceFolder}", - "envFile": "${workspaceFolder}/local.env", "runtimeExecutable": "/usr/bin/deno", - "restart": true, "runtimeArgs": [ "run", - "--watch", "--no-prompt", "--allow-all", "--inspect-wait" ], + "program": "${workspaceFolder}/src/entry/server.ts", + "cwd": "${workspaceFolder}", + "envFile": "${workspaceFolder}/local.env", "attachSimplePort": 9229 } ] diff --git a/src/deno/router.ts b/src/deno/router.ts index 82715f5..f2b5e21 100644 --- a/src/deno/router.ts +++ b/src/deno/router.ts @@ -12,16 +12,15 @@ export function createRouter(ap: DotinoVeloce) { l.debug`Determining request's User-Agent...` const agent = request.headers.get("User-Agent") - l.debug`Request's User-Agent is: ${agent}` l.debug`Determining request's URL...` const url = new URL(request.url) - l.debug`Request's URL is: ${url}` l.debug`Determining request's pathname...` const pathname = url.pathname - l.debug`Request's pathname is: ${pathname}` - + + l.info`User-Agent: ${agent} | URL: ${url} | Pathname: ${pathname}` + if (url.pathname === "/favicon.ico") { l.debug`Delegating handling to favicon handler...` return await handleFavicon() diff --git a/src/dv/index.ts b/src/dv/index.ts index bc39724..31170b3 100644 --- a/src/dv/index.ts +++ b/src/dv/index.ts @@ -22,7 +22,7 @@ export class DotinoVeloce { this.stratz = stratz this.federation = createFederation({ - kv: db.useAsKvStore(), + kv: db.useAsKvStore(), }) this.federation @@ -34,7 +34,7 @@ export class DotinoVeloce { .setInboxListeners("/inbox/{identifier}", "/inbox") // Akkoma with Authorized Fetch requires this to be set // https://p.junimo.party/#/junimo.party/s/AnFW6s3OURPMY04LKq?view=full - .setSharedKeyDispatcher((_ctx: Context) => ({ identifier: "service" })) + .setSharedKeyDispatcher(this.#instanceKeys.bind(this)) .on(Follow, this.#followHandler.bind(this)) this.federation @@ -43,7 +43,7 @@ export class DotinoVeloce { // TODO: Setup a message queue } - async #nodeInfoHandler(ctx: Context): Promise { + async #nodeInfoHandler(_ctx: Context): Promise { return { software: { name: "dotino-veloce", @@ -282,6 +282,11 @@ export class DotinoVeloce { return result } + async #instanceKeys(_ctx: Context): Promise<{ identifier: string }> { + l.debug`Getting instance keys...` + return {"identifier": "garasauto"} + } + async #authorizationHandler(_ctx: Context, _handle: string, _signedKey: unknown, _signedKeyOwner: unknown): Promise { return true } @@ -322,5 +327,7 @@ export class DotinoVeloce { l.debug`Attempting to determine target of the follow request...` const target = await follow.getTarget(ctx) l.debug`Target is: ${target}` + + } } diff --git a/src/entry/dbInit.ts b/src/entry/dbInit.ts index a4220c0..530e47e 100644 --- a/src/entry/dbInit.ts +++ b/src/entry/dbInit.ts @@ -2,11 +2,11 @@ import { Database } from "../database/index.ts" import { initLogging } from "../deno/logging.ts" -async function main() { +async function entryDbInit() { await initLogging() const db = Database.fromEnv() await db.reinitializeDev() } -main() +entryDbInit() diff --git a/src/entry/server.ts b/src/entry/server.ts index cf9bfc2..fca8b90 100644 --- a/src/entry/server.ts +++ b/src/entry/server.ts @@ -7,7 +7,7 @@ import { DotinoVeloce } from "../dv/index.ts" import { Database } from "../database/index.ts" -async function main() { +async function entryServer() { await initLogging() const db = Database.fromEnv() const stratz = StratzAPI.fromEnv() @@ -18,4 +18,4 @@ async function main() { } -main() +entryServer()