Some progress towards accepting and rejecting follows #3

Merged
steffo merged 22 commits from feature/follows into main 2024-10-23 05:47:18 +00:00
5 changed files with 23 additions and 20 deletions
Showing only changes of commit 5f61961792 - Show all commits

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,15 +12,14 @@ 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...`

View file

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