1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-24 14:31:44 +01:00
Files
dozzle/assets/stores/config.ts

47 lines
1.0 KiB
TypeScript

import { type Settings } from "@/stores/settings";
import { Host } from "@/stores/hosts";
const text = document.querySelector("script#config__json")?.textContent || "{}";
export interface Config {
version: string;
base: string;
maxLogs: number;
hostname: string;
hosts: Host[];
authProvider: "simple" | "none" | "forward-proxy";
logoutUrl?: string;
enableActions: boolean;
enableShell: boolean;
enableDownload: boolean;
disableAvatars: boolean;
releaseCheckMode: "automatic" | "manual";
user?: {
username: string;
email: string;
name: string;
};
profile?: Profile;
}
export interface Profile {
settings?: Settings;
pinned?: Set<string>;
visibleKeys?: Map<string, Map<string[], boolean>>;
releaseSeen?: string;
collapsedGroups?: Set<string>;
}
const pageConfig = JSON.parse(text);
const config: Config = {
maxLogs: 400,
version: "v0.0.0",
hosts: [],
...pageConfig,
};
export default Object.freeze(config);
export const withBase = (path: string) => `${config.base}${path}`;