refactor(webui): use native link actions and remove website previews (#6391)

* refactor(webui): remove website previews and custom link menus

* docs(webui): focus guide on product-specific usage
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-22 16:34:54 +08:00
1 parent bc5c58d239
commit 08ca3b4525
42 files changed
+179 -1493

No files matched your search

-32
View File
@@ -1,32 +0,0 @@
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("\\")
|| Array.from(value).some((char) => char.charCodeAt(0) <= 32 || char.charCodeAt(0) === 127)) return null;
try {
const url = new URL(value);
return /^https?:$/.test(url.protocol) && !url.username && !url.password ? url : null;
} catch {
return null;
}
}
export function webPreviewRestriction(
url: URL,
pageUrl: URL,
native: boolean,
credentialless: boolean,
): "native" | "unsupported" | "sameOrigin" | "mixedContent" | null {
if (native) return "native";
if (!credentialless) return "unsupported";
if (url.origin === pageUrl.origin) return "sameOrigin";
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";
}