Commit, but this is broken on akkoma auth fetch
This commit is contained in:
parent
7d3ab00c2a
commit
5f61961792
5 changed files with 23 additions and 20 deletions
15
.vscode/launch.json
vendored
15
.vscode/launch.json
vendored
|
@ -8,35 +8,32 @@
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Reinitialize database",
|
"name": "Reinitialize database",
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"program": "${workspaceFolder}/src/entry/dbInit.ts",
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"envFile": "${workspaceFolder}/local.env",
|
|
||||||
"runtimeExecutable": "/usr/bin/deno",
|
"runtimeExecutable": "/usr/bin/deno",
|
||||||
"runtimeArgs": [
|
"runtimeArgs": [
|
||||||
"run",
|
"run",
|
||||||
"--watch",
|
|
||||||
"--no-prompt",
|
"--no-prompt",
|
||||||
"--allow-all",
|
"--allow-all",
|
||||||
"--inspect-wait"
|
"--inspect-wait"
|
||||||
],
|
],
|
||||||
|
"program": "${workspaceFolder}/src/entry/dbInit.ts",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"envFile": "${workspaceFolder}/local.env",
|
||||||
"attachSimplePort": 9229
|
"attachSimplePort": 9229
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Dev Server",
|
"name": "Dev Server",
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"program": "${workspaceFolder}/src/entry/server.ts",
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"envFile": "${workspaceFolder}/local.env",
|
|
||||||
"runtimeExecutable": "/usr/bin/deno",
|
"runtimeExecutable": "/usr/bin/deno",
|
||||||
"restart": true,
|
|
||||||
"runtimeArgs": [
|
"runtimeArgs": [
|
||||||
"run",
|
"run",
|
||||||
"--watch",
|
|
||||||
"--no-prompt",
|
"--no-prompt",
|
||||||
"--allow-all",
|
"--allow-all",
|
||||||
"--inspect-wait"
|
"--inspect-wait"
|
||||||
],
|
],
|
||||||
|
"program": "${workspaceFolder}/src/entry/server.ts",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"envFile": "${workspaceFolder}/local.env",
|
||||||
"attachSimplePort": 9229
|
"attachSimplePort": 9229
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -12,16 +12,15 @@ export function createRouter(ap: DotinoVeloce) {
|
||||||
|
|
||||||
l.debug`Determining request's User-Agent...`
|
l.debug`Determining request's User-Agent...`
|
||||||
const agent = request.headers.get("User-Agent")
|
const agent = request.headers.get("User-Agent")
|
||||||
l.debug`Request's User-Agent is: ${agent}`
|
|
||||||
|
|
||||||
l.debug`Determining request's URL...`
|
l.debug`Determining request's URL...`
|
||||||
const url = new URL(request.url)
|
const url = new URL(request.url)
|
||||||
l.debug`Request's URL is: ${url}`
|
|
||||||
|
|
||||||
l.debug`Determining request's pathname...`
|
l.debug`Determining request's pathname...`
|
||||||
const pathname = url.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") {
|
if (url.pathname === "/favicon.ico") {
|
||||||
l.debug`Delegating handling to favicon handler...`
|
l.debug`Delegating handling to favicon handler...`
|
||||||
return await handleFavicon()
|
return await handleFavicon()
|
||||||
|
|
|
@ -22,7 +22,7 @@ export class DotinoVeloce {
|
||||||
this.stratz = stratz
|
this.stratz = stratz
|
||||||
|
|
||||||
this.federation = createFederation<ContextData>({
|
this.federation = createFederation<ContextData>({
|
||||||
kv: db.useAsKvStore(),
|
kv: db.useAsKvStore(),
|
||||||
})
|
})
|
||||||
|
|
||||||
this.federation
|
this.federation
|
||||||
|
@ -34,7 +34,7 @@ export class DotinoVeloce {
|
||||||
.setInboxListeners("/inbox/{identifier}", "/inbox")
|
.setInboxListeners("/inbox/{identifier}", "/inbox")
|
||||||
// Akkoma with Authorized Fetch requires this to be set
|
// Akkoma with Authorized Fetch requires this to be set
|
||||||
// https://p.junimo.party/#/junimo.party/s/AnFW6s3OURPMY04LKq?view=full
|
// 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))
|
.on(Follow, this.#followHandler.bind(this))
|
||||||
|
|
||||||
this.federation
|
this.federation
|
||||||
|
@ -43,7 +43,7 @@ export class DotinoVeloce {
|
||||||
// TODO: Setup a message queue
|
// TODO: Setup a message queue
|
||||||
}
|
}
|
||||||
|
|
||||||
async #nodeInfoHandler(ctx: Context<ContextData>): Promise<NodeInfo> {
|
async #nodeInfoHandler(_ctx: Context<ContextData>): Promise<NodeInfo> {
|
||||||
return {
|
return {
|
||||||
software: {
|
software: {
|
||||||
name: "dotino-veloce",
|
name: "dotino-veloce",
|
||||||
|
@ -282,6 +282,11 @@ export class DotinoVeloce {
|
||||||
return result
|
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> {
|
async #authorizationHandler(_ctx: Context<ContextData>, _handle: string, _signedKey: unknown, _signedKeyOwner: unknown): Promise<boolean> {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -322,5 +327,7 @@ export class DotinoVeloce {
|
||||||
l.debug`Attempting to determine target of the follow request...`
|
l.debug`Attempting to determine target of the follow request...`
|
||||||
const target = await follow.getTarget(ctx)
|
const target = await follow.getTarget(ctx)
|
||||||
l.debug`Target is: ${target}`
|
l.debug`Target is: ${target}`
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@ import { Database } from "../database/index.ts"
|
||||||
import { initLogging } from "../deno/logging.ts"
|
import { initLogging } from "../deno/logging.ts"
|
||||||
|
|
||||||
|
|
||||||
async function main() {
|
async function entryDbInit() {
|
||||||
await initLogging()
|
await initLogging()
|
||||||
const db = Database.fromEnv()
|
const db = Database.fromEnv()
|
||||||
await db.reinitializeDev()
|
await db.reinitializeDev()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
main()
|
entryDbInit()
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { DotinoVeloce } from "../dv/index.ts"
|
||||||
import { Database } from "../database/index.ts"
|
import { Database } from "../database/index.ts"
|
||||||
|
|
||||||
|
|
||||||
async function main() {
|
async function entryServer() {
|
||||||
await initLogging()
|
await initLogging()
|
||||||
const db = Database.fromEnv()
|
const db = Database.fromEnv()
|
||||||
const stratz = StratzAPI.fromEnv()
|
const stratz = StratzAPI.fromEnv()
|
||||||
|
@ -18,4 +18,4 @@ async function main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
main()
|
entryServer()
|
||||||
|
|
Loading…
Reference in a new issue