From 964fd4b060c339907f73ff476ea6f5b92ba2d381 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Wed, 23 Apr 2025 15:55:44 +0800 Subject: [PATCH] remove @ + www json files, update reserved --- dnsconfig.js | 8 ++++-- domains/@.json | 23 --------------- domains/www.json | 10 ------- tests/json.test.js | 30 +++++++++---------- tests/records.test.js | 9 ++---- util/reserved.json | 67 ++----------------------------------------- 6 files changed, 24 insertions(+), 123 deletions(-) delete mode 100644 domains/@.json delete mode 100644 domains/www.json diff --git a/dnsconfig.js b/dnsconfig.js index 96efbf447..75279a400 100644 --- a/dnsconfig.js +++ b/dnsconfig.js @@ -50,8 +50,7 @@ for (var subdomain in domains) { // Handle CNAME records if (domainData.record.CNAME) { - // Use ALIAS instead of CNAME to support CNAME flattening on the root domain - records.push(ALIAS(subdomainName, domainData.record.CNAME + ".", proxyState)); + records.push(CNAME(subdomainName, domainData.record.CNAME + ".", proxyState)); } // Handle DS records @@ -147,7 +146,8 @@ for (var i = 0; i < reserved.length; i++) { subdomainName !== "ns1" && subdomainName !== "ns2" && subdomainName !== "ns3" && - subdomainName !== "ns4" + subdomainName !== "ns4" && + subdomainName !== "www" ) { records.push(A(subdomainName, IP("192.0.2.1"), CF_PROXY_ON)); } @@ -159,6 +159,7 @@ var options = { var ignored = [ IGNORE("*._domainkey", "TXT"), + IGNORE("@", "*"), IGNORE("_acme-challenge", "TXT"), IGNORE("_autodiscover._tcp", "SRV"), IGNORE("_dmarc", "TXT"), @@ -166,6 +167,7 @@ var ignored = [ IGNORE("autoconfig", "CNAME"), IGNORE("autodiscover", "CNAME"), IGNORE("ns[1-4]", "A,AAAA"), + IGNORE("www", "*") ]; // Push TXT record of when the zone was last updated diff --git a/domains/@.json b/domains/@.json deleted file mode 100644 index 2555352ac..000000000 --- a/domains/@.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "owner": { - "username": "is-a-dev", - "email": "admin@is-a.dev" - }, - "record": { - "CNAME": "is-a-dev.github.io", - "MX": ["mail.hrsn.net"], - "TXT": ["v=spf1 include:_spf.hrsn.net -all"] - }, - "redirect_config": { - "custom_paths": { - "/discord": "https://discord.gg/is-a-dev-830872854677422150", - "/docs": "https://docs.is-a.dev", - "/donate": "https://wdh.gg/pvNCdvs", - "/donate/ns": "https://wdh.gg/pvNCdvs", - "/donate/sponsor": "https://wdh.gg/sponsor", - "/github": "https://github.com/is-a-dev", - "/register": "https://github.com/is-a-dev/register" - } - }, - "proxied": true -} diff --git a/domains/www.json b/domains/www.json deleted file mode 100644 index 708e00ecc..000000000 --- a/domains/www.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "owner": { - "username": "is-a-dev", - "email": "admin@is-a.dev" - }, - "record": { - "CNAME": "is-a.dev" - }, - "proxied": true -} diff --git a/tests/json.test.js b/tests/json.test.js index 123902a73..1d1c4f975 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -97,25 +97,23 @@ async function validateFileName(t, file) { t.false(file.includes("--"), `${file}: File name should not contain consecutive hyphens`); t.false(file.startsWith("_redirect."), `${file}: File name should not start with _redirect`); - if (file !== "@.json") { - const subdomain = file.replace(/\.json$/, ""); + const subdomain = file.replace(/\.json$/, ""); - t.regex( - subdomain + ".is-a.dev", - hostnameRegex, - `${file}: FQDN must be 1-253 characters, can use letters, numbers, dots, and non-consecutive hyphens.` - ); - t.false(reservedDomains.includes(subdomain), `${file}: Subdomain name is reserved`); - t.true( - !reservedDomains.some((reserved) => subdomain.endsWith(`.${reserved}`)), - `${file}: Subdomain name is reserved` - ); + t.regex( + subdomain + ".is-a.dev", + hostnameRegex, + `${file}: FQDN must be 1-253 characters, can use letters, numbers, dots, and non-consecutive hyphens.` + ); + t.false(reservedDomains.includes(subdomain), `${file}: Subdomain name is reserved`); + t.true( + !reservedDomains.some((reserved) => subdomain.endsWith(`.${reserved}`)), + `${file}: Subdomain name is reserved` + ); - const rootSubdomain = subdomain.split(".").pop(); + const rootSubdomain = subdomain.split(".").pop(); - if (!excludedDomains.includes(rootSubdomain)) { - t.false(rootSubdomain.startsWith("_"), `${file}: Root subdomains should not start with an underscore`); - } + if (!excludedDomains.includes(rootSubdomain)) { + t.false(rootSubdomain.startsWith("_"), `${file}: Root subdomains should not start with an underscore`); } } diff --git a/tests/records.test.js b/tests/records.test.js index 573e0604e..c7b417a88 100644 --- a/tests/records.test.js +++ b/tests/records.test.js @@ -147,11 +147,9 @@ function validateRecordValues(t, data, file) { ); t.notThrows(() => new URL(value), `${file}: Invalid URL for ${key}`); + // Check for self-referencing redirects const urlHost = new URL(value).host; - const isSelfReferencing = - file === "@.json" ? urlHost === "is-a.dev" : urlHost === `${subdomain}.is-a.dev`; - - t.false(isSelfReferencing, `${file}: URL cannot point to itself`); + t.false(urlHost === `${subdomain}.is-a.dev`, `${file}: URL cannot point to itself`); } } @@ -264,8 +262,7 @@ function validateRecordValues(t, data, file) { // Check for self-referencing redirects const urlHost = new URL(customRedirectURL).host; - const isSelfReferencing = file === "@.json" ? urlHost === "is-a.dev" : urlHost === `${subdomain}.is-a.dev`; - t.false(isSelfReferencing, `${urlMessage} cannot point to itself at index ${idx}`); + t.false(urlHost === `${subdomain}.is-a.dev`, `${urlMessage} cannot point to itself at index ${idx}`); }); } } diff --git a/util/reserved.json b/util/reserved.json index e4a8d494c..697ed3fec 100644 --- a/util/reserved.json +++ b/util/reserved.json @@ -2,26 +2,16 @@ "about", "account", "accounts", - "ad", "admin", - "ads", "api", - "apis", "app", "apps", - "asset", "assets", "auth", - "authentication", - "authorisation", - "authorise", - "authorization", - "authorize", "autoconfig", "autodiscover", "billing", "blog", - "board", "bot", "cdn", "chat", @@ -29,9 +19,6 @@ "cname", "co", "com", - "con", - "contribute", - "contributing", "dash", "dashboard", "dns", @@ -39,45 +26,26 @@ "documentation", "domain", "email", - "event", - "events", "example", - "feedback", "file", "files", "get", "help", - "helper", - "helpers", "home", "host", "hosting", - "hostmaster", "http", "https", "info", "int", "internal", - "legal", - "license", "login", - "lpt1", - "lpt2", - "lpt3", - "lpt4", - "lpt5", - "lpt6", - "lpt7", - "lpt8", - "lpt9", "m", "mail", "maintainer", "maintainers", "media", "mobile", - "moderator", - "moderators", "net", "network", "news", @@ -97,17 +65,11 @@ "ns8", "ns9", "oauth", - "online", - "ops", "org", - "owner", "pay", "payment", "payments", - "poll", - "polls", "portal", - "postmaster", "preview", "private", "prod", @@ -129,7 +91,6 @@ "staff", "staging", "static", - "statistics", "stats", "status", "store", @@ -137,39 +98,15 @@ "support", "sys", "system", + "team", "test", - "terms", - "token", - "tokens", - "tos", "url", - "vote", "web", "webmail", - "webmaster", "website", "whois", "ww", - "ww0", - "ww1", - "ww2", - "ww3", - "ww4", - "ww5", - "ww6", - "ww7", - "ww8", - "ww9", - "www0", - "www1", - "www2", - "www3", - "www4", - "www5", - "www6", - "www7", - "www8", - "www9", + "www", "wwww", "your-domain-name", "zone"