Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

417 B
Raw Blame
export type CustomWidgetHttpUrlIssue = "invalid" | "protocol" | "credentials";

export function getCustomWidgetHttpUrlIssue(value: string): CustomWidgetHttpUrlIssue | null {
  let url: URL;
  try {
    url = new URL(value);
  } catch {
    return "invalid";
  }
  if (url.protocol !== "http:" && url.protocol !== "https:") return "protocol";
  if (url.username || url.password) return "credentials";
  return null;
}