From c3e9ee0031404615cb039dc2d6bb288e5da6f670 Mon Sep 17 00:00:00 2001 From: davidseve Date: Tue, 8 Sep 2026 16:47:25 +0200 Subject: [PATCH 1/2] fix: skip proxy connections on public hosts (GitHub Pages) Prevents Chrome 'access local network' popup when the demo runs on github.io by skipping proxy health checks and observability panel init when hostname is not localhost. Co-authored-by: Cursor --- docs/demo/v1/observability-panel.js | 6 ++++++ docs/demo/v5/script-runner.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/docs/demo/v1/observability-panel.js b/docs/demo/v1/observability-panel.js index 5831a75..ba9415e 100644 --- a/docs/demo/v1/observability-panel.js +++ b/docs/demo/v1/observability-panel.js @@ -88,6 +88,11 @@ async function fetchJson(url, options = {}) { return data; } +function isLocalHost() { + const h = globalThis.location?.hostname ?? ""; + return h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0" || h === ""; +} + export function initObservabilityPanel({ root, mount, @@ -98,6 +103,7 @@ export function initObservabilityPanel({ /** Start with body collapsed (v2/v3 compact companions). */ defaultCollapsed = false, } = {}) { + if (!isLocalHost()) return null; const host = mount ?? root?.querySelector("[data-nr-observability]"); if (!host) return null; diff --git a/docs/demo/v5/script-runner.js b/docs/demo/v5/script-runner.js index 7c8f0f2..b8e67b7 100644 --- a/docs/demo/v5/script-runner.js +++ b/docs/demo/v5/script-runner.js @@ -518,7 +518,13 @@ function isRunnerStep(stepId, skipSteps) { return !skipSteps.has(stepId); } +function isLocalHost() { + const h = globalThis.location?.hostname ?? ""; + return h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0" || h === ""; +} + async function checkProxyHealth(proxyUrl) { + if (!isLocalHost()) return "offline"; try { const health = await fetchJson(`${proxyUrl}/api/health`, { signal: AbortSignal.timeout(8_000), From de564a873aeb2ffad648155a94541ae0f8fe953d Mon Sep 17 00:00:00 2001 From: davidseve Date: Tue, 8 Sep 2026 16:51:02 +0200 Subject: [PATCH 2/2] fix(test): update D-before assertion for GW path Co-authored-by: Cursor --- tests/demo-scenario-consistency.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/demo-scenario-consistency.spec.ts b/tests/demo-scenario-consistency.spec.ts index 8add420..1fb2dac 100644 --- a/tests/demo-scenario-consistency.spec.ts +++ b/tests/demo-scenario-consistency.spec.ts @@ -206,7 +206,7 @@ test.describe('demo scenario consistency', () => { expect(stepDBefore.yamlPanel?.title).toContain('direct MaaS'); const snippet = stepDBefore.yamlPanel?.snippet ?? ''; expect(snippet).toContain('maas-direct'); - expect(snippet).toContain('inference.local → MaaS'); + expect(snippet).toContain('inference.local → GW → MaaS'); expect(snippet).not.toContain('maas-guardrailed'); expect(stepDBefore.yamlPanel?.defaultOpen).toBe(false); });