Changed Default GUI Mode to Electron

This commit is contained in:
2026-05-04 00:54:39 +02:00
parent cd3d9043fe
commit a593cf6ad0
5 changed files with 104 additions and 19 deletions

View File

@@ -37,22 +37,29 @@ function startBackend() {
let stderr = "";
const rl = readline.createInterface({ input: backendProcess.stdout });
// Give the backend more time to start and report the URL (20s)
const timeout = setTimeout(() => {
reject(new Error("Backend did not report a GUI URL."));
}, 8000);
// include any captured stderr to aid debugging
const detail = stderr ? ("\nBackend stderr:\n" + stderr) : "";
reject(new Error("Backend did not report a GUI URL." + detail));
}, 20000);
rl.on("line", (line) => {
console.log("backend stdout:", line);
const match = line.match(/LazyUpdateManager GUI:\s+(http:\/\/127\.0\.0\.1:\d+)/);
if (!match) {
return;
}
clearTimeout(timeout);
console.log("backend reported GUI URL:", match[1]);
resolve(match[1]);
});
backendProcess.stderr.on("data", (chunk) => {
stderr += chunk.toString();
const s = chunk.toString();
stderr += s;
console.error("backend stderr:", s);
});
backendProcess.on("error", (error) => {
@@ -71,7 +78,13 @@ function startBackend() {
}
async function createWindow() {
const url = await startBackend();
// If LAZY_BACKEND_URL is set, use it (helps debugging a separately started backend)
let url = process.env.LAZY_BACKEND_URL || null;
if (!url) {
url = await startBackend();
} else {
console.log('Using LAZY_BACKEND_URL:', url);
}
mainWindow = new BrowserWindow({
width: 1180,
@@ -109,12 +122,8 @@ app.whenReady().then(async () => {
try {
await createWindow();
} catch (error) {
await dialog.showMessageBox({
type: "error",
title: "LazyUpdateManager",
message: "Die Desktop-App konnte nicht gestartet werden.",
detail: error.message,
});
// Avoid noisy GUI popups when the backend fails. Log the error and quit.
console.error('Desktop app startup failed:', error && error.message ? error.message : error);
app.quit();
}
});