mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 13:59:16 +01:00
refactor(api): 🚚 Use api/ for API routes instead of server/api/
This commit is contained in:
parent
dfc0bf4595
commit
3c1b330d4b
143 changed files with 5 additions and 5 deletions
31
api/well-known/nodeinfo/2.0/index.ts
Normal file
31
api/well-known/nodeinfo/2.0/index.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { apiRoute, applyConfig } from "@/api";
|
||||
import manifest from "~/package.json";
|
||||
|
||||
export const meta = applyConfig({
|
||||
allowedMethods: ["GET"],
|
||||
auth: {
|
||||
required: false,
|
||||
},
|
||||
ratelimits: {
|
||||
duration: 60,
|
||||
max: 500,
|
||||
},
|
||||
route: "/.well-known/nodeinfo/2.0",
|
||||
});
|
||||
|
||||
export default apiRoute((app) =>
|
||||
app.on(meta.allowedMethods, meta.route, (context) => {
|
||||
return context.json({
|
||||
version: "2.0",
|
||||
software: { name: "versia-server", version: manifest.version },
|
||||
protocols: ["versia"],
|
||||
services: { outbound: [], inbound: [] },
|
||||
usage: {
|
||||
users: { total: 0, activeMonth: 0, activeHalfyear: 0 },
|
||||
localPosts: 0,
|
||||
},
|
||||
openRegistrations: false,
|
||||
metadata: {},
|
||||
});
|
||||
}),
|
||||
);
|
||||
24
api/well-known/nodeinfo/index.ts
Normal file
24
api/well-known/nodeinfo/index.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { apiRoute, applyConfig } from "@/api";
|
||||
import { redirect } from "@/response";
|
||||
import { config } from "~/packages/config-manager";
|
||||
|
||||
export const meta = applyConfig({
|
||||
allowedMethods: ["GET"],
|
||||
auth: {
|
||||
required: false,
|
||||
},
|
||||
ratelimits: {
|
||||
duration: 60,
|
||||
max: 60,
|
||||
},
|
||||
route: "/.well-known/nodeinfo",
|
||||
});
|
||||
|
||||
export default apiRoute((app) =>
|
||||
app.on(meta.allowedMethods, meta.route, () => {
|
||||
return redirect(
|
||||
new URL("/.well-known/nodeinfo/2.0", config.http.base_url),
|
||||
301,
|
||||
);
|
||||
}),
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue