mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import { apiRoute } from "@/api";
|
|
import { describeRoute } from "hono-openapi";
|
|
import { resolver } from "hono-openapi/zod";
|
|
import { z } from "zod";
|
|
import { config } from "~/config.ts";
|
|
|
|
export default apiRoute((app) =>
|
|
app.get(
|
|
"/.well-known/nodeinfo",
|
|
describeRoute({
|
|
summary: "Well-known nodeinfo",
|
|
tags: ["Federation"],
|
|
responses: {
|
|
200: {
|
|
description: "Nodeinfo links",
|
|
content: {
|
|
"application/json": {
|
|
schema: resolver(
|
|
z.object({
|
|
links: z.array(
|
|
z.object({
|
|
rel: z.string(),
|
|
href: z.string(),
|
|
}),
|
|
),
|
|
}),
|
|
),
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}),
|
|
(context) => {
|
|
return context.json({
|
|
links: [
|
|
{
|
|
rel: "http://nodeinfo.diaspora.software/ns/schema/2.0",
|
|
href: new URL(
|
|
"/.well-known/nodeinfo/2.0",
|
|
config.http.base_url,
|
|
).toString(),
|
|
},
|
|
],
|
|
});
|
|
},
|
|
),
|
|
);
|