fix(webui): gate website preview actions by browser capability

This commit is contained in:
Xubin Ren committed 2026-10-04 10:26:47 +08:00
1 parent 4b4b5cfa9f
commit bcd0423ce3
7 files changed
+68 -10

No files matched your search

+8
View File
@@ -1,3 +1,5 @@
import { isNativeRuntime } from "@/lib/runtime";
/** Only explicit web URLs belong in the web-link menu; file/session links have other owners. */
export function parseWebLink(value: string): URL | null {
if (value.length > 8192 || value.includes("\\")
@@ -22,3 +24,9 @@ export function webPreviewRestriction(
if (pageUrl.protocol === "https:" && url.protocol === "http:") return "mixedContent";
return null;
}
/** Menus and restored preview tabs must agree on the current browser's boundary. */
export function currentWebPreviewRestriction(url: URL | null) {
return url ? webPreviewRestriction(url, new URL(window.location.href), isNativeRuntime(),
"credentialless" in HTMLIFrameElement.prototype) : "invalid";
}