mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-26 15:16:27 +01:00
32 lines
770 B
TypeScript
32 lines
770 B
TypeScript
const text = document.querySelector("script#config__json")?.textContent || "{}";
|
|
|
|
interface Config {
|
|
version: string;
|
|
base: string;
|
|
authorizationNeeded: boolean | "false" | "true";
|
|
secured: boolean | "false" | "true";
|
|
maxLogs: number;
|
|
hostname: string;
|
|
}
|
|
|
|
const pageConfig = JSON.parse(text);
|
|
|
|
const config: Config = {
|
|
maxLogs: 600,
|
|
...pageConfig,
|
|
};
|
|
|
|
if (config.version == "{{ .Version }}") {
|
|
config.version = "master";
|
|
config.base = "";
|
|
config.authorizationNeeded = false;
|
|
config.secured = false;
|
|
config.hostname = "localhost";
|
|
} else {
|
|
config.version = config.version.replace(/^v/, "");
|
|
config.authorizationNeeded = config.authorizationNeeded === "true";
|
|
config.secured = config.secured === "true";
|
|
}
|
|
|
|
export default config as Config;
|