fix(webui): gate website preview actions by browser capability
This commit is contained in:
1 parent
4b4b5cfa9f
commit
bcd0423ce3
7 files changed
+68
-10
No files matched your search
@@ -4,8 +4,7 @@ import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { isLoopbackHost } from "@/lib/network";
|
||||
import { isNativeRuntime } from "@/lib/runtime";
|
||||
import { parseWebLink, webPreviewRestriction } from "@/lib/web-preview";
|
||||
import { currentWebPreviewRestriction, parseWebLink } from "@/lib/web-preview";
|
||||
|
||||
interface WebPreviewPanelProps {
|
||||
url: string;
|
||||
@@ -15,8 +14,7 @@ export function WebPreviewPanel({ url: value }: WebPreviewPanelProps) {
|
||||
const { t } = useTranslation();
|
||||
const [revision, setRevision] = useState(0);
|
||||
const url = parseWebLink(value);
|
||||
const restriction = url ? webPreviewRestriction(url, new URL(window.location.href), isNativeRuntime(),
|
||||
"credentialless" in HTMLIFrameElement.prototype) : "invalid";
|
||||
const restriction = currentWebPreviewRestriction(url);
|
||||
const buttonClass = "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
||||
return (
|
||||
<section aria-label={t("webPreview.title")} data-testid="web-preview-panel" className="flex min-h-0 flex-1 flex-col">
|
||||
|
||||
Reference in new issue
Block a user