Wrap <App /> in a DesktopLaunchGate that runs only inside the Electron shell.
On first run it shows a chooser (Run Locally / Connect Remote). On "local"
it calls setDesktopMode("local") so main starts the embedded runtime, polls
shell:getState until localRuntime.state === "running", then reloads with
?serverBaseUrl=http://127.0.0.1:<port> so the dashboard's API calls route
to the embedded server (file:// origins can't resolve relative /api). On
"remote" it opens the existing connection manager. Replaces the dead-end
"can't reach backend" landing in the packaged desktop app.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { StrictMode } from "react";
|
|
import { createRoot } from "react-dom/client";
|
|
import { RootErrorBoundary } from "./components/ErrorBoundary";
|
|
import { DesktopLaunchGate } from "./components/DesktopLaunchGate";
|
|
import { App } from "./App";
|
|
import { installAuthFetch } from "./auth";
|
|
import { installVersionCheck } from "./versionCheck";
|
|
import { installSwUpdate } from "./swUpdate";
|
|
import { bootstrapShellHostContext } from "./shell-host";
|
|
import { registerBundledPluginViews } from "./plugins/registerBundledPluginViews";
|
|
import "./styles.css";
|
|
|
|
// Install the bearer-token fetch wrapper before React mounts so every API
|
|
// call (including ones fired synchronously during the first render) picks up
|
|
// the token that was either captured from `?token=` in the launch URL or
|
|
// stored from a previous session.
|
|
installAuthFetch();
|
|
installVersionCheck();
|
|
bootstrapShellHostContext();
|
|
registerBundledPluginViews();
|
|
|
|
createRoot(document.getElementById("root")!).render(
|
|
<StrictMode>
|
|
<RootErrorBoundary>
|
|
<DesktopLaunchGate>
|
|
<App />
|
|
</DesktopLaunchGate>
|
|
</RootErrorBoundary>
|
|
</StrictMode>,
|
|
);
|
|
|
|
installSwUpdate();
|