From 6abc765e22d9cc3d903c0ad3d1e2a6e7afe444f5 Mon Sep 17 00:00:00 2001 From: saphid <4596216+saphid@users.noreply.github.com> Date: Wed, 30 Sep 2026 22:51:24 +1000 Subject: [PATCH] App: Try Again also works when the server is up but its page failed to load The button was accepted only while no server was known. If the server answered and the page then failed to load, the error page showed with the server still known, and the button did nothing. It's now accepted from the error page itself (the window's only data: page). Co-Authored-By: Claude Opus 5.5 (1M context) --- app/main.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/main.js b/app/main.js index 3f9dcbc..7d77675 100644 --- a/app/main.js +++ b/app/main.js @@ -272,8 +272,11 @@ function fromUi(e) { } catch { return false; } } -// The error page's Try Again button (there is no server page while it shows). -ipcMain.handle("server:restart", (e) => { if (win && e.sender === win.webContents && !url) restartServer(); }); +// The error page's Try Again button. The error page is the only data: page the window +// shows (`url` can still be set then: the server answered but the page failed to load). +ipcMain.handle("server:restart", (e) => { + if (win && e.sender === win.webContents && e.senderFrame && e.senderFrame.url.startsWith("data:")) restartServer(); +}); ipcMain.handle("clipboard:read", (e) => fromUi(e) ? clipboard.readText() : ""); // A PNG or JPEG (a screenshot) onto the clipboard as an image. ipcMain.handle("clipboard:writeImage", (e, bytes) => {