From c1533fe25c3adabfa05cfa6bf3f9426e1412dc94 Mon Sep 17 00:00:00 2001 From: Ken Date: Tue, 26 May 2026 20:19:39 +0000 Subject: [PATCH] feat: browser panel with noVNC iframe --- frontend/src/components/BrowserPanel.tsx | 49 +++++++ frontend/src/test/BrowserPanel.test.tsx | 170 +++++++++++++++++++++++ 2 files changed, 219 insertions(+) create mode 100644 frontend/src/components/BrowserPanel.tsx create mode 100644 frontend/src/test/BrowserPanel.test.tsx diff --git a/frontend/src/components/BrowserPanel.tsx b/frontend/src/components/BrowserPanel.tsx new file mode 100644 index 0000000..0fd1b63 --- /dev/null +++ b/frontend/src/components/BrowserPanel.tsx @@ -0,0 +1,49 @@ +// BrowserPanel renders a noVNC iframe for viewing the live Playwright browser. +// +// URL detection strategy: +// - Production (cloudflared): When hostname is "research.ampbox.io", use the +// dedicated noVNC HTTPS endpoint at vnc.ampbox.io (routed via cloudflared tunnel). +// - Local dev (Docker): For any other hostname (e.g. localhost, 192.168.x.x), +// connect directly to the noVNC container on port 6080 over plain HTTP. + +export interface BrowserPanelProps { + sessionId: string | null +} + +function getVncUrl(): string { + const hostname = window.location.hostname + if (hostname === 'research.ampbox.io') { + return 'https://vnc.ampbox.io/vnc.html?autoconnect=true&resize=remote&quality=6&compression=2' + } + return `http://${hostname}:6080/vnc.html?autoconnect=true&resize=remote&quality=6&compression=2` +} + +export function BrowserPanel({ sessionId }: BrowserPanelProps) { + if (!sessionId) { + return ( +
+ Select a session to view the browser +
+ ) + } + + return ( +