// The address phones and other networks use to reach this server (a domain or DynDNS name, // optionally with a port), e.g. "https://club.dyndns.org:8443". Only the origin is kept; // "" when empty or invalid - links and QR codes then use the local network address. export function normalizePublicBaseUrl(value) { try { const url = new URL(String(value || "").trim()); return ["http:", "https:"].includes(url.protocol) ? url.origin : ""; } catch { return ""; } }