/** Hostnames known to run older signal servers without featured/trending discovery routes. */
const DISCOVERY_UNSUPPORTED_HOSTS = new Set(['signal.toju.app', 'signal-sweden.toju.app']);

/** Returns false when discovery endpoints are known to 404 on the active signal server. */
export function endpointSupportsServerDiscovery(baseUrl: string): boolean {
  try {
    const hostname = new URL(baseUrl).hostname;

    return !DISCOVERY_UNSUPPORTED_HOSTS.has(hostname);
  } catch {
    return true;
  }
}
