theseus/auth-prompt-preload.js
Local Dev ab78535192 fix(theseus): prompt for HTTP authentication instead of showing the bare 401
Sites behind Basic/Digest auth (silentmode.st/guardian/admin) rendered the
server's 401 page because nothing listened for Electron's login event,
which cancels every challenge by default. A modal sign-in prompt now asks
for the credentials and answers the challenge; Cancel leaves the 401 page.
Concurrent challenges for the same host and realm share one prompt while it
is open, and a rejected answer re-prompts instead of replaying the same
credentials until Chromium gives up with ERR_TOO_MANY_RETRIES.

Also: THESEUS_NO_UPDATE_CHECK skips the release check, for throwaway dev
instances — the one-click install chip they show targets the real install.
2026-09-15 22:30:29 +02:00

8 lines
468 B
JavaScript

// Preload for the HTTP authentication prompt (auth-prompt.html). Main pushes
// the challenge via `auth-show`; the page answers once with `auth-answer`
// (credentials, or null for cancel). Nothing else is exposed.
const { contextBridge, ipcRenderer } = require("electron");
contextBridge.exposeInMainWorld("authPrompt", {
onShow: (cb) => ipcRenderer.on("auth-show", (_e, req) => cb(req)),
answer: (id, creds) => ipcRenderer.invoke("auth-answer", id, creds),
});