Commit, but this is broken on akkoma auth fetch

This commit is contained in:
Steffo 2024-10-22 10:29:25 +02:00
parent 7d3ab00c2a
commit 5f61961792
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
5 changed files with 23 additions and 20 deletions

15
.vscode/launch.json vendored
View file

@ -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
}
]

View file

@ -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()

View file

@ -22,7 +22,7 @@ export class DotinoVeloce {
this.stratz = stratz
this.federation = createFederation<ContextData>({
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<ContextData>) => ({ 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<ContextData>): Promise<NodeInfo> {
async #nodeInfoHandler(_ctx: Context<ContextData>): Promise<NodeInfo> {
return {
software: {
name: "dotino-veloce",
@ -282,6 +282,11 @@ export class DotinoVeloce {
return result
}
async #instanceKeys(_ctx: Context<ContextData>): Promise<{ identifier: string }> {
l.debug`Getting instance keys...`
return {"identifier": "garasauto"}
}
async #authorizationHandler(_ctx: Context<ContextData>, _handle: string, _signedKey: unknown, _signedKeyOwner: unknown): Promise<boolean> {
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}`
}
}

View file

@ -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()

View file

@ -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()