Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

fix(browser): settle Camoufox viewer auth before reload

Rahman66e56c765f72
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 8d0ecb4a..7d8b201b 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -15,6 +15,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Fixed**
+- `browser` settle Camoufox viewer auth before reload
- `browser` keep Camoufox viewer transport clean
- `plugin` bind ChatGPT app by stable app id only
- `cli` keep candidate command parser strict
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 6b668f66..50e98fd0 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,16 @@
+## 2026-09-19 — Settle the Camoufox viewer ticket exchange before reloading noVNC
+
+Production Browser QA showed the split-origin ticket exchange returning HTTP 204, setting the
+host-only viewer cookie, and opening the encrypted noVNC WebSocket, while browser tooling still
+reported the POST to `/__viewer_auth` as `net::ERR_ABORTED`. Increasing the reload delay from
+50 ms through 800 ms did not change that result. A controlled production experiment isolated the
+actual boundary: when the bootstrap explicitly consumes the completed 204 response before
+navigating, the aborted-request report disappears while noVNC remains connected and the existing
+HttpOnly/Secure/SameSite=Strict host-only cookie boundary is unchanged. The bootstrap now consumes
+the response and marks the bodyless auth request `keepalive` before removing the ticket from the
+fragment and reloading. Regression coverage locks the settle-before-navigation ordering; no ticket,
+password, cockpit cookie, or viewer asset access is broadened.
+
## 2026-09-19 — Memory v3 closes the learn → retrieve → expose → reuse loop
- Replaced terminal/A2A first-12k head truncation with a frozen stable-core + query-relevant JIT memory projection. Defaults are 6k core / 8k JIT characters and are configurable without changing the durable typed-memory ledger.
diff --git a/lib/camoufox/viewer-bootstrap-reload.test.ts b/lib/camoufox/viewer-bootstrap-reload.test.ts
index 1d82fe49..381120a2 100644
--- a/lib/camoufox/viewer-bootstrap-reload.test.ts
+++ b/lib/camoufox/viewer-bootstrap-reload.test.ts
@@ -18,6 +18,9 @@ it("forces a network reload after the viewer ticket exchange", async () => {
expect(response.status).toBe(200);
const script = await response.text();
expect(script).toContain("p.delete('viewer_ticket')");
+ expect(script).toContain("keepalive:true");
+ expect(script).toContain("await r.text()");
+ expect(script.indexOf("await r.text()")).toBeLessThan(script.indexOf("history.replaceState"));
expect(script).toContain("history.replaceState");
expect(script).toContain("p.toString()");
expect(script).toContain("setTimeout(()=>location.reload(),50)");
diff --git a/lib/camoufox/viewer-gate.ts b/lib/camoufox/viewer-gate.ts
index fbafac57..12b5cf0f 100644
--- a/lib/camoufox/viewer-gate.ts
+++ b/lib/camoufox/viewer-gate.ts
@@ -62,7 +62,8 @@ const BOOTSTRAP_JS = [
"const t=p.get('viewer_ticket');",
"if(!t){document.body.textContent='Viewer authorization required.';return;}",
"p.delete('viewer_ticket');",
- "const r=await fetch('/__viewer_auth',{method:'POST',headers:{authorization:'Bearer '+t},credentials:'include',cache:'no-store'});",
+ "const r=await fetch('/__viewer_auth',{method:'POST',headers:{authorization:'Bearer '+t},credentials:'include',cache:'no-store',keepalive:true});",
+ "await r.text();",
"if(!r.ok){document.body.textContent='Viewer authorization failed.';return;}",
"history.replaceState(null,'',location.pathname+location.search+(p.toString()?'#'+p.toString():''));",
"setTimeout(()=>location.reload(),50);",