Merge pull request #21750 from is-a-dev/wdhdev-patch-1

require strict parents for every level
This commit is contained in:
William Harrison
2025-04-04 12:25:12 +08:00
committed by GitHub
5 changed files with 33 additions and 21 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
"priority": 0,
"weight": 5,
"port": 32279,
"target": "gold.magmanode.com"
"target": "mc.3gee.is-a.dev"
}
]
}
-11
View File
@@ -1,11 +0,0 @@
{
"description": "api for karyakarsa",
"repo": "https://github.com/WilloIzCitron/karyakarsa-rest-api",
"owner": {
"username": "WilloIzCitron",
"twitter": "willoizcitron"
},
"record": {
"CNAME": "karyakarsa-rest-api-production.up.railway.app"
}
}
+9
View File
@@ -0,0 +1,9 @@
{
"owner": {
"username": "alvinsjoy",
"discord": "825382504353234954"
},
"record": {
"TXT": "Created to allow nested subdomains to exist."
}
}
+9
View File
@@ -0,0 +1,9 @@
{
"owner": {
"username": "3geETR",
"email": "egemacun@gmail.com"
},
"record": {
"CNAME": "gold.magmanode.com"
}
}
+14 -9
View File
@@ -24,26 +24,31 @@ function getDomainData(subdomain) {
t("Nested subdomains should not exist without a parent subdomain", (t) => {
files.forEach((file) => {
const subdomain = file.replace(/\.json$/, "");
const parentDomain = subdomain.split(".").reverse()[0];
const parts = subdomain.split(".");
for (let i = 1; i < parts.length; i++) {
const parent = parts.slice(i).join(".");
if (parent.startsWith("_")) continue;
if (parentDomain !== subdomain) {
t.true(
parentDomain && files.includes(`${parentDomain}.json`),
`${file}: Parent subdomain does not exist`
files.includes(`${parent}.json`),
`${file}: Parent subdomain "${parent}" does not exist`
);
}
});
});
t("Nested subdomains should not exist if the parent subdomain has NS records", (t) => {
t("Nested subdomains should not exist if any parent subdomain has NS records", (t) => {
files.forEach((file) => {
const subdomain = file.replace(/\.json$/, "");
const parentDomain = subdomain.split(".").reverse()[0];
const parts = subdomain.split(".");
if (parentDomain !== subdomain) {
const parentData = getDomainData(parentDomain);
for (let i = 1; i < parts.length; i++) {
const parent = parts.slice(i).join(".");
if (parent.startsWith("_") || !files.includes(`${parent}.json`)) continue;
const parentData = getDomainData(parent);
t.true(!parentData.record.NS, `${file}: Parent subdomain has NS records`);
t.true(!parentData.record.NS, `${file}: Parent subdomain "${parent}" has NS records`);
}
});
});