mirror of
https://github.com/versia-pub/server.git
synced 2026-01-26 12:16:01 +01:00
Add Lysand well-known route
This commit is contained in:
parent
d5817e985d
commit
fcf952e1f3
|
|
@ -90,6 +90,7 @@ export const rawRoutes = {
|
|||
// .well-known queries are automatically re-routed to well-known
|
||||
"/well-known/webfinger": "./server/api/well-known/webfinger/index",
|
||||
"/well-known/host-meta": "./server/api/well-known/host-meta/index",
|
||||
"/well-known/lysand": "./server/api/well-known/lysand",
|
||||
"/[...404]": "./server/api/[...404]",
|
||||
} as Record<string, string>;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
import { apiRoute, applyConfig } from "@api";
|
||||
import { urlToContentFormat } from "@content_types";
|
||||
import { jsonResponse } from "@response";
|
||||
import type * as Lysand from "lysand-types";
|
||||
import pkg from "../../../package.json";
|
||||
|
||||
export const meta = applyConfig({
|
||||
allowedMethods: ["GET"],
|
||||
|
|
@ -20,30 +23,12 @@ export default apiRoute(async (req, matchedRoute, extraData) => {
|
|||
return jsonResponse({
|
||||
type: "ServerMetadata",
|
||||
name: config.instance.name,
|
||||
version: "0.0.1",
|
||||
version: pkg.version,
|
||||
description: config.instance.description,
|
||||
logo: config.instance.logo
|
||||
? [
|
||||
{
|
||||
content: config.instance.logo,
|
||||
content_type: `image/${
|
||||
config.instance.logo.split(".")[1]
|
||||
}`,
|
||||
},
|
||||
]
|
||||
: undefined,
|
||||
banner: config.instance.banner
|
||||
? [
|
||||
{
|
||||
content: config.instance.banner,
|
||||
content_type: `image/${
|
||||
config.instance.banner.split(".")[1]
|
||||
}`,
|
||||
},
|
||||
]
|
||||
: undefined,
|
||||
logo: urlToContentFormat(config.instance.logo) ?? undefined,
|
||||
banner: urlToContentFormat(config.instance.banner) ?? undefined,
|
||||
supported_extensions: ["org.lysand:custom_emojis"],
|
||||
website: "https://lysand.org",
|
||||
// TODO: Add admins, moderators field
|
||||
});
|
||||
} satisfies Lysand.ServerMetadata);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue