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.

test(browser): keep viewer reload regression within architecture ratchet

Rahman29168f981c2a
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 67767840..fad76a8c 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -13,6 +13,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Fixed**
+- `browser` reload viewer after ticket exchange
- `mcp` harden native UI and plugin bindings
- `ai` separate provider connect from selection
- `security` bind Convex snapshot path identity
@@ -30,6 +31,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Tests**
+- `browser` keep viewer reload regression within architecture ratchet
- `security` keep snapshot regression descriptor-only
## 2026-09-18
diff --git a/lib/camoufox/viewer-bootstrap-reload.test.ts b/lib/camoufox/viewer-bootstrap-reload.test.ts
new file mode 100644
index 00000000..ee15195a
--- /dev/null
+++ b/lib/camoufox/viewer-bootstrap-reload.test.ts
@@ -0,0 +1,25 @@
+import { afterEach, expect, it, vi } from "vitest";
+import { NextRequest } from "next/server";
+
+afterEach(() => vi.unstubAllEnvs());
+
+it("forces a network reload after the viewer ticket exchange", async () => {
+ vi.resetModules();
+ vi.stubEnv("NEXT_PUBLIC_MANAGED_APP_HOST_TEMPLATE", "{id}.mso.example.com");
+ vi.stubEnv("OS_PUBLIC_ORIGIN", "https://mso.example.com");
+ vi.stubEnv("OS_SESSION_COOKIE_DOMAIN", "mso.example.com");
+ vi.stubEnv("CAMOUFOX_NOVNC_URL", "http://127.0.0.1:6080");
+ vi.stubEnv("CAMOUFOX_VIEWER_ORIGIN", "https://camoufox-mso.example.com");
+ const proxy = (await import("../../proxy")).proxy;
+ const response = await proxy(new NextRequest(
+ "https://camoufox-mso.example.com/__viewer_bootstrap.js",
+ { headers: { host: "camoufox-mso.example.com" } },
+ ));
+ expect(response.status).toBe(200);
+ const script = await response.text();
+ expect(script).toContain("p.delete('viewer_ticket')");
+ expect(script).toContain("history.replaceState");
+ expect(script).toContain("p.toString()");
+ expect(script).toContain("location.reload()");
+ expect(script).not.toContain("location.replace(");
+});
diff --git a/lib/camoufox/viewer-gate.test.ts b/lib/camoufox/viewer-gate.test.ts
index 862030d2..5c9086da 100644
--- a/lib/camoufox/viewer-gate.test.ts
+++ b/lib/camoufox/viewer-gate.test.ts
@@ -97,18 +97,6 @@ describe("the Camoufox split-origin VNC bridge", () => {
expect(asset.headers.get("cache-control")).toBe("no-store");
});
- it("forces a network reload after the ticket exchange instead of a hash-only navigation", async () => {
- const proxy = await load();
- const response = await proxy(req(VIEWER_HOST, "/__viewer_bootstrap.js"));
- expect(response.status).toBe(200);
- const script = await response.text();
- expect(script).toContain("p.delete('viewer_ticket')");
- expect(script).toContain("history.replaceState");
- expect(script).toContain("p.toString()");
- expect(script).toContain("location.reload()");
- expect(script).not.toContain("location.replace(");
- });
-
it("does not accept the cockpit session cookie on the sibling viewer host", async () => {
const proxy = await load();
const page = await proxy(req(