2024-12-30 20:18:48 +01:00
|
|
|
import { apiRoute } from "@/api";
|
2024-11-19 14:41:12 +01:00
|
|
|
import { createRoute, z } from "@hono/zod-openapi";
|
2024-05-29 02:59:49 +02:00
|
|
|
import { config } from "~/packages/config-manager";
|
2023-10-16 19:39:41 +02:00
|
|
|
|
2024-09-16 15:29:09 +02:00
|
|
|
const route = createRoute({
|
|
|
|
|
method: "get",
|
|
|
|
|
path: "/.well-known/nodeinfo",
|
|
|
|
|
summary: "Well-known nodeinfo",
|
|
|
|
|
responses: {
|
2024-11-19 14:41:12 +01:00
|
|
|
200: {
|
|
|
|
|
description: "Nodeinfo links",
|
|
|
|
|
content: {
|
|
|
|
|
"application/json": {
|
|
|
|
|
schema: z.object({
|
|
|
|
|
links: z.array(
|
|
|
|
|
z.object({
|
|
|
|
|
rel: z.string(),
|
|
|
|
|
href: z.string(),
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-09-16 15:29:09 +02:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2024-08-19 20:06:38 +02:00
|
|
|
export default apiRoute((app) =>
|
2024-09-16 15:29:09 +02:00
|
|
|
app.openapi(route, (context) => {
|
2024-11-19 14:41:12 +01:00
|
|
|
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(),
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
});
|
2024-08-19 20:06:38 +02:00
|
|
|
}),
|
|
|
|
|
);
|