Add an Electron desktop shell for the SPA
desktop/ serves the normal frontend build over a privileged app://j621 scheme, so localStorage, OPFS, Web Workers, WebCodecs and history routing behave exactly like Chrome. Development points at the Vite dev server; `npm run smoke` runs headless Electron and checks the bundled app. External links open in the system browser, and download navigations (?download=1 or media URLs) are rerouted through webContents.downloadURL, since preventing them cancels the download. The setup screen names the shell's origin when the connection test fails, and the deploy docs list app://j621 for CORS_ALLOWED_ORIGINS.
This commit is contained in:
@@ -41,11 +41,17 @@ async function testBackend(base: string): Promise<TestResult> {
|
||||
text: `The backend answered HTTP ${response.status}.`,
|
||||
};
|
||||
} catch {
|
||||
// The desktop shell is a different origin from the backend, and that is
|
||||
// the usual reason the first connection test fails there.
|
||||
const desktopHint = window.j621Desktop
|
||||
? ` The desktop app's origin is ${window.j621Desktop.origin} — allow it in CORS_ALLOWED_ORIGINS on the backend.`
|
||||
: "";
|
||||
return {
|
||||
ok: false,
|
||||
text:
|
||||
"Could not reach the backend. Check the URL, and if it lives on " +
|
||||
"another domain add this site to CORS_ALLOWED_ORIGINS there.",
|
||||
"another domain add this site to CORS_ALLOWED_ORIGINS there." +
|
||||
desktopHint,
|
||||
};
|
||||
} finally {
|
||||
window.clearTimeout(timeout);
|
||||
|
||||
Reference in New Issue
Block a user