diff --git a/main.js b/main.js index a2114d4b..7cd79768 100644 --- a/main.js +++ b/main.js @@ -5016,12 +5016,33 @@ const ERROR_CODE_IGNORE = new Set([-3, -20]); // -7 ERR_TIMED_OUT // -21 ERR_NETWORK_CHANGED const ERROR_UNREACHABLE = new Set([-102, -101, -118, -100, -7, -21]); +// Well-known ICANN TLDs where "DNS couldn't resolve" is the far likelier +// story than "the user wanted a BCNR name on this TLD" — frames the error +// as a reachability issue (retry, check DNS) rather than as a BCNR +// register-this-name invitation. +const COMMON_ICANN_TLDS = new Set([ + "com", "net", "org", "edu", "gov", "mil", "int", "info", "biz", "name", "pro", + "io", "co", "me", "tv", "app", "dev", "ai", "cloud", "online", "site", "store", + "us", "uk", "de", "fr", "it", "es", "pl", "nl", "be", "ch", "at", "se", "no", + "fi", "dk", "ie", "pt", "gr", "cz", "ro", "hu", "ua", "ru", "by", "kz", + "jp", "cn", "tw", "hk", "kr", "sg", "my", "th", "vn", "in", "id", "ph", + "au", "nz", "br", "mx", "ar", "cl", "co", "pe", "ve", "ca", "za", "ng", "eg", + "il", "ae", "sa", "tr", "ir", "pk", +]); +function isLikelyIcannHost(host) { + const t = tldOf(host); + return !!t && COMMON_ICANN_TLDS.has(t); +} function pickErrorKind(code, host) { if (code === -105) { - // Name didn't resolve. If the host is BCNR-eligible (has a real TLD), - // that also means BCNR had no record — otherwise resolveHost/loadBns - // would have served something. Treat as "not registered" to promote - // the register-on-Sirius action. + // Name didn't resolve. For well-known ICANN TLDs (.com/.net/.io/…), + // frame it as a DNS failure — leading with "register on BCNR" would + // confuse the user whose site is almost certainly a clearnet one and + // whose DNS is temporarily broken (hostile Wi-Fi AAAA mangling, etc.). + if (isLikelyIcannHost(host)) return "name-unreachable"; + // Otherwise the host is a BCNR-eligible non-ICANN TLD (.bch, .x, …): + // BCNR had no record and no clearnet DNS answer either — treat as + // "not registered" to promote the register-on-Sirius action. return isBnsHost(host) ? "name-not-registered" : "name-unreachable"; } if (ERROR_UNREACHABLE.has(code)) return "unreachable"; diff --git a/package.json b/package.json index e9fca27e..5794533b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "theseus-navigator", - "version": "0.3.116", + "version": "0.3.117", "license": "MPL-2.0", "description": "Theseus Navigator — a browser that follows the thread. By Silent Mode, a Deviant project.", "author": "Silent Mode",