import createDebug from "debug"; import {ClientHub, hub_connect} from "./hub.ts"; import {ConfigServer, loadConfig} from "./config.ts"; import "./css/style.css"; import "./css/themes/catppuccin-mocha/colors.css"; let config = await loadConfig(); const logger = createDebug("main"); logger(`Hello, world! StarKingdoms ${APP_VERSION} (${COMMIT_HASH}) at your service`); if (window.localStorage.getItem("stk-packet-mode") === "debug") { document.getElementById("packet_log")!.classList.remove("log-hidden"); } else { document.getElementById("packet_log")!.remove(); } export interface GlobalData { client: ClientHub | null } export const global: GlobalData = { client: null } const version_string = `StarKingdoms Client ${APP_VERSION} (${COMMIT_HASH}) made with by the StarKingdoms team`; document.getElementById("footer")!.innerHTML = version_string; // Dropdown stuff const custom_select = document.querySelector(".fm-select")!; const custom_select_btn = document.querySelector(".fm-select-button")!; custom_select_btn.addEventListener("click", (e) => { e.preventDefault(); custom_select.classList.toggle("active"); custom_select_btn.setAttribute("aria-expanded", custom_select_btn.getAttribute("aria-expanded") === "true" ? "false" : "true"); }); const selected_value = document.querySelector(".fm-selected-value")!; // Populate the main page server selector let inverse_server_lookup: {[name: string]: string} = {}; const dropdown = document.getElementById("fm-select-dropdown")!; for (let server_id in config.servers) { let server: ConfigServer = config.servers[server_id]; if (server.isDevelopment && window.localStorage.getItem("stk-mode") !== "debug") { continue; } let html_text = `