mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { apiRoute, applyConfig } from "@/api";
|
|
import { urlToContentFormat } from "@/content_types";
|
|
import type { InstanceMetadata } from "@versia/federation/types";
|
|
import pkg from "~/package.json";
|
|
import { config } from "~/packages/config-manager";
|
|
|
|
export const meta = applyConfig({
|
|
allowedMethods: ["GET"],
|
|
auth: {
|
|
required: false,
|
|
},
|
|
ratelimits: {
|
|
duration: 60,
|
|
max: 60,
|
|
},
|
|
route: "/.well-known/versia",
|
|
});
|
|
|
|
export default apiRoute((app) =>
|
|
app.on(meta.allowedMethods, meta.route, (context) => {
|
|
return context.json({
|
|
type: "InstanceMetadata",
|
|
compatibility: {
|
|
extensions: ["pub.versia:custom_emojis"],
|
|
versions: ["0.4.0"],
|
|
},
|
|
host: new URL(config.http.base_url).host,
|
|
name: config.instance.name,
|
|
description: config.instance.description,
|
|
public_key: {
|
|
key: config.instance.keys.public,
|
|
algorithm: "ed25519",
|
|
},
|
|
software: {
|
|
name: "Versia Server",
|
|
version: pkg.version,
|
|
},
|
|
banner: urlToContentFormat(config.instance.banner),
|
|
logo: urlToContentFormat(config.instance.logo),
|
|
created_at: "2021-10-01T00:00:00Z",
|
|
} satisfies InstanceMetadata);
|
|
}),
|
|
);
|