schemas for gif/version

This commit is contained in:
Rory&
2026-07-31 18:20:14 +02:00
parent fe17f5d155
commit 4cf0eadf7f
6 changed files with 60 additions and 2 deletions
Binary file not shown.
Binary file not shown.
@@ -19,6 +19,7 @@
import { Router, Response, Request } from "express";
import { route } from "@spacebar/api/middlewares";
import { GifProviderManager } from "@spacebar/integrations/gifs";
import { GifIntegrationsResponse } from "@spacebar/schemas/api/spacebar/Integrations";
const router = Router({ mergeParams: true });
@@ -27,9 +28,14 @@ router.get(
route({
spacebarOnly: true,
authentication: "never",
responses: {
200: {
body: "GifIntegrationsResponse",
},
},
}),
(req: Request, res: Response) => {
res.json({ providers: GifProviderManager.getProviders() });
res.json({ providers: GifProviderManager.getProviders() } satisfies GifIntegrationsResponse);
},
);
@@ -19,6 +19,7 @@
import { Router, Response, Request } from "express";
import { route } from "@spacebar/api/middlewares";
import { getRevInfoOrFail } from "@spacebar/util";
import { SpacebarVersionResponse } from "@spacebar/schemas/api/spacebar/Version";
const router = Router({ mergeParams: true });
@@ -27,12 +28,17 @@ router.get(
route({
spacebarOnly: true,
authentication: "never",
responses: {
200: {
body: "SpacebarVersionResponse",
},
},
}),
(req: Request, res: Response) => {
res.json({
implementation: "spacebar-server-ts",
version: getRevInfoOrFail(),
});
} satisfies SpacebarVersionResponse);
},
);
+21
View File
@@ -0,0 +1,21 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2026 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export interface GifIntegrationsResponse {
providers: { [provider: string]: { available: boolean } };
}
+25
View File
@@ -0,0 +1,25 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2026 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export interface SpacebarVersionResponse {
implementation: string;
version: {
rev: string | null;
lastModified: number;
};
}