Adding support for custom logos

The admin can now set custom logos for the login scene and for the loading screen.
This commit is contained in:
David Négrier
2022-03-15 15:50:25 +01:00
parent 79db6c8f3b
commit 53b184e82b
6 changed files with 48 additions and 13 deletions
+8
View File
@@ -88,6 +88,14 @@ export class MapController extends BaseHttpController {
* type: boolean|undefined
* description: Whether the "report" feature is enabled or not on this room
* example: true
* loadingLogo:
* type: string
* description: The URL of the image to be used on the loading page
* example: https://example.com/logo.png
* loginSceneLogo:
* type: string
* description: The URL of the image to be used on the LoginScene
* example: https://example.com/logo_login.png
*
*/
this.app.get("/map", (req, res) => {
+9 -3
View File
@@ -1,7 +1,7 @@
import { ADMIN_API_TOKEN, ADMIN_API_URL, ADMIN_URL, OPID_PROFILE_SCREEN_PROVIDER } from "../Enum/EnvironmentVariable";
import Axios, { AxiosResponse } from "axios";
import { MapDetailsData } from "../Messages/JsonMessages/MapDetailsData";
import { RoomRedirect } from "../Messages/JsonMessages/RoomRedirect";
import { isMapDetailsData, MapDetailsData } from "../Messages/JsonMessages/MapDetailsData";
import { isRoomRedirect, RoomRedirect } from "../Messages/JsonMessages/RoomRedirect";
import { AdminApiData, isAdminApiData } from "../Messages/JsonMessages/AdminApiData";
import * as tg from "generic-type-guard";
import { isNumber } from "generic-type-guard";
@@ -46,10 +46,16 @@ class AdminApi {
userId,
};
const res = await Axios.get(ADMIN_API_URL + "/api/map", {
const res = await Axios.get<unknown, AxiosResponse<unknown>>(ADMIN_API_URL + "/api/map", {
headers: { Authorization: `${ADMIN_API_TOKEN}` },
params,
});
if (!isMapDetailsData(res.data) && !isRoomRedirect(res.data)) {
throw new Error(
"Invalid answer received from the admin for the /api/map endpoint. Received: " +
JSON.stringify(res.data)
);
}
return res.data;
}