Merge branch 'main' into patch-1

This commit is contained in:
DIBSTER authored and GitHub committed 2024-12-05 17:52:41 -05:00
commit 74c719a7ff
8 files changed
+35 -129

No files matched your search

-14
View File
@@ -1,14 +0,0 @@
{
"domain": "is-cool.dev",
"subdomain": "_discord.kuba",
"owner": {
"email": "pojg77g1@kbb.anonaddy.me"
},
"record": {
"TXT": ["dh=d1e32b265bbdaff2d41ffb2ab88b1f72b03ac45b"]
},
"proxied": false
}
@@ -1,15 +0,0 @@
{
"domain": "is-cool.dev",
"subdomain": "_gh-openprofileproject-o.*.openprofile",
"owner": {
"repo": "https://github.com/openprofileproject/openprofileproject",
"email": "gamerselimiko@gmail.com"
},
"record": {
"TXT": ["457162e38b"]
},
"proxied": false
}
@@ -1,17 +0,0 @@
{
"description": "github verification",
"domain": "is-cool.dev",
"subdomain": "_gh-openprofileproject-o.openprofile",
"owner": {
"repo": "https://github.com/openprofileproject",
"email": "us@openprofile.is-cool.dev"
},
"record": {
"TXT": ["8a7b386784"]
},
"proxied": false
}
@@ -1,17 +0,0 @@
{
"description": "GitHub Pages Verification aryaejoumalai",
"domain": "is-a-fullstack.dev",
"subdomain": "_github-pages-challenge-AryaEjoumalai.aryaejoumalai",
"owner": {
"repo": "https://github.com/AryaEjoumalai/portfolio",
"email": "aryaejoumalai@gmail.com"
},
"record": {
"TXT": ["41503457cf04f54c4a06a300513bd6"]
},
"proxied": false
}
@@ -1,17 +0,0 @@
{
"description": "A website for a developer's profile",
"domain": "is-not-a.dev",
"subdomain": "_github-pages-challenge-Arzejames.wacky",
"owner": {
"repo": "https://github.com/Arzejames/WackyDevWebsite",
"email": "turtles127855@gmail.com"
},
"record": {
"TXT": ["5d4c72dcb4816fc1ff642af38784a2"]
},
"proxied": false
}
@@ -1,17 +0,0 @@
{
"description": "For verifying my domain with github pages",
"domain": "is-cool.dev",
"subdomain": "_github-pages-challenge-axviii3.axviii3",
"owner": {
"repo": "https://github.com/AXVIII3/AXVIII3",
"email": "axviii3.yt@gmail.com"
},
"record": {
"TXT": ["3fa04e63a79eec99f8e37691d660e8"]
},
"proxied": false
}
@@ -1,17 +0,0 @@
{
"description": "Developer Profile",
"domain": "is-local.org",
"subdomain": "_github-pages-challenge-bhavesh-acquaintsoft.bhavesh-acquaintsoft",
"owner": {
"repo": "https://github.com/bhavesh-acquaintsoft/bhavesh-acquaintsoft.github.io",
"email": "bhavesh.kagathara@acquaintsofttech.com"
},
"record": {
"TXT": ["249109ee3609049a56a9a828e4c50f"]
},
"proxied": false
}
+35 -15
View File
@@ -5,7 +5,17 @@ const path = require("path");
const domainsPath = path.resolve("domains");
const files = fs.readdirSync(domainsPath);
/**
* Helper function to determine if a subdomain is a root domain.
* A root domain is assumed to be exactly two parts (e.g., "is-cool.dev").
*/
function isRootDomain(domain) {
return domain.split(".").length === 2;
}
t("Nested subdomains should not exist without a parent subdomain", (t) => {
const issues = [];
files.forEach((file) => {
// Skip directories and process only .json files
const filePath = path.join(domainsPath, file);
@@ -18,19 +28,26 @@ t("Nested subdomains should not exist without a parent subdomain", (t) => {
if (subdomain.split(".").length > 2) {
// Get parent domain by removing the leftmost part
const parentSubdomain = subdomain.split(".").slice(1).join(".");
// Ensure the parent subdomain exists
t.true(
files.includes(`${parentSubdomain}.json`),
`${file}: Parent subdomain ${parentSubdomain}.json does not exist`
);
// Skip check if the parent subdomain is a root domain
if (isRootDomain(parentSubdomain)) {
return;
}
// Check if the parent subdomain exists
if (!files.includes(`${parentSubdomain}.json`)) {
issues.push(`${file}: Parent subdomain ${parentSubdomain}.json does not exist`);
}
}
});
t.pass();
// Report all issues at once
t.deepEqual(issues, [], `Found issues:\n${issues.join("\n")}`);
});
t("Nested subdomains should not exist if the parent subdomain has NS records", (t) => {
const issues = [];
files.forEach((file) => {
// Skip directories and process only .json files
const filePath = path.join(domainsPath, file);
@@ -45,22 +62,25 @@ t("Nested subdomains should not exist if the parent subdomain has NS records", (
const parentSubdomain = subdomain.split(".").slice(1).join(".");
const parentFilePath = path.join(domainsPath, `${parentSubdomain}.json`);
// Skip check if the parent subdomain is a root domain
if (isRootDomain(parentSubdomain)) {
return;
}
// Check if the parent file exists before attempting to read it
if (fs.existsSync(parentFilePath)) {
const parentDomain = fs.readJsonSync(parentFilePath);
// Check if the parent has NS records
t.is(
parentDomain.record.NS,
undefined,
`${file}: Parent subdomain ${parentSubdomain} has NS records`
);
if (parentDomain.record.NS !== undefined) {
issues.push(`${file}: Parent subdomain ${parentSubdomain} has NS records`);
}
} else {
t.fail(`${parentSubdomain}.json file does not exist`);
issues.push(`${file}: Parent subdomain ${parentSubdomain}.json file does not exist`);
}
}
});
t.pass();
// Report all issues at once
t.deepEqual(issues, [], `Found issues:\n${issues.join("\n")}`);
});