diff --git a/src/app/(app)/webview/page.tsx b/src/app/(app)/webview/page.tsx index 86ae80d..d6e4711 100644 --- a/src/app/(app)/webview/page.tsx +++ b/src/app/(app)/webview/page.tsx @@ -18,10 +18,65 @@ export default async function WebViewPage({ searchParams }: Props) { const { src } = await searchParams; const url = src && ALLOWED[src]; + // Probe the target so the user can tell at a glance whether the + // upstream is up. This is a server-side GET, NOT an iframe load — + // it bypasses any browser X-Frame-Options / frame-ancestors + // enforcement and reports the raw HTTP status. Used to render the + // status badge in the header. + let probe: { ok: boolean; status: number | null; error?: string } | null = + null; + if (url) { + try { + const res = await fetch(url, { + method: "HEAD", + // Don't follow redirects — we want to see the raw response. + redirect: "manual", + signal: AbortSignal.timeout(5000), + headers: { "User-Agent": "WFDASH-WebView/1.0" }, + }); + probe = { ok: res.ok || res.status === 302, status: res.status }; + } catch (err) { + probe = { + ok: false, + status: null, + error: err instanceof Error ? err.message : "fetch failed", + }; + } + } + return (
-
+
External view{src ? `: ${src}` : ""} + + {probe && ( + + + {probe.ok + ? `up${probe.status ? ` (${probe.status})` : ""}` + : probe.status + ? `HTTP ${probe.status}` + : "unreachable"} + + )} + {url && (
{url ? ( -