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.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
test(integrations): parse each inline script, not one greedy concatenation
Abdurrahman Fakhrul33c8f647fd65
diff --git a/app/integrations/route.test.ts b/app/integrations/route.test.tsindex da1c2b34..5dc39e28 100644--- a/app/integrations/route.test.ts+++ b/app/integrations/route.test.ts@@ -12,7 +12,10 @@ describe("friendly native Integrations page", () => {expect(response.headers.get("cache-control")).toContain("no-store");expect(html).toContain("INTEGRATIONS_CATALOG"); expect(html).toContain('"id":"supabase"');expect(html).toContain("How to get this credential / authorization"); expect(html).not.toContain("si-coder");- expect(() => new Function(html.match(/<script nonce="[^"]+">([\s\S]*)<\/script>/)![1])).not.toThrow();+ const scripts = [...html.matchAll(/<script nonce="[^"]+">([\s\S]*?)<\/script>/g)].map((m) => m[1]);+ expect(scripts.length).toBeGreaterThan(0);+ for (const [index, source] of scripts.entries())+ expect(() => new Function(source), `inline script ${index} must parse`).not.toThrow();});it("preserves the dedicated embed alias and keeps standalone framing denied", () => {expect(embedGET().headers.get("content-security-policy")).toContain("frame-ancestors 'self'");diff --git a/lib/infra/setup-capability.test.ts b/lib/infra/setup-capability.test.tsindex 26f4ced8..78224157 100644--- a/lib/infra/setup-capability.test.ts+++ b/lib/infra/setup-capability.test.ts@@ -78,8 +78,12 @@ describe("native integration setup capabilities", () => {it("standalone page contains no grant and its inline script parses", async () => {const { integrationSetupPage } = await import("./setup-page");const result = integrationSetupPage(); expect(result.csp).toContain("frame-ancestors 'none'");- const script = result.html.match(/<script nonce="[^"]+">([\s\S]+)<\/script>/)?.[1];- expect(script).toBeTruthy(); expect(() => new Function(script!)).not.toThrow();+ // Every inline block must parse. A greedy match would concatenate them into one string and+ // only pass while the page happened to have a single block.+ const scripts = [...result.html.matchAll(/<script nonce="[^"]+">([\s\S]*?)<\/script>/g)].map((m) => m[1]);+ expect(scripts.length).toBeGreaterThan(0);+ for (const [index, source] of scripts.entries())+ expect(() => new Function(source), `inline script ${index} must parse`).not.toThrow();expect(result.html).not.toContain(KEY); expect(result.html).not.toContain("si-coder");});});