Some progress towards accepting and rejecting follows #3
2 changed files with 37 additions and 27 deletions
|
@ -1,15 +1,16 @@
|
||||||
// deno-lint-ignore-file require-await
|
// deno-lint-ignore-file require-await
|
||||||
import { createFederation, Person, Application, Image, PropertyValue, Organization, Federation, KvStore, Context, Actor, Follow, Endpoints, importSpki, importJwk, NodeInfo, Accept } from "@fedify/fedify"
|
import { createFederation, Person, Application, Image, PropertyValue, Organization, Federation, Context, Actor, Follow, Endpoints, importJwk, Accept } from "@fedify/fedify"
|
||||||
import { getLogger } from "https://jsr.io/@logtape/logtape/0.6.3/logtape/logger.ts"
|
import { getLogger } from "https://jsr.io/@logtape/logtape/0.6.3/logtape/logger.ts"
|
||||||
import { escapeHtml } from "@@x/escape"
|
import { escapeHtml } from "@@x/escape"
|
||||||
import { StratzAPI } from "../stratz/api.ts"
|
import { StratzAPI } from "../stratz/api.ts"
|
||||||
import { Database } from "../database/index.ts"
|
import { Database } from "../database/index.ts"
|
||||||
|
import { handleNodeInfo } from "./nodeinfo.ts"
|
||||||
|
|
||||||
|
|
||||||
const l = getLogger(["dotino-veloce", "dv", "index"])
|
const l = getLogger(["dotino-veloce", "dv", "index"])
|
||||||
|
|
||||||
|
|
||||||
type ContextData = undefined
|
export type ContextData = undefined
|
||||||
|
|
||||||
|
|
||||||
export class DotinoVeloce {
|
export class DotinoVeloce {
|
||||||
|
@ -39,31 +40,7 @@ export class DotinoVeloce {
|
||||||
.on(Follow, this.#followHandler.bind(this))
|
.on(Follow, this.#followHandler.bind(this))
|
||||||
|
|
||||||
this.federation
|
this.federation
|
||||||
.setNodeInfoDispatcher("/nodeinfo/2.1", this.#nodeInfoHandler.bind(this))
|
.setNodeInfoDispatcher("/nodeinfo/2.1", handleNodeInfo)
|
||||||
}
|
|
||||||
|
|
||||||
async #nodeInfoHandler(_ctx: Context<ContextData>): Promise<NodeInfo> {
|
|
||||||
return {
|
|
||||||
software: {
|
|
||||||
name: "dotino-veloce",
|
|
||||||
version: {
|
|
||||||
major: 0,
|
|
||||||
minor: 1,
|
|
||||||
patch: 0,
|
|
||||||
},
|
|
||||||
repository: new URL("https://forge.steffo.eu/steffo/dotino-veloce"),
|
|
||||||
},
|
|
||||||
protocols: ["activitypub"],
|
|
||||||
usage: {
|
|
||||||
users: {
|
|
||||||
total: 0,
|
|
||||||
activeHalfyear: 0,
|
|
||||||
activeMonth: 0,
|
|
||||||
},
|
|
||||||
localPosts: 0,
|
|
||||||
localComments: 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async #commonActorProperties(ctx: Context<ContextData>, handle: string): Promise<Partial<Actor>> {
|
async #commonActorProperties(ctx: Context<ContextData>, handle: string): Promise<Partial<Actor>> {
|
||||||
|
|
33
src/dv/nodeinfo.ts
Normal file
33
src/dv/nodeinfo.ts
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
import { Context, NodeInfo } from "@fedify/fedify"
|
||||||
|
import { ContextData } from "./index.ts"
|
||||||
|
import { getLogger } from "@logtape/logtape"
|
||||||
|
|
||||||
|
|
||||||
|
const l = getLogger(["dotino-veloce", "dv", "nodeinfo"])
|
||||||
|
|
||||||
|
|
||||||
|
export function handleNodeInfo(_ctx: Context<ContextData>): NodeInfo {
|
||||||
|
l.info`Creating nodeinfo for...`
|
||||||
|
|
||||||
|
return {
|
||||||
|
software: {
|
||||||
|
name: "dotino-veloce",
|
||||||
|
version: {
|
||||||
|
major: 0,
|
||||||
|
minor: 1,
|
||||||
|
patch: 0,
|
||||||
|
},
|
||||||
|
repository: new URL("https://forge.steffo.eu/steffo/dotino-veloce"),
|
||||||
|
},
|
||||||
|
protocols: ["activitypub"],
|
||||||
|
usage: {
|
||||||
|
users: {
|
||||||
|
total: 0,
|
||||||
|
activeHalfyear: 0,
|
||||||
|
activeMonth: 0,
|
||||||
|
},
|
||||||
|
localPosts: 0,
|
||||||
|
localComments: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue