From 347cbf553222962c4570c56c0e2c7d1c683c73c4 Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 13 Jan 2025 00:18:44 +0200 Subject: [PATCH 01/30] Create www.fungaming.joe50097.json --- www.fungaming.joe50097.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 www.fungaming.joe50097.json diff --git a/www.fungaming.joe50097.json b/www.fungaming.joe50097.json new file mode 100644 index 000000000..50a39e83b --- /dev/null +++ b/www.fungaming.joe50097.json @@ -0,0 +1,9 @@ +{ + "owner": { + "username": "Joe50097", + "email": "zcell9500@gmail.com" + }, + "record": { + "CNAME": "fungaming-discord-server.netlify.app" + } +} From 17777884528610a41a502cbb2fbc47ee637c03d9 Mon Sep 17 00:00:00 2001 From: JumanJi <90971841+heyjumanji@users.noreply.github.com> Date: Mon, 13 Jan 2025 11:55:10 +0530 Subject: [PATCH 02/30] Create _vercel.jumanji.json --- domains/_vercel.jumanji.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 domains/_vercel.jumanji.json diff --git a/domains/_vercel.jumanji.json b/domains/_vercel.jumanji.json new file mode 100644 index 000000000..cf5987dea --- /dev/null +++ b/domains/_vercel.jumanji.json @@ -0,0 +1,9 @@ +{ + "owner": { + "username": "heyjumanji", + "email": "madhuchutiya.unhinge50@silomails.com" + }, + "record": { + "TXT": "vc-domain-verify=jumanji.is-a.dev,291766e76a7ab5de1bc7" + } +} From 429ce273b87339aee743c0e369b21acdde6635d0 Mon Sep 17 00:00:00 2001 From: JumanJi <90971841+heyjumanji@users.noreply.github.com> Date: Mon, 13 Jan 2025 11:57:42 +0530 Subject: [PATCH 03/30] Update jumanji.json --- domains/jumanji.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/domains/jumanji.json b/domains/jumanji.json index b3ef5c086..e6bb22ab4 100644 --- a/domains/jumanji.json +++ b/domains/jumanji.json @@ -6,6 +6,7 @@ "record": { "A": ["172.66.47.44", "172.66.44.212"], "MX": ["mx1.improvmx.com", "mx2.improvmx.com"], - "TXT": "v=spf1 include:spf.improvmx.com ~all" + "TXT": "v=spf1 include:spf.improvmx.com ~all", + "CNAME": "jumanji.vercel.app" } } From 94b4e497a88268288b9eb31f49aac63b460fe725 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 13 Jan 2025 14:29:51 +0800 Subject: [PATCH 04/30] more validations --- dnsconfig.js | 52 +++++++------------------------------------ tests/records.test.js | 40 ++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 45 deletions(-) diff --git a/dnsconfig.js b/dnsconfig.js index 91d9437f7..3cd55b011 100644 --- a/dnsconfig.js +++ b/dnsconfig.js @@ -29,18 +29,14 @@ for (var subdomain in domains) { // Handle A records if (domainData.record.A) { for (var a in domainData.record.A) { - records.push( - A(subdomainName, IP(domainData.record.A[a]), proxyState) - ); + records.push(A(subdomainName, IP(domainData.record.A[a]), proxyState)); } } // Handle AAAA records if (domainData.record.AAAA) { for (var aaaa in domainData.record.AAAA) { - records.push( - AAAA(subdomainName, domainData.record.AAAA[aaaa], proxyState) - ); + records.push(AAAA(subdomainName, domainData.record.AAAA[aaaa], proxyState)); } } @@ -48,28 +44,14 @@ for (var subdomain in domains) { if (domainData.record.CAA) { for (var caa in domainData.record.CAA) { var caaRecord = domainData.record.CAA[caa]; - records.push( - CAA( - subdomainName, - caaRecord.tag, - caaRecord.value - ) - ); + records.push(CAA(subdomainName, caaRecord.tag, caaRecord.value)); } } // Handle CNAME records if (domainData.record.CNAME) { - // Allow CNAME record on root - if (subdomainName === "@") { - records.push( - ALIAS(subdomainName, domainData.record.CNAME + ".", proxyState) - ); - } else { - records.push( - CNAME(subdomainName, domainData.record.CNAME + ".", proxyState) - ); - } + // Use ALIAS instead of CNAME to support CNAME flattening on the root domain + records.push(ALIAS(subdomainName, domainData.record.CNAME + ".", proxyState)); } // Handle DS records @@ -77,13 +59,7 @@ for (var subdomain in domains) { for (var ds in domainData.record.DS) { var dsRecord = domainData.record.DS[ds]; records.push( - DS( - subdomainName, - dsRecord.key_tag, - dsRecord.algorithm, - dsRecord.digest_type, - dsRecord.digest - ) + DS(subdomainName, dsRecord.key_tag, dsRecord.algorithm, dsRecord.digest_type, dsRecord.digest) ); } } @@ -91,13 +67,7 @@ for (var subdomain in domains) { // Handle MX records if (domainData.record.MX) { for (var mx in domainData.record.MX) { - records.push( - MX( - subdomainName, - 10 + parseInt(mx), - domainData.record.MX[mx] + "." - ) - ); + records.push(MX(subdomainName, 10 + parseInt(mx), domainData.record.MX[mx] + ".")); } } @@ -113,13 +83,7 @@ for (var subdomain in domains) { for (var srv in domainData.record.SRV) { var srvRecord = domainData.record.SRV[srv]; records.push( - SRV( - subdomainName, - srvRecord.priority, - srvRecord.weight, - srvRecord.port, - srvRecord.target + "." - ) + SRV(subdomainName, srvRecord.priority, srvRecord.weight, srvRecord.port, srvRecord.target + ".") ); } } diff --git a/tests/records.test.js b/tests/records.test.js index 4d03a0e75..a13530cf5 100644 --- a/tests/records.test.js +++ b/tests/records.test.js @@ -95,11 +95,13 @@ function validateRecordValues(t, data, file) { // General validation for arrays if (["A", "AAAA", "MX", "NS"].includes(key)) { t.true(Array.isArray(value), `${file}: Record value for ${key} should be an array`); + value.forEach((record, idx) => { t.true( typeof record === "string", `${file}: Record value for ${key} should be a string at index ${idx}` ); + if (key === "A") { t.true(ipv4Regex.test(record), `${file}: Invalid IPv4 address for ${key} at index ${idx}`); t.true( @@ -119,6 +121,7 @@ function validateRecordValues(t, data, file) { // CNAME and URL validations if (["CNAME", "URL"].includes(key)) { t.true(typeof value === "string", `${file}: Record value for ${key} should be a string`); + if (key === "CNAME") { t.true(isValidHostname(value), `${file}: Invalid hostname for ${key}`); t.true(value !== file, `${file}: CNAME cannot point to itself`); @@ -132,6 +135,7 @@ function validateRecordValues(t, data, file) { const urlHost = new URL(value).host; const isSelfReferencing = file === "@.json" ? urlHost === "is-a.dev" : urlHost === `${subdomain}.is-a.dev`; + t.true(!isSelfReferencing, `${file}: URL cannot point to itself`); } } @@ -139,17 +143,51 @@ function validateRecordValues(t, data, file) { // CAA, DS, SRV validations if (["CAA", "DS", "SRV"].includes(key)) { t.true(Array.isArray(value), `${file}: Record value for ${key} should be an array`); + value.forEach((record, idx) => { t.true( typeof record === "object", `${file}: Record value for ${key} should be an object at index ${idx}` ); - if (key === "DS") { + + if (key === "CAA") { + t.true( + ["issue", "issuewild", "iodef"].includes(record.tag), + `${file}: Invalid tag for CAA at index ${idx}` + ); + t.true(typeof record.value === "string", `${file}: Invalid value for CAA at index ${idx}`); + t.true( + isValidHostname(record.value) || record.value === ";", + `${file}: Value must be a hostname or semicolon for CAA at index ${idx}` + ); + } else if (key === "DS") { t.true( Number.isInteger(record.key_tag) && record.key_tag >= 0 && record.key_tag <= 65535, `${file}: Invalid key_tag for DS at index ${idx}` ); + t.true( + Number.isInteger(record.algorithm) && record.algorithm >= 0 && record.algorithm <= 255, + `${file}: Invalid algorithm for DS at index ${idx}` + ); + t.true( + Number.isInteger(record.digest_type) && record.digest_type >= 0 && record.digest_type <= 255, + `${file}: Invalid digest_type for DS at index ${idx}` + ); t.true(isValidHexadecimal(record.digest), `${file}: Invalid digest for DS at index ${idx}`); + } else if (key === "SRV") { + t.true( + Number.isInteger(record.priority) && record.priority >= 0 && record.priority <= 65535, + `${file}: Invalid priority for SRV at index ${idx}` + ); + t.true( + Number.isInteger(record.weight) && record.weight >= 0 && record.weight <= 65535, + `${file}: Invalid weight for SRV at index ${idx}` + ); + t.true( + Number.isInteger(record.port) && record.port >= 0 && record.port <= 65535, + `${file}: Invalid port for SRV at index ${idx}` + ); + t.true(isValidHostname(record.target), `${file}: Invalid target for SRV at index ${idx}`); } }); } From 2249355301b12434a3de17e57aced36bdc356cb4 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 13 Jan 2025 14:31:28 +0800 Subject: [PATCH 05/30] reserve _zone-updated --- util/reserved-domains.json | 1 + 1 file changed, 1 insertion(+) diff --git a/util/reserved-domains.json b/util/reserved-domains.json index 797806d1b..0d2de4bd3 100644 --- a/util/reserved-domains.json +++ b/util/reserved-domains.json @@ -1,6 +1,7 @@ [ "_atproto", "_vercel", + "_zone-updated", "account", "accounts", "admin", From 5ca8e5bdbb86de30a289f8c2de2c1514b8c888a5 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 13 Jan 2025 14:31:53 +0800 Subject: [PATCH 06/30] no need to reserve domains starting with _ --- util/reserved-domains.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/util/reserved-domains.json b/util/reserved-domains.json index 0d2de4bd3..16b3293c7 100644 --- a/util/reserved-domains.json +++ b/util/reserved-domains.json @@ -1,7 +1,4 @@ [ - "_atproto", - "_vercel", - "_zone-updated", "account", "accounts", "admin", From fc11230f899bb4850e56e1802b866bd73e3b66b9 Mon Sep 17 00:00:00 2001 From: Muhammad Usman Baig <154676421+UsmanBaig001@users.noreply.github.com> Date: Mon, 13 Jan 2025 11:59:06 +0500 Subject: [PATCH 07/30] usmanbaig.is-a.dev --- domains/_vercel.usmanbaig.json | 9 +++++++++ domains/usmanbaig.json | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 domains/_vercel.usmanbaig.json create mode 100644 domains/usmanbaig.json diff --git a/domains/_vercel.usmanbaig.json b/domains/_vercel.usmanbaig.json new file mode 100644 index 000000000..0f8f07eb7 --- /dev/null +++ b/domains/_vercel.usmanbaig.json @@ -0,0 +1,9 @@ +{ + "owner": { + "username": “UsmanBaig001”, + "email": “usmanbaig1572@gmail.com" + }, + "record": { + "TXT": "vc-domain-verify=usmanbaig.is-a.dev,c2f96e70ebd3aef5458b" + } + } \ No newline at end of file diff --git a/domains/usmanbaig.json b/domains/usmanbaig.json new file mode 100644 index 000000000..74b872cd1 --- /dev/null +++ b/domains/usmanbaig.json @@ -0,0 +1,9 @@ +{ + "owner": { + "username": “UsmanBaig001”, + "email": “usmanbaig1572@gmail.com" + }, + "record": { + "CNAME": "usmanbaig-dev.vercel.app" + } + } \ No newline at end of file From 6a5bb53cafef075dd151fdbace7b8cc173660e6f Mon Sep 17 00:00:00 2001 From: Muhammad Usman Baig <154676421+UsmanBaig001@users.noreply.github.com> Date: Mon, 13 Jan 2025 12:02:22 +0500 Subject: [PATCH 08/30] fix string quotes --- domains/_vercel.usmanbaig.json | 4 ++-- domains/usmanbaig.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/domains/_vercel.usmanbaig.json b/domains/_vercel.usmanbaig.json index 0f8f07eb7..2cc27102c 100644 --- a/domains/_vercel.usmanbaig.json +++ b/domains/_vercel.usmanbaig.json @@ -1,7 +1,7 @@ { "owner": { - "username": “UsmanBaig001”, - "email": “usmanbaig1572@gmail.com" + "username": "UsmanBaig001", + "email": "usmanbaig1572@gmail.com" }, "record": { "TXT": "vc-domain-verify=usmanbaig.is-a.dev,c2f96e70ebd3aef5458b" diff --git a/domains/usmanbaig.json b/domains/usmanbaig.json index 74b872cd1..db087c533 100644 --- a/domains/usmanbaig.json +++ b/domains/usmanbaig.json @@ -1,7 +1,7 @@ { "owner": { - "username": “UsmanBaig001”, - "email": “usmanbaig1572@gmail.com" + "username": "UsmanBaig001", + "email": "usmanbaig1572@gmail.com" }, "record": { "CNAME": "usmanbaig-dev.vercel.app" From 93c16befbae62e89b7dfc055e55580d5e3c9c946 Mon Sep 17 00:00:00 2001 From: Sisyphus_666 <139012668+Umer-Islam@users.noreply.github.com> Date: Mon, 13 Jan 2025 12:13:18 +0500 Subject: [PATCH 09/30] Create umerislam.json --- domains/umerislam.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 domains/umerislam.json diff --git a/domains/umerislam.json b/domains/umerislam.json new file mode 100644 index 000000000..9e46ad79b --- /dev/null +++ b/domains/umerislam.json @@ -0,0 +1,9 @@ +{ + "owner": { + "username": "umer-islam", + "email": "umer.islam474@gmail.com" + }, + "record": { + "CNAME": "umerislam.netlify.app" + } +} From 9544528c9e8c68febf85c7fb8c555bd3360e91c3 Mon Sep 17 00:00:00 2001 From: Muhammad Sami Shoukat <88966319+samishoukat12@users.noreply.github.com> Date: Mon, 13 Jan 2025 12:20:06 +0500 Subject: [PATCH 10/30] samishoukat.is-a.dev --- domains/_vercel.samishoukat.json | 9 +++++++++ domains/samishoukat.json | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 domains/_vercel.samishoukat.json create mode 100644 domains/samishoukat.json diff --git a/domains/_vercel.samishoukat.json b/domains/_vercel.samishoukat.json new file mode 100644 index 000000000..df08f3129 --- /dev/null +++ b/domains/_vercel.samishoukat.json @@ -0,0 +1,9 @@ +{ + "owner": { + "username": "samishoukat12", + "email": "samishoukat12@gmail.com" + }, + "record": { + "TXT": "vc-domain-verify=samishoukat.is-a.dev,f7c3cb972c650104d507" + } + } \ No newline at end of file diff --git a/domains/samishoukat.json b/domains/samishoukat.json new file mode 100644 index 000000000..c88531d66 --- /dev/null +++ b/domains/samishoukat.json @@ -0,0 +1,9 @@ +{ + "owner": { + "username": "samishoukat12", + "email": "samishoukat12@gmail.com" + }, + "record": { + "CNAME": "portfolio2-0-lime.vercel.app" + } + } \ No newline at end of file From ca853b3ac3a7ebfa1939a55628e61997fa7ed57d Mon Sep 17 00:00:00 2001 From: Muhammad Sami Shoukat <88966319+samishoukat12@users.noreply.github.com> Date: Mon, 13 Jan 2025 12:24:54 +0500 Subject: [PATCH 11/30] fix websiste url --- domains/samishoukat.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domains/samishoukat.json b/domains/samishoukat.json index c88531d66..0b683aab6 100644 --- a/domains/samishoukat.json +++ b/domains/samishoukat.json @@ -4,6 +4,6 @@ "email": "samishoukat12@gmail.com" }, "record": { - "CNAME": "portfolio2-0-lime.vercel.app" + "CNAME": "dev-samishoukat.vercel.app" } } \ No newline at end of file From 24a81b4860c0dbb7b8ccb65354f63a80bdaf2a2c Mon Sep 17 00:00:00 2001 From: suryababus <53492132+suryababus@users.noreply.github.com> Date: Mon, 13 Jan 2025 13:05:26 +0530 Subject: [PATCH 12/30] Create suryababu.json --- domains/suryababu.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 domains/suryababu.json diff --git a/domains/suryababu.json b/domains/suryababu.json new file mode 100644 index 000000000..f78668dd8 --- /dev/null +++ b/domains/suryababu.json @@ -0,0 +1,11 @@ +{ + "description": "Landing page for suryababu.is-a.dev", + "repo": "https://github.com/is-a-dev/docs", + "owner": { + "username": "Suryababu", + "email": "suryababu.k.s@gmail.com" + }, + "record": { + "CNAME": "suryababus.github.io" + } +} From 8177843b95c3e598a566de132246790e571d9e00 Mon Sep 17 00:00:00 2001 From: suryababus <53492132+suryababus@users.noreply.github.com> Date: Mon, 13 Jan 2025 13:17:26 +0530 Subject: [PATCH 13/30] Update suryababu.json --- domains/suryababu.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domains/suryababu.json b/domains/suryababu.json index f78668dd8..1c87608b8 100644 --- a/domains/suryababu.json +++ b/domains/suryababu.json @@ -2,7 +2,7 @@ "description": "Landing page for suryababu.is-a.dev", "repo": "https://github.com/is-a-dev/docs", "owner": { - "username": "Suryababu", + "username": "suryababu", "email": "suryababu.k.s@gmail.com" }, "record": { From 613548e4f4b6c4890d3569cfffc2d171df43f932 Mon Sep 17 00:00:00 2001 From: JumanJi <90971841+heyjumanji@users.noreply.github.com> Date: Mon, 13 Jan 2025 13:26:56 +0530 Subject: [PATCH 14/30] Update jumanji.json --- domains/jumanji.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domains/jumanji.json b/domains/jumanji.json index e6bb22ab4..5fa79d9c1 100644 --- a/domains/jumanji.json +++ b/domains/jumanji.json @@ -7,6 +7,6 @@ "A": ["172.66.47.44", "172.66.44.212"], "MX": ["mx1.improvmx.com", "mx2.improvmx.com"], "TXT": "v=spf1 include:spf.improvmx.com ~all", - "CNAME": "jumanji.vercel.app" + "A": ["76.76.21.21"] } } From 9c5b7c440b40a47be7b94084a7137c5a8ad50c3d Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:07:55 +0800 Subject: [PATCH 15/30] Rename www.fungaming.joe50097.json to domains/www.fungaming.joe50097.json --- .../www.fungaming.joe50097.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename www.fungaming.joe50097.json => domains/www.fungaming.joe50097.json (100%) diff --git a/www.fungaming.joe50097.json b/domains/www.fungaming.joe50097.json similarity index 100% rename from www.fungaming.joe50097.json rename to domains/www.fungaming.joe50097.json From 1aef4b980fca4fb124e69bd5c15df24bb465f823 Mon Sep 17 00:00:00 2001 From: Mohammad Usman Date: Mon, 13 Jan 2025 14:13:04 +0500 Subject: [PATCH 16/30] Add mu.is-a.dev --- domains/mu.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 domains/mu.json diff --git a/domains/mu.json b/domains/mu.json new file mode 100644 index 000000000..6edd3c514 --- /dev/null +++ b/domains/mu.json @@ -0,0 +1,9 @@ +{ + "owner": { + "username": "mohammadusman666", + "email": "mohammadusman666@gmail.com" + }, + "record": { + "CNAME": "1d0b4a10.portfolio-1cw.pages.dev" + } +} From d005ee7fc7634314d9d638b4fc3e56b7a497c4d4 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:20:25 +0800 Subject: [PATCH 17/30] so close, yet so far --- domains/suryababu.json | 1 - 1 file changed, 1 deletion(-) diff --git a/domains/suryababu.json b/domains/suryababu.json index 1c87608b8..51e6e007d 100644 --- a/domains/suryababu.json +++ b/domains/suryababu.json @@ -1,6 +1,5 @@ { "description": "Landing page for suryababu.is-a.dev", - "repo": "https://github.com/is-a-dev/docs", "owner": { "username": "suryababu", "email": "suryababu.k.s@gmail.com" From 0be1de0efc18900e3370b60100bc59042201444f Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:33:45 +0800 Subject: [PATCH 18/30] fix + move duplicate keys check --- tests/json.test.js | 34 ++++++++++++++++++++++++++++++++-- tests/records.test.js | 10 ---------- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/tests/json.test.js b/tests/json.test.js index 80d83c9ab..16dd360a2 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -35,7 +35,7 @@ const reservedDomains = require("../util/reserved-domains.json"); const domainsPath = path.resolve("domains"); const files = fs.readdirSync(domainsPath); -const expandReservedDomains = (reserved) => { +function expandReservedDomains(reserved) { const expandedList = [...reserved]; reserved.forEach((item) => { @@ -58,10 +58,30 @@ const expandReservedDomains = (reserved) => { }); return expandedList; -}; +} const expandedReservedDomains = expandReservedDomains(reservedDomains); +function findDuplicateKeys(jsonString) { + const keyPattern = /"([^"]+)"(?=\s*:)/g; + const keys = []; + let match; + + // Find all keys in the JSON string + while ((match = keyPattern.exec(jsonString)) !== null) { + keys.push(match[1]); + } + + // Count occurrences of each key + const keyCount = {}; + keys.forEach((key) => { + keyCount[key] = (keyCount[key] || 0) + 1; + }); + + // Return keys that occur more than once + return Object.keys(keyCount).filter((key) => keyCount[key] > 1); +} + function validateFields(t, obj, fields, file, prefix = "") { Object.keys(fields).forEach((key) => { const fieldPath = prefix ? `${prefix}.${key}` : key; @@ -109,6 +129,16 @@ t("All files should be valid JSON", (t) => { }); }); +t("All files should not have duplicate keys", (t) => { + files.forEach((file) => { + // Parse JSON as a string because JS automatically gets the last key if there are duplicates + const rawData = fs.readFileSync(`${domainsPath}/${file}`, "utf8"); + const duplicateKeys = findDuplicateKeys(rawData); + + t.true(!duplicateKeys.length, `${file}: Duplicate keys found: ${duplicateKeys.join(", ")}`); + }); +}); + t("All files should have valid file names", (t) => { files.forEach((file) => { validateFileName(t, file); diff --git a/tests/records.test.js b/tests/records.test.js index a13530cf5..8a1bbabbc 100644 --- a/tests/records.test.js +++ b/tests/records.test.js @@ -275,13 +275,3 @@ t("All files should have valid record types", (t) => { t.pass(); }); - -t("All files should not have duplicate record keys", (t) => { - files.forEach((file) => { - const data = getDomainData(file); - const recordKeys = Object.keys(data.record); - const uniqueRecordKeys = new Set(recordKeys); - - t.is(recordKeys.length, uniqueRecordKeys.size, `${file}: Duplicate record keys found`); - }); -}); From c0b1e9daa8d1ca1d6475c0332ed392f179176c9f Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:35:18 +0800 Subject: [PATCH 19/30] Update mu.json --- domains/mu.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domains/mu.json b/domains/mu.json index 6edd3c514..1e8929625 100644 --- a/domains/mu.json +++ b/domains/mu.json @@ -4,6 +4,6 @@ "email": "mohammadusman666@gmail.com" }, "record": { - "CNAME": "1d0b4a10.portfolio-1cw.pages.dev" + "CNAME": "portfolio-1cw.pages.dev" } } From d653945689ec18c388e783d690a335809306d1ef Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:35:49 +0800 Subject: [PATCH 20/30] Update jumanji.json --- domains/jumanji.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/domains/jumanji.json b/domains/jumanji.json index 5fa79d9c1..99f81d324 100644 --- a/domains/jumanji.json +++ b/domains/jumanji.json @@ -4,9 +4,8 @@ "email": "madhuchutiya.unhinge650@silomails.com" }, "record": { - "A": ["172.66.47.44", "172.66.44.212"], + "A": ["76.76.21.21"], "MX": ["mx1.improvmx.com", "mx2.improvmx.com"], - "TXT": "v=spf1 include:spf.improvmx.com ~all", - "A": ["76.76.21.21"] + "TXT": "v=spf1 include:spf.improvmx.com ~all" } } From b948f175c9f2d9bb833639adfcc931f9b91bd6c5 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:37:58 +0800 Subject: [PATCH 21/30] Create wh.json --- domains/wh.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 domains/wh.json diff --git a/domains/wh.json b/domains/wh.json new file mode 100644 index 000000000..55dcef36b --- /dev/null +++ b/domains/wh.json @@ -0,0 +1,12 @@ +{ + "owner": { + "username": "wdhdev", + "email": "william@is-a.dev" + }, + "record": { + "URL": "https://william.is-a.dev" + }, + "redirect_config": { + "redirect_paths": true + } +} From c01bea88f463d031fac8dfac2519aec90aae2afb Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:39:11 +0800 Subject: [PATCH 22/30] Create bypassed-usernames.json --- util/bypassed-usernames.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 util/bypassed-usernames.json diff --git a/util/bypassed-usernames.json b/util/bypassed-usernames.json new file mode 100644 index 000000000..ed9a583ce --- /dev/null +++ b/util/bypassed-usernames.json @@ -0,0 +1,4 @@ +[ + "is-a-dev", + "wdhdev" +] From b159edb6c361dca4c109cd7a458a588c2fd8ffe2 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:59:09 +0800 Subject: [PATCH 23/30] add special tests + remove n.is-a.dev as dupe single letter --- domains/_vercel.n.json | 9 -------- domains/n.json | 9 -------- tests/domains.test.js | 2 +- tests/special.test.js | 49 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 19 deletions(-) delete mode 100644 domains/_vercel.n.json delete mode 100644 domains/n.json create mode 100644 tests/special.test.js diff --git a/domains/_vercel.n.json b/domains/_vercel.n.json deleted file mode 100644 index e93beb20b..000000000 --- a/domains/_vercel.n.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "owner": { - "username": "syedtahseen", - "email": "itxtahseen@gmail.com" - }, - "record": { - "TXT": ["vc-domain-verify=n.is-a.dev,8435c76be2d4e8aaa229"] - } -} diff --git a/domains/n.json b/domains/n.json deleted file mode 100644 index d0ef77563..000000000 --- a/domains/n.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "owner": { - "username": "syedtahseen", - "email": "itxtahseen@gmail.com" - }, - "record": { - "CNAME": "xproject-xi.vercel.app" - } -} diff --git a/tests/domains.test.js b/tests/domains.test.js index ce2c3817d..46a4339fb 100644 --- a/tests/domains.test.js +++ b/tests/domains.test.js @@ -3,7 +3,7 @@ const fs = require("fs-extra"); const path = require("path"); const domainsPath = path.resolve("domains"); -const files = fs.readdirSync(domainsPath); +const files = fs.readdirSync(domainsPath).filter((file) => file.endsWith(".json")); const domainCache = {}; diff --git a/tests/special.test.js b/tests/special.test.js new file mode 100644 index 000000000..3ebe59a47 --- /dev/null +++ b/tests/special.test.js @@ -0,0 +1,49 @@ +const t = require("ava"); +const fs = require("fs-extra"); +const path = require("path"); + +const domainsPath = path.resolve("domains"); +const files = fs.readdirSync(domainsPath).filter((file) => file.endsWith(".json")); + +const bypassedUsernames = require("../util/bypassed-usernames.json").map((username) => username.toLowerCase()); + +function getDomainData(subdomain) { + try { + const data = fs.readJsonSync(path.join(domainsPath, `${subdomain}.json`)); + return data; + } catch (error) { + throw new Error(`Failed to read JSON for ${subdomain}: ${error.message}`); + } +} + +t("Users are limited to one single character subdomain", (t) => { + const results = []; + + files.forEach((file) => { + const subdomain = file.replace(/\.json$/, ""); + const data = getDomainData(subdomain); + + if (subdomain.length === 1 && !bypassedUsernames.includes(data.owner.username.toLowerCase())) { + results.push({ + subdomain, + owner: data.owner.username.toLowerCase(), + }) + } + }); + + const duplicates = results.filter((result) => results.filter((r) => r.owner === result.owner).length > 1); + + // Combine duplicates into multiple strings, only one per user, with list of their domains + const output = duplicates.reduce((acc, curr) => { + if (!acc[curr.owner]) { + acc[curr.owner] = []; + } + + acc[curr.owner].push(`${curr.subdomain}.is-a.dev`); + return acc; + }, {}); + + t.is(duplicates.length, 0, Object.keys(output).map((owner) => `${owner} - ${output[owner].join(", ")}`).join("\n")); + + t.pass(); +}) From 358c3a8b235104c1c16b1b4972b29ca2824e7965 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:00:00 +0800 Subject: [PATCH 24/30] refactor special tests to remove redundant comments --- tests/special.test.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/special.test.js b/tests/special.test.js index 3ebe59a47..b0cfa99a4 100644 --- a/tests/special.test.js +++ b/tests/special.test.js @@ -32,8 +32,6 @@ t("Users are limited to one single character subdomain", (t) => { }); const duplicates = results.filter((result) => results.filter((r) => r.owner === result.owner).length > 1); - - // Combine duplicates into multiple strings, only one per user, with list of their domains const output = duplicates.reduce((acc, curr) => { if (!acc[curr.owner]) { acc[curr.owner] = []; From 83b803ed0c70a73257603686b7fc4bfa13a59f63 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:00:15 +0800 Subject: [PATCH 25/30] refactor special test for improved readability and formatting --- tests/special.test.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/special.test.js b/tests/special.test.js index b0cfa99a4..9861a0519 100644 --- a/tests/special.test.js +++ b/tests/special.test.js @@ -26,8 +26,8 @@ t("Users are limited to one single character subdomain", (t) => { if (subdomain.length === 1 && !bypassedUsernames.includes(data.owner.username.toLowerCase())) { results.push({ subdomain, - owner: data.owner.username.toLowerCase(), - }) + owner: data.owner.username.toLowerCase() + }); } }); @@ -41,7 +41,13 @@ t("Users are limited to one single character subdomain", (t) => { return acc; }, {}); - t.is(duplicates.length, 0, Object.keys(output).map((owner) => `${owner} - ${output[owner].join(", ")}`).join("\n")); + t.is( + duplicates.length, + 0, + Object.keys(output) + .map((owner) => `${owner} - ${output[owner].join(", ")}`) + .join("\n") + ); t.pass(); -}) +}); From 74323a67856b81ef4eeb62c6dea5f621ce5ff3d6 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:02:35 +0800 Subject: [PATCH 26/30] shorten util JSON file names --- tests/json.test.js | 6 +- tests/special.test.js | 2 +- ...{bypassed-usernames.json => bypassed.json} | 0 util/{excepted-domains.json => excepted.json} | 0 util/{reserved-domains.json => reserved.json} | 240 +++++++++--------- 5 files changed, 124 insertions(+), 124 deletions(-) rename util/{bypassed-usernames.json => bypassed.json} (100%) rename util/{excepted-domains.json => excepted.json} (100%) rename util/{reserved-domains.json => reserved.json} (93%) diff --git a/tests/json.test.js b/tests/json.test.js index 16dd360a2..39d293f81 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -30,8 +30,8 @@ const optionalRedirectConfigFields = { const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; const hostnameRegex = /^(?=.{1,253}$)(?:(?:[_a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)\.)+[a-zA-Z]{2,63}$/; -const exceptedDomains = require("../util/excepted-domains.json"); -const reservedDomains = require("../util/reserved-domains.json"); +const exceptedDomains = require("../util/excepted.json"); +const reservedDomains = require("../util/reserved.json"); const domainsPath = path.resolve("domains"); const files = fs.readdirSync(domainsPath); @@ -52,7 +52,7 @@ function expandReservedDomains(reserved) { } expandedList.splice(expandedList.indexOf(item), 1); } else { - throw new Error(`[util/reserved-domains.json] Invalid range [${start}-${end}] in "${item}"`); + throw new Error(`[util/reserved.json] Invalid range [${start}-${end}] in "${item}"`); } } }); diff --git a/tests/special.test.js b/tests/special.test.js index 9861a0519..bd18e3e00 100644 --- a/tests/special.test.js +++ b/tests/special.test.js @@ -5,7 +5,7 @@ const path = require("path"); const domainsPath = path.resolve("domains"); const files = fs.readdirSync(domainsPath).filter((file) => file.endsWith(".json")); -const bypassedUsernames = require("../util/bypassed-usernames.json").map((username) => username.toLowerCase()); +const bypassedUsernames = require("../util/bypassed.json").map((username) => username.toLowerCase()); function getDomainData(subdomain) { try { diff --git a/util/bypassed-usernames.json b/util/bypassed.json similarity index 100% rename from util/bypassed-usernames.json rename to util/bypassed.json diff --git a/util/excepted-domains.json b/util/excepted.json similarity index 100% rename from util/excepted-domains.json rename to util/excepted.json diff --git a/util/reserved-domains.json b/util/reserved.json similarity index 93% rename from util/reserved-domains.json rename to util/reserved.json index 16b3293c7..eccc9738c 100644 --- a/util/reserved-domains.json +++ b/util/reserved.json @@ -1,120 +1,120 @@ -[ - "account", - "accounts", - "admin", - "administrator", - "alert", - "alerts", - "api", - "auth", - "authentication", - "authorisation", - "authorise", - "authorization", - "authorize", - "aux", - "billing", - "blog", - "calendar", - "cart", - "catalog", - "checkout", - "co", - "com", - "com[1-9]", - "con", - "confirm", - "confirmation", - "dashboard", - "default", - "dns", - "doc", - "documentation", - "email", - "error", - "errors", - "event", - "events", - "example", - "feedback", - "finance", - "forgot", - "forgot-password", - "gtld", - "guest", - "help", - "helpdesk", - "hostmaster", - "info", - "infos", - "login", - "logout", - "lpt[1-9]", - "m", - "mail", - "maintainer", - "maintainers", - "marketing", - "media", - "mobile", - "net", - "news", - "noc", - "notification", - "notifications", - "notify", - "ns", - "ns[1-99]", - "nul", - "oauth", - "official", - "operations", - "ops", - "org", - "organisation", - "pay", - "payment", - "payments", - "portal", - "postmaster", - "recovery", - "redirect", - "registrar", - "registry", - "reset", - "reset-password", - "root", - "sales", - "schedule", - "secure", - "security", - "service", - "services", - "session", - "sessions", - "shop", - "signin", - "signout", - "signup", - "staff", - "store", - "superuser", - "support", - "sys", - "system", - "teams", - "test", - "test[1-9999]", - "tld", - "token", - "tokens", - "url", - "url[1-9999]", - "user", - "users", - "webmaster", - "whois", - "www[1-99]", - "wwww", - "your-domain-name" -] +[ + "account", + "accounts", + "admin", + "administrator", + "alert", + "alerts", + "api", + "auth", + "authentication", + "authorisation", + "authorise", + "authorization", + "authorize", + "aux", + "billing", + "blog", + "calendar", + "cart", + "catalog", + "checkout", + "co", + "com", + "com[1-9]", + "con", + "confirm", + "confirmation", + "dashboard", + "default", + "dns", + "doc", + "documentation", + "email", + "error", + "errors", + "event", + "events", + "example", + "feedback", + "finance", + "forgot", + "forgot-password", + "gtld", + "guest", + "help", + "helpdesk", + "hostmaster", + "info", + "infos", + "login", + "logout", + "lpt[1-9]", + "m", + "mail", + "maintainer", + "maintainers", + "marketing", + "media", + "mobile", + "net", + "news", + "noc", + "notification", + "notifications", + "notify", + "ns", + "ns[1-99]", + "nul", + "oauth", + "official", + "operations", + "ops", + "org", + "organisation", + "pay", + "payment", + "payments", + "portal", + "postmaster", + "recovery", + "redirect", + "registrar", + "registry", + "reset", + "reset-password", + "root", + "sales", + "schedule", + "secure", + "security", + "service", + "services", + "session", + "sessions", + "shop", + "signin", + "signout", + "signup", + "staff", + "store", + "superuser", + "support", + "sys", + "system", + "teams", + "test", + "test[1-9999]", + "tld", + "token", + "tokens", + "url", + "url[1-9999]", + "user", + "users", + "webmaster", + "whois", + "www[1-99]", + "wwww", + "your-domain-name" +] From 1d8b191675f911422a4a62f6075008d8542d1f1a Mon Sep 17 00:00:00 2001 From: Rohan Jaiswal <62180133+jaiswalrohan8796@users.noreply.github.com> Date: Mon, 13 Jan 2025 15:53:49 +0530 Subject: [PATCH 27/30] Create rohanjaiswal.json --- domains/rohanjaiswal.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 domains/rohanjaiswal.json diff --git a/domains/rohanjaiswal.json b/domains/rohanjaiswal.json new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/domains/rohanjaiswal.json @@ -0,0 +1 @@ + From 7c55f7dffc75ca657237116b57a1f4bf304de70c Mon Sep 17 00:00:00 2001 From: Rohan Jaiswal <62180133+jaiswalrohan8796@users.noreply.github.com> Date: Mon, 13 Jan 2025 16:02:46 +0530 Subject: [PATCH 28/30] Update rohanjaiswal.json --- domains/rohanjaiswal.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/domains/rohanjaiswal.json b/domains/rohanjaiswal.json index 8b1378917..5a101c6eb 100644 --- a/domains/rohanjaiswal.json +++ b/domains/rohanjaiswal.json @@ -1 +1,11 @@ - +{ + "description": "Rohan Jaiswal's portfolio", + "repo": "https://github.com/jaiswalrohan8796/jaiswalrohan8796", + "owner": { + "username": "jaiswalrohan8796", + "email": "[jaiswalrohan8796@gmail.com]" + }, + "record": { + "CNAME": "jaiswalrohan8796.github.io" + } +} From d80ea15d519bd50ae3e5c0c97f04363a34ac7aa1 Mon Sep 17 00:00:00 2001 From: Rohan Jaiswal <62180133+jaiswalrohan8796@users.noreply.github.com> Date: Mon, 13 Jan 2025 16:19:50 +0530 Subject: [PATCH 29/30] Update rohanjaiswal.json --- domains/rohanjaiswal.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domains/rohanjaiswal.json b/domains/rohanjaiswal.json index 5a101c6eb..d6fd5078f 100644 --- a/domains/rohanjaiswal.json +++ b/domains/rohanjaiswal.json @@ -3,7 +3,7 @@ "repo": "https://github.com/jaiswalrohan8796/jaiswalrohan8796", "owner": { "username": "jaiswalrohan8796", - "email": "[jaiswalrohan8796@gmail.com]" + "email": "jaiswalrohan8796@gmail.com" }, "record": { "CNAME": "jaiswalrohan8796.github.io" From 1bef8fda2ca1f48ea12cdd5102bf093c23150e3b Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 13 Jan 2025 13:24:42 +0200 Subject: [PATCH 30/30] Create fungaming.joe50097.json --- domains/fungaming.joe50097.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 domains/fungaming.joe50097.json diff --git a/domains/fungaming.joe50097.json b/domains/fungaming.joe50097.json new file mode 100644 index 000000000..50a39e83b --- /dev/null +++ b/domains/fungaming.joe50097.json @@ -0,0 +1,9 @@ +{ + "owner": { + "username": "Joe50097", + "email": "zcell9500@gmail.com" + }, + "record": { + "CNAME": "fungaming-discord-server.netlify.app" + } +}