fix(desktop): Workspace HTML previews (render view and new window) (#189)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Yaowei Zheng
2026-08-04 18:10:46 +08:00
committed by GitHub
parent d312d368b8
commit e015d9e591
7 changed files with 108 additions and 4 deletions
@@ -189,6 +189,12 @@ export function resolvePreviewTarget(
const counterpart = loopbackCounterpart(requestHost);
if (!counterpart) return null;
if (!loopbackHostRoles(serverBind.host)) return null;
// Port 0 means "the listener has not reported its actual port yet" (PORT=0 picks an
// ephemeral one; index.ts writes it back once bound). Emitting `:0` would produce a URL
// no browser will load — Chromium rejects it outright with ERR_UNSAFE_PORT — so degrade
// to "no isolated preview" instead, which the UI already handles by falling back to the
// sandboxed same-origin preview.
if (serverBind.port === 0) return null;
let protocol: string;
try {