fix: treat loading as nodecg dashboard route (#9)

This commit is contained in:
Pandipipas
2026-02-10 18:16:59 +01:00
committed by GitHub
parent 28b9312d4f
commit 9286a701d4
2 changed files with 8 additions and 13 deletions
+7 -12
View File
@@ -16,9 +16,8 @@ const NODE_BINARY = process.env.NODECG_NODE_BINARY ?? "node";
const isDev = !app.isPackaged;
const rootPath = isDev ? path.resolve(__dirname, "../..") : process.resourcesPath;
const nodecgPath = path.resolve(rootPath, "lib", "nodecg");
const loadingPath = path.join(rootPath, "lib", "nodecg", "bundles", DEFAULT_BUNDLE_NAME, DEFAULT_LOADING_ROUTE);
const dashboardUrl = `http://localhost:${DEFAULT_NODECG_PORT}/bundles/${DEFAULT_BUNDLE_NAME}/${DEFAULT_DASHBOARD_ROUTE}`;
const loadingUrl = `http://localhost:${DEFAULT_NODECG_PORT}/bundles/${DEFAULT_BUNDLE_NAME}/${DEFAULT_LOADING_ROUTE}`;
const baseUrl = `http://127.0.0.1:${DEFAULT_NODECG_PORT}`;
let mainWindow: BrowserWindow | null = null;
@@ -127,15 +126,6 @@ function validateNodeCGInstall(): void {
);
}
if (!fs.existsSync(loadingPath)) {
throw new Error(
[
"No se encontró el loading del dashboard dentro del bundle.",
`Ruta esperada: ${loadingPath}`,
"Ajusta SCOREKO_LOADING_ROUTE o verifica que exista dashboard/loading.html en el bundle.",
].join("\n"),
);
}
}
function enrichNodeCGFailureMessage(baseMessage: string): string {
@@ -245,7 +235,6 @@ async function launch(): Promise<void> {
mainWindow = createMainWindow();
loadingWindow = createLoadingWindow();
await loadingWindow.loadFile(loadingPath);
loadingWindow.show();
lastNodeCGOutput = "";
@@ -254,6 +243,12 @@ async function launch(): Promise<void> {
await sleep(Math.max(0, LOAD_DELAY_MS));
await waitForNodeCGReady(Date.now());
try {
await loadingWindow.loadURL(loadingUrl);
} catch (error) {
log("No se pudo cargar la ruta de loading del bundle", loadingUrl, error);
}
if (!mainWindow) {
return;
}