import { IconExternalLink } from "@tabler/icons-react"; import { cn } from "@/lib/utils"; /** * Guard for rendering a plugin-supplied repo URL as an ``. A plugin's * repo_url comes from its manifest (installed plugins) or an untrusted * index.json (marketplace catalog), so only http(s) is allowed — a * `javascript:` (or other) scheme would execute in the operator's session on * click, and `rel`/`target` do NOT block it. */ export function isHttpUrl(url: string | undefined | null): boolean { if (!url) return false; return /^https?:\/\//i.test(url.trim()); } /** * A guarded external "Repo" link to a plugin's source repository. Renders * nothing when the URL is empty or not http(s). Shared by the marketplace * catalog card and the installed-plugin list/detail so the scheme guard and * link markup live in one place. */ export function PluginRepoLink({ url, className }: { url?: string | null; className?: string }) { if (!isHttpUrl(url)) return null; return ( Repo ); }