2024-08-19 20:06:38 +02:00
|
|
|
import { apiRoute, applyConfig } from "@/api";
|
2024-09-16 15:29:09 +02:00
|
|
|
import { createRoute } 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
|
|
|
|
|
|
|
|
export const meta = applyConfig({
|
2024-04-07 07:30:49 +02:00
|
|
|
allowedMethods: ["GET"],
|
|
|
|
|
auth: {
|
|
|
|
|
required: false,
|
|
|
|
|
},
|
|
|
|
|
ratelimits: {
|
|
|
|
|
duration: 60,
|
|
|
|
|
max: 60,
|
|
|
|
|
},
|
|
|
|
|
route: "/.well-known/nodeinfo",
|
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: {
|
|
|
|
|
301: {
|
|
|
|
|
description: "Redirect to 2.0 Nodeinfo",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
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-08-28 17:01:56 +02:00
|
|
|
return context.redirect(
|
|
|
|
|
new URL(
|
|
|
|
|
"/.well-known/nodeinfo/2.0",
|
|
|
|
|
config.http.base_url,
|
|
|
|
|
).toString(),
|
2024-05-06 09:16:33 +02:00
|
|
|
301,
|
|
|
|
|
);
|
2024-08-19 20:06:38 +02:00
|
|
|
}),
|
|
|
|
|
);
|