mirror of
https://github.com/spacebarchat/server.git
synced 2026-08-22 09:49:56 +00:00
schemas for wellknowns
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { route } from "@spacebar/api/middlewares";
|
||||
import { Config } from "@spacebar/util";
|
||||
import { SpacebarWellKnownClientResponse } from "@spacebar/schemas/api/spacebar/WellKnown";
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
@@ -27,21 +28,26 @@ router.get(
|
||||
route({
|
||||
spacebarOnly: true,
|
||||
authentication: "never",
|
||||
responses: {
|
||||
200: {
|
||||
body: "SpacebarWellKnownClientResponse",
|
||||
},
|
||||
},
|
||||
}),
|
||||
(req: Request, res: Response) => {
|
||||
res.json({
|
||||
api: {
|
||||
baseUrl: Config.get().api.endpointPublic?.split("/api/")[0],
|
||||
baseUrl: Config.get().api.endpointPublic!.split("/api/")[0],
|
||||
apiVersions: {
|
||||
default: Config.get().api.defaultVersion,
|
||||
active: Config.get().api.activeVersions,
|
||||
},
|
||||
},
|
||||
cdn: {
|
||||
baseUrl: Config.get().cdn.endpointPublic,
|
||||
baseUrl: Config.get().cdn.endpointPublic!,
|
||||
},
|
||||
gateway: {
|
||||
baseUrl: Config.get().gateway.endpointPublic,
|
||||
baseUrl: Config.get().gateway.endpointPublic!,
|
||||
encoding: ["etf", "json"],
|
||||
compression: ["zstd-stream", "zlib-stream", null],
|
||||
},
|
||||
@@ -49,9 +55,9 @@ router.get(
|
||||
Config.get().admin.endpointPublic === null
|
||||
? undefined
|
||||
: {
|
||||
baseUrl: Config.get().admin.endpointPublic,
|
||||
baseUrl: Config.get().admin.endpointPublic!,
|
||||
},
|
||||
});
|
||||
} satisfies SpacebarWellKnownClientResponse);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { route } from "@spacebar/api/middlewares";
|
||||
import { Config } from "@spacebar/util";
|
||||
import { SpacebarWellKnownLegacyResponse } from "@spacebar/schemas/api/spacebar/WellKnown";
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
@@ -28,11 +29,16 @@ router.get(
|
||||
spacebarOnly: true,
|
||||
authentication: "never",
|
||||
deprecated: true,
|
||||
responses: {
|
||||
200: {
|
||||
body: "SpacebarWellKnownLegacyResponse",
|
||||
},
|
||||
},
|
||||
}),
|
||||
(req: Request, res: Response) => {
|
||||
res.json({
|
||||
api: (Config.get().api.endpointPublic + "/api/").replace("//api/", "/api/"),
|
||||
});
|
||||
} satisfies SpacebarWellKnownLegacyResponse);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user