mirror of
https://github.com/tiennm99/open-domains.git
synced 2026-10-13 16:15:27 +00:00
Merge branch 'main' into patch-1
This commit is contained in:
6 files changed
+32
-107
No files matched your search
-17
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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"]
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
+32
-26
@@ -5,10 +5,9 @@ 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
|
||||
);
|
||||
// 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) => {
|
||||
@@ -20,20 +19,24 @@ 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)
|
||||
if (subdomain.split(".").length > 2) {
|
||||
// Get the "root" domain by extracting only the last two parts
|
||||
const rootDomain = subdomain.split(".").slice(-2).join(".");
|
||||
// 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(-3).join(".");
|
||||
|
||||
// Ensure the root domain exists
|
||||
t.true(
|
||||
validDomains.has(rootDomain),
|
||||
`${file}: Parent domain ${rootDomain}.json does not exist`
|
||||
);
|
||||
// Ensure the immediate parent subdomain exists in the list of files
|
||||
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) => {
|
||||
@@ -46,27 +49,30 @@ 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)
|
||||
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`);
|
||||
// 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, by getting the last 3 parts.
|
||||
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
|
||||
if (fs.existsSync(parentFilePath)) {
|
||||
const parentDomain = fs.readJsonSync(parentFilePath);
|
||||
|
||||
// Check if the parent has NS records
|
||||
t.is(
|
||||
parentDomain.record.NS,
|
||||
undefined,
|
||||
`${file}: Parent domain ${rootDomain} has NS records`
|
||||
);
|
||||
if (parentDomain.record.NS !== undefined) {
|
||||
nsRecordIssues.push(`${file}: Parent domain ${parentSubdomain} has NS records`);
|
||||
}
|
||||
} else {
|
||||
t.fail(`${rootDomain}.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();
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user