2025-06-15 04:38:20 +02:00
|
|
|
import { config } from "@versia-server/config";
|
2025-06-15 23:50:34 +02:00
|
|
|
import { apiRoute } from "@versia-server/kit/api";
|
2025-03-29 03:30:06 +01:00
|
|
|
import { describeRoute } from "hono-openapi";
|
|
|
|
|
import { resolver } from "hono-openapi/zod";
|
|
|
|
|
import { z } from "zod";
|
2023-10-16 19:39:41 +02:00
|
|
|
|
2025-03-29 03:30:06 +01:00
|
|
|
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(),
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-11-19 14:41:12 +01:00
|
|
|
},
|
|
|
|
|
},
|
2025-03-29 03:30:06 +01:00
|
|
|
}),
|
|
|
|
|
(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(),
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
});
|
2024-09-16 15:29:09 +02:00
|
|
|
},
|
2025-03-29 03:30:06 +01:00
|
|
|
),
|
2024-08-19 20:06:38 +02:00
|
|
|
);
|