Skip to content

An open source, self-hosted, real-time port monitoring and discovery tool.

304 B
Raw Blame
export function safeExternalUrl(value) {
  if (typeof value !== "string") return undefined;
  try {
    const parsed = new URL(value);
    return ["http:", "https:"].includes(parsed.protocol) && !parsed.username && !parsed.password
      ? parsed.href : undefined;
  } catch {
    return undefined;
  }
}