Managed to load server configuration from WebUI

This commit is contained in:
2024-04-29 22:14:16 +02:00
parent 955067ad9c
commit 46648db093
15 changed files with 2159 additions and 13 deletions

View File

@ -0,0 +1,30 @@
import { APIClient } from "./ApiClient";
export interface ServerConfig {
authenticated: boolean;
disable_auth: boolean;
}
let config: ServerConfig | null = null;
export class ServerApi {
/**
* Get server configuration
*/
static async LoadConfig(): Promise<void> {
config = (
await APIClient.exec({
uri: "/server/config",
method: "GET",
})
).data;
}
/**
* Get cached configuration
*/
static get Config(): ServerConfig {
if (config === null) throw new Error("Missing configuration!");
return config;
}
}