From 8bd9a6f1d6321f3ff2bd87d4065b2182b629be7d Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:24:09 -0500 Subject: [PATCH 01/11] Update domains.test.js --- tests/domains.test.js | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/tests/domains.test.js b/tests/domains.test.js index cbcc4218..4ae7344d 100644 --- a/tests/domains.test.js +++ b/tests/domains.test.js @@ -5,9 +5,12 @@ const path = require("path"); const domainsPath = path.resolve("domains"); const files = fs.readdirSync(domainsPath); -// Extract all valid domains from the files -const validDomains = new Set( - files.map((file) => file.replace(/\.json$/, "")) // Remove .json extension for easier comparison +// Extract all subdomains from files (without considering specific TLDs) +const validRootDomains = Array.from( + new Set( + files + .map((file) => file.split(".").slice(-2).join(".")) + ) ); t("Nested subdomains should not exist without a valid parent domain", (t) => { @@ -20,15 +23,16 @@ t("Nested subdomains should not exist without a valid parent domain", (t) => { const subdomain = file.replace(/\.json$/, ""); - // Check if the domain is a nested subdomain (i.e., has more than 2 parts) + // Skip first-level subdomains (e.g., "banana.is-cool.dev") + // First-level subdomains have no immediate parent to check if (subdomain.split(".").length > 2) { - // Get the "root" domain by extracting only the last two parts - const rootDomain = subdomain.split(".").slice(-2).join("."); + // Get the immediate parent domain (remove the first subdomain part) + const parentSubdomain = subdomain.split(".").slice(1).join("."); - // Ensure the root domain exists + // Ensure the immediate parent subdomain exists in the list of files t.true( - validDomains.has(rootDomain), - `${file}: Parent domain ${rootDomain}.json does not exist` + files.includes(`${parentSubdomain}.json`), + `${file}: Parent domain ${parentSubdomain}.json does not exist` ); } }); @@ -46,11 +50,12 @@ t("Nested subdomains should not exist if the parent domain has NS records", (t) const subdomain = file.replace(/\.json$/, ""); - // Check if the domain is a nested subdomain (i.e., has more than 2 parts) + // Skip first-level subdomains (e.g., "banana.is-cool.dev") + // First-level subdomains have no immediate parent to check if (subdomain.split(".").length > 2) { - // Get the "root" domain by extracting only the last two parts - const rootDomain = subdomain.split(".").slice(-2).join("."); - const parentFilePath = path.join(domainsPath, `${rootDomain}.json`); + // Get the immediate parent domain (remove the first subdomain part) + const parentSubdomain = subdomain.split(".").slice(1).join("."); + const parentFilePath = path.join(domainsPath, `${parentSubdomain}.json`); // Check if the parent file exists before attempting to read it if (fs.existsSync(parentFilePath)) { @@ -60,10 +65,10 @@ t("Nested subdomains should not exist if the parent domain has NS records", (t) t.is( parentDomain.record.NS, undefined, - `${file}: Parent domain ${rootDomain} has NS records` + `${file}: Parent domain ${parentSubdomain} has NS records` ); } else { - t.fail(`${rootDomain}.json file does not exist`); + t.fail(`${parentSubdomain}.json file does not exist`); } } }); From 75559bc848e37538325d401642df602f3521bcc0 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:39:22 -0500 Subject: [PATCH 02/11] Update domains.test.js --- tests/domains.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/domains.test.js b/tests/domains.test.js index 4ae7344d..81c16d6e 100644 --- a/tests/domains.test.js +++ b/tests/domains.test.js @@ -9,7 +9,7 @@ const files = fs.readdirSync(domainsPath); const validRootDomains = Array.from( new Set( files - .map((file) => file.split(".").slice(-2).join(".")) + .map((file) => file.split(".").slice(-3).join(".")) ) ); From 1ccad6b2337da597563f42d4e115109a1407fb8e Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:40:39 -0500 Subject: [PATCH 03/11] Update domains.test.js --- tests/domains.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/domains.test.js b/tests/domains.test.js index 81c16d6e..a97520d3 100644 --- a/tests/domains.test.js +++ b/tests/domains.test.js @@ -25,7 +25,7 @@ t("Nested subdomains should not exist without a valid parent domain", (t) => { // Skip first-level subdomains (e.g., "banana.is-cool.dev") // First-level subdomains have no immediate parent to check - if (subdomain.split(".").length > 2) { + if (subdomain.split(".").length > 3) { // Get the immediate parent domain (remove the first subdomain part) const parentSubdomain = subdomain.split(".").slice(1).join("."); @@ -52,7 +52,7 @@ t("Nested subdomains should not exist if the parent domain has NS records", (t) // Skip first-level subdomains (e.g., "banana.is-cool.dev") // First-level subdomains have no immediate parent to check - if (subdomain.split(".").length > 2) { + if (subdomain.split(".").length > 3) { // Get the immediate parent domain (remove the first subdomain part) const parentSubdomain = subdomain.split(".").slice(1).join("."); const parentFilePath = path.join(domainsPath, `${parentSubdomain}.json`); From 24c890127a9c670adfd3a9abe5f410e4c5b73bee Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:46:06 -0500 Subject: [PATCH 04/11] chore: testing --- tests/domains.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/domains.test.js b/tests/domains.test.js index a97520d3..980f9d87 100644 --- a/tests/domains.test.js +++ b/tests/domains.test.js @@ -53,8 +53,8 @@ t("Nested subdomains should not exist if the parent domain has NS records", (t) // Skip first-level subdomains (e.g., "banana.is-cool.dev") // First-level subdomains have no immediate parent to check if (subdomain.split(".").length > 3) { - // Get the immediate parent domain (remove the first subdomain part) - const parentSubdomain = subdomain.split(".").slice(1).join("."); + // Get the immediate parent domain, by getting the last 3 parts. + const parentSubdomain = subdomain.split(".").slice(-3); const parentFilePath = path.join(domainsPath, `${parentSubdomain}.json`); // Check if the parent file exists before attempting to read it From ee5c8cace360b8d932148b0c603a93b6a4faf7ba Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:47:46 -0500 Subject: [PATCH 05/11] Update domains.test.js --- tests/domains.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/domains.test.js b/tests/domains.test.js index 980f9d87..cfb019e3 100644 --- a/tests/domains.test.js +++ b/tests/domains.test.js @@ -27,7 +27,7 @@ t("Nested subdomains should not exist without a valid parent domain", (t) => { // First-level subdomains have no immediate parent to check if (subdomain.split(".").length > 3) { // Get the immediate parent domain (remove the first subdomain part) - const parentSubdomain = subdomain.split(".").slice(1).join("."); + const parentSubdomain = subdomain.split(".").slice(-3).join("."); // Ensure the immediate parent subdomain exists in the list of files t.true( @@ -54,7 +54,7 @@ t("Nested subdomains should not exist if the parent domain has NS records", (t) // First-level subdomains have no immediate parent to check if (subdomain.split(".").length > 3) { // Get the immediate parent domain, by getting the last 3 parts. - const parentSubdomain = subdomain.split(".").slice(-3); + const parentSubdomain = subdomain.split(".").slice(-3).join("."); const parentFilePath = path.join(domainsPath, `${parentSubdomain}.json`); // Check if the parent file exists before attempting to read it From 8f44becb40a7990fe8707c09b3a6a2c3f5403cdd Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:50:09 -0500 Subject: [PATCH 06/11] Delete domains/_github-pages-challenge-hosykynam0619ch2008-umego.lophoctinhthuong.is-local.org.json --- ...008-umego.lophoctinhthuong.is-local.org.json | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 domains/_github-pages-challenge-hosykynam0619ch2008-umego.lophoctinhthuong.is-local.org.json diff --git a/domains/_github-pages-challenge-hosykynam0619ch2008-umego.lophoctinhthuong.is-local.org.json b/domains/_github-pages-challenge-hosykynam0619ch2008-umego.lophoctinhthuong.is-local.org.json deleted file mode 100644 index 5f7f2c78..00000000 --- a/domains/_github-pages-challenge-hosykynam0619ch2008-umego.lophoctinhthuong.is-local.org.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "description": "Welcome to Lớp học tình thương! (Class of Love in Vietnamese). This is a project by student to introduce our class, where love and learning are always prioritized, mostly fun. This portfolio includes an introduction to the class, learning and extracurricular activities, and an introduction video. The project's goal is to share joy, connect students preserve memorable moments of school life. We always welcome contributions from everyone. If you have ideas or want to add content, please open an Issue or Pull Request.", - - "domain": "is-local.org", - "subdomain": "_github-pages-challenge-hosykynam0619ch2008-umego.lophoctinhthuong", - - "owner": { - "repo": "https://github.com/hosykynam0619ch2008-umego/lophoctinhthuong", - "email": "nam@belugadanganphoga.com" - }, - - "record": { - "TXT": ["a1e85d841d86fc4b2f499b96a25626"] - }, - - "proxied": false -} From 9e596e57c1a2c3becac65904ede1b530e557896e Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:54:40 -0500 Subject: [PATCH 07/11] Update domains.test.js --- tests/domains.test.js | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/tests/domains.test.js b/tests/domains.test.js index cfb019e3..5b41ce54 100644 --- a/tests/domains.test.js +++ b/tests/domains.test.js @@ -5,13 +5,9 @@ const path = require("path"); const domainsPath = path.resolve("domains"); const files = fs.readdirSync(domainsPath); -// Extract all subdomains from files (without considering specific TLDs) -const validRootDomains = Array.from( - new Set( - files - .map((file) => file.split(".").slice(-3).join(".")) - ) -); +// Arrays to store issues for each test +const noParentIssues = []; +const nsRecordIssues = []; t("Nested subdomains should not exist without a valid parent domain", (t) => { files.forEach((file) => { @@ -30,14 +26,17 @@ t("Nested subdomains should not exist without a valid parent domain", (t) => { const parentSubdomain = subdomain.split(".").slice(-3).join("."); // Ensure the immediate parent subdomain exists in the list of files - t.true( - files.includes(`${parentSubdomain}.json`), - `${file}: Parent domain ${parentSubdomain}.json does not exist` - ); + if (!files.includes(`${parentSubdomain}.json`)) { + noParentIssues.push(`${file}: Parent domain ${parentSubdomain}.json does not exist`); + } } }); - t.pass(); + if (noParentIssues.length > 0) { + t.fail("Issues found (no parent domain):\n" + noParentIssues.join("\n")); + } else { + t.pass(); + } }); t("Nested subdomains should not exist if the parent domain has NS records", (t) => { @@ -62,16 +61,18 @@ t("Nested subdomains should not exist if the parent domain has NS records", (t) const parentDomain = fs.readJsonSync(parentFilePath); // Check if the parent has NS records - t.is( - parentDomain.record.NS, - undefined, - `${file}: Parent domain ${parentSubdomain} has NS records` - ); + if (parentDomain.record.NS !== undefined) { + nsRecordIssues.push(`${file}: Parent domain ${parentSubdomain} has NS records`); + } } else { - t.fail(`${parentSubdomain}.json file does not exist`); + nsRecordIssues.push(`${parentSubdomain}.json file does not exist`); } } }); - t.pass(); + if (nsRecordIssues.length > 0) { + t.fail("Issues found (NS records):\n" + nsRecordIssues.join("\n")); + } else { + t.pass(); + } }); From e4da03b344ef1e80792fd2c4f77e0bd6ef88d31c Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:56:29 -0500 Subject: [PATCH 08/11] Delete domains/_github-pages-challenge-turbomaster95.deva.is-cool.dev.json --- ...challenge-turbomaster95.deva.is-cool.dev.json | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 domains/_github-pages-challenge-turbomaster95.deva.is-cool.dev.json diff --git a/domains/_github-pages-challenge-turbomaster95.deva.is-cool.dev.json b/domains/_github-pages-challenge-turbomaster95.deva.is-cool.dev.json deleted file mode 100644 index 70eb04f2..00000000 --- a/domains/_github-pages-challenge-turbomaster95.deva.is-cool.dev.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "description": "GitHub Pages Verification", - - "domain": "is-cool.dev", - "subdomain": "_github-pages-challenge-turbomaster95.deva", - - "owner": { - "email": "devamidhun.3c.kmbvm@gmail.com" - }, - - "record": { - "TXT": ["759008a19efb434a5fc65df616b307"] - }, - - "proxied": false -} From 0a29fa2b2cce1ed54f848c6f4def0dcfea6d8cf9 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:56:42 -0500 Subject: [PATCH 09/11] Delete domains/mail.deva.is-cool.dev.json --- domains/mail.deva.is-cool.dev.json | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 domains/mail.deva.is-cool.dev.json diff --git a/domains/mail.deva.is-cool.dev.json b/domains/mail.deva.is-cool.dev.json deleted file mode 100644 index e0ed9a61..00000000 --- a/domains/mail.deva.is-cool.dev.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "description": "Mail URL", - - "domain": "is-cool.dev", - "subdomain": "mail.deva", - - "owner": { - "email": "devamidhun.3c.kmbvm@gmail.com" - }, - - "record": { - "MX": ["mx1.improvmx.com", "mx2.improvmx.com"], - "TXT": ["v=spf1 include:spf.improvmx.com ~all"] - }, - - "proxied": false -} From 04ffa8ac1516e1802c4f89f54b1dd3a3a1d49854 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:56:51 -0500 Subject: [PATCH 10/11] Delete domains/play.deva.is-cool.dev.json --- domains/play.deva.is-cool.dev.json | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 domains/play.deva.is-cool.dev.json diff --git a/domains/play.deva.is-cool.dev.json b/domains/play.deva.is-cool.dev.json deleted file mode 100644 index 64c4eda0..00000000 --- a/domains/play.deva.is-cool.dev.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Minecraft server", - - "domain": "is-cool.dev", - "subdomain": "play.deva", - - "owner": { - "email": "devamidhun.3c.kmbvm@gmail.com" - }, - - "record": { - "NS": ["galileo.aternos.org", "columbus.aternos.org"] - } -} From f077dc3c38b0ff02df5d7f21cc54af2d49c22225 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:57:01 -0500 Subject: [PATCH 11/11] Delete domains/tts.deva.is-cool.dev.json --- domains/tts.deva.is-cool.dev.json | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 domains/tts.deva.is-cool.dev.json diff --git a/domains/tts.deva.is-cool.dev.json b/domains/tts.deva.is-cool.dev.json deleted file mode 100644 index 85c1aca6..00000000 --- a/domains/tts.deva.is-cool.dev.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "description": "ttsapi", - - "domain": "is-cool.dev", - "subdomain": "tts.deva", - - "owner": { - "repo": "https://github.com/turbomaster95/turbomaster95.github.io", - "email": "devamidhun.3c.kmbvm@gmail.com" - }, - - "record": { - "CNAME": "48c10554-32ea-4bc5-98f8-5f062b511ad1.id.repl.co" - }, - - "proxied": false -}