Decouple bundled UI from runtime API and add remote instance tooling (#1228)
Add a packaged-client runtime boundary so the shared UI can talk to local, desktop, remote, and VS Code runtimes through the right transport instead of assuming one same-origin web server. Centralize OpenChamber-owned API access behind RuntimeAPIs, runtimeFetch, and runtime URL helpers, while keeping official OpenCode traffic on the SDK path. Support runtime switching, remote host selection, desktop client credentials, and headless connection links for pairing packaged clients with remote OpenChamber servers. Harden the new auth model by moving long-lived client tokens out of browser URLs, introducing short-lived scoped URL tokens for browser-owned transports, restricting URL-token access to explicit readable/realtime routes, and making client-token management session-scoped or self-scoped as appropriate. Update browser-owned assets and preview proxy flows to work with the split runtime model, including authenticated project icons, preview token propagation, CSP-safe preview bridge injection, and preview proxy auth that survives short-lived URL-token expiry. Tighten Electron security boundaries for packaged clients by gating privileged preload state to trusted origins and requiring explicit confirmation before connect deep-links import or switch remote runtimes. Also refresh agent guidance and project skills so future runtime/API, auth, preview, UI, CLI, settings, locale, and drag-to-reorder work follows the new architecture.
This commit is contained in:
committed by
GitHub
parent
a4314c189b
commit
2031e3b4a8
@@ -23,6 +23,7 @@ Or install manually: `bun add -g @openchamber/web` (or npm, pnpm, yarn).
|
||||
```bash
|
||||
openchamber # Start on port 3000
|
||||
openchamber --port 8080 # Custom port
|
||||
openchamber --lan --port 3000 # Listen on LAN (0.0.0.0)
|
||||
openchamber --ui-password secret # Password-protect UI
|
||||
openchamber startup enable # Start at login as a native service
|
||||
OPENCHAMBER_UI_PASSWORD=secret openchamber startup enable # Save service password env
|
||||
@@ -36,6 +37,9 @@ openchamber tunnel start --provider cloudflare --mode quick --qr
|
||||
openchamber tunnel start --provider cloudflare --mode managed-local --config ~/.cloudflared/config.yml
|
||||
openchamber tunnel status --all # Show tunnel state across instances
|
||||
openchamber tunnel stop --port 3000 # Stop tunnel only (server stays running)
|
||||
openchamber connect-url --port 3000 # Add this server to OpenChamber Desktop
|
||||
openchamber connect-url --server http://host:3000 --qr
|
||||
openchamber connect-url --port 3000 --qr
|
||||
openchamber logs # Follow latest instance logs
|
||||
OPENCODE_PORT=4096 OPENCODE_SKIP_START=true openchamber # Connect to external OpenCode server
|
||||
OPENCODE_HOST=https://myhost:4096 OPENCODE_SKIP_START=true openchamber # Connect via custom host/HTTPS
|
||||
@@ -52,6 +56,40 @@ openchamber update # Update to latest version
|
||||
- Replacing or stopping a tunnel revokes existing connect links and invalidates remote tunnel sessions.
|
||||
- Connect links are one-time tokens; generating a new link revokes the previous unused link.
|
||||
|
||||
### Connect other OpenChamber apps
|
||||
|
||||
Use `connect-url` when a web/API server should be added to OpenChamber Desktop or another OpenChamber app. If no server is running on the selected port, OpenChamber starts one first.
|
||||
|
||||
```bash
|
||||
openchamber connect-url --port 3000
|
||||
openchamber connect-url --port 3000 --qr
|
||||
openchamber connect-url --port 3000 --json
|
||||
openchamber connect-url --port 3000 --name "Workstation"
|
||||
openchamber connect-url --port 3000 --lan --server http://workstation.local:3000 --qr
|
||||
```
|
||||
|
||||
### Headless/API-only server for Desktop
|
||||
|
||||
Use this on a remote machine when you want OpenChamber running as a web/API server, then connect to it from OpenChamber Desktop on another machine:
|
||||
|
||||
```bash
|
||||
openchamber connect-url --port 3000 --api-only --lan --server http://workstation.local:3000 --qr --ui-password your-password
|
||||
```
|
||||
|
||||
`--api-only` starts API routes without serving browser UI assets. `--lan` binds the server so other machines can reach it. `--server` is the address saved into the Desktop connection link. `--ui-password` protects browser access if UI routes are enabled elsewhere; the generated client token is what Desktop uses for API access.
|
||||
|
||||
This creates a remote client token and prints an `openchamber://connect?...` link. The link contains the server URL, token, label, and payload version. In OpenChamber Desktop, paste it in **Settings -> Remote Instances -> Direct Instances -> Import Link** to add that server as an Instance.
|
||||
|
||||
If the server was started with `--lan` or `--host 0.0.0.0`, `connect-url` automatically advertises a detected LAN IP instead of `127.0.0.1`. Use `--server <url>` when you want to advertise a specific DNS name, Tailscale address, reverse proxy URL, or HTTPS endpoint.
|
||||
|
||||
If you are exposing the server beyond localhost, start it with a password:
|
||||
|
||||
```bash
|
||||
openchamber serve --lan --port 3000 --ui-password your-password
|
||||
```
|
||||
|
||||
Generating a client token does not automatically password-protect the hosted browser UI. `--ui-password` protects browser access; the client token lets another OpenChamber app connect to this server.
|
||||
|
||||
<details>
|
||||
<summary>Connect to external OpenCode server</summary>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user