From d31ee4b7f0cec0be9e44d4b5a9ac3df0c7a1abc3 Mon Sep 17 00:00:00 2001 From: Ian Macabulos Date: Wed, 14 Jan 2026 23:26:50 +0800 Subject: [PATCH] fix: suppress domain expiry warnings for local domains (#6682) --- server/model/domain_expiry.js | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/server/model/domain_expiry.js b/server/model/domain_expiry.js index b7992575f..71c8d8f87 100644 --- a/server/model/domain_expiry.js +++ b/server/model/domain_expiry.js @@ -15,6 +15,20 @@ const cachedFetch = process.env.NODE_ENV }) : fetch; +// List of TLDs that do not support RDAP/public expiry dates. +// We ignore these to prevent log warnings. +const IGNORED_TLDS = [ + "local", + "internal", + "lan", + "home", + "corp", + "test", + "example", + "invalid", + "localhost" +]; + /** * Find the RDAP server for a given TLD * @param {string} tld TLD @@ -47,6 +61,12 @@ async function getRdapServer(tld) { */ async function getRdapDomainExpiryDate(domain) { const tld = DomainExpiry.parseTld(domain).publicSuffix; + + // Skip ignored TLDs silently + if (tld && IGNORED_TLDS.includes(tld)) { + return null; + } + const rdapServer = await getRdapServer(tld); if (rdapServer === null) { log.warn("rdap", `No RDAP server found, TLD ${tld} not supported.`); @@ -174,6 +194,14 @@ class DomainExpiry extends BeanModel { throw new TranslatableError("domain_expiry_public_suffix_too_short", { publicSuffix: tld.publicSuffix }); } + // Allow ignored TLDs to bypass RDAP check and save successfully + if (IGNORED_TLDS.includes(tld.publicSuffix)) { + return { + domain: tld.domain, + tld: tld.publicSuffix, + }; + } + const rdap = await getRdapServer(tld.publicSuffix); if (!rdap) { throw new TranslatableError("domain_expiry_unsupported_unsupported_tld_no_rdap_endpoint", { @@ -308,4 +336,4 @@ class DomainExpiry extends BeanModel { } } -module.exports = DomainExpiry; +module.exports = DomainExpiry; \ No newline at end of file