mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-06-09 14:12:00 +00:00
Merge branch 'main' of https://github.com/felipecalderon/felipe
This commit is contained in:
+8
-45
@@ -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,29 +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.flags,
|
||||
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
|
||||
@@ -78,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)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -92,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] + "."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,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 + ".")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "itsFatlum",
|
||||
"email": "fatlum@lumi.is-a.dev"
|
||||
},
|
||||
"record": {
|
||||
"TXT": "did=did:plc:c6m5rghb7tkmf5isd3pqjpbt"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "Jorge-lopz",
|
||||
"email": "jlpenero2005@gmail.com",
|
||||
"discord": "713831494761840753"
|
||||
},
|
||||
"record": {
|
||||
"TXT": "vc-domain-verify=jorge-lopz.is-a.dev,5bfcd4cedc07714c2319"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "heyjumanji",
|
||||
"email": "madhuchutiya.unhinge50@silomails.com"
|
||||
},
|
||||
"record": {
|
||||
"TXT": "vc-domain-verify=jumanji.is-a.dev,291766e76a7ab5de1bc7"
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "syedtahseen",
|
||||
"email": "itxtahseen@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"TXT": ["vc-domain-verify=n.is-a.dev,8435c76be2d4e8aaa229"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "samishoukat12",
|
||||
"email": "samishoukat12@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"TXT": "vc-domain-verify=samishoukat.is-a.dev,f7c3cb972c650104d507"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "wisauw",
|
||||
"email": "riveross92@gmail.com",
|
||||
"discord": "313046852415258625"
|
||||
},
|
||||
"record": {
|
||||
"TXT": "vc-domain-verify=sebastianriveros.is-a.dev,be3bca98d22aab14d046"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "UsmanBaig001",
|
||||
"email": "usmanbaig1572@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"TXT": "vc-domain-verify=usmanbaig.is-a.dev,c2f96e70ebd3aef5458b"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "abdiopp",
|
||||
"email": "ginnieabdullah007@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "abdi-portfolio.web.app"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
{
|
||||
"description": "Personal website me , Aswin M V",
|
||||
"repo": "https://github.com/AswinArsha/mypersonalwebsite.git",
|
||||
"owner": {
|
||||
"username": "AswinArsha",
|
||||
"email": "aswinmv13@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "tubular-kangaroo-60ad83.netlify.app"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "razelleclaren",
|
||||
"email": "gracela.claren1@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"MX": ["mx1.improvmx.com", "mx2.improvmx.com"],
|
||||
"TXT": "v=spf1 include:spf.improvmx.com ~all"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "frapujgal",
|
||||
"email": "fpujol1989@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "frapujgal.github.io"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "Joe50097",
|
||||
"email": "zcell9500@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "fungaming-discord-server.netlify.app"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"description": "Jorge's Web",
|
||||
"owner": {
|
||||
"username": "Jorge-lopz",
|
||||
"email": "jlpenero2005@gmail.com",
|
||||
"discord": "713831494761840753"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "jorge-lopz.vercel.app"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "JMVS",
|
||||
"email": "jose.veramutka@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "veramutka.com.ar"
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
"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"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "luihh",
|
||||
"email": "luihh@proton.me"
|
||||
},
|
||||
"record": {
|
||||
"URL": "https://luihh.is-a.dev"
|
||||
},
|
||||
"redirect_config": {
|
||||
"custom_paths": {
|
||||
"/github": "https://github.com/luihh",
|
||||
"/twitch": "https://www.twitch.tv/luihh23",
|
||||
"/youtube": "https://www.youtube.com/@Luihh",
|
||||
"/discord": "https://discord.com/users/481268875586174986",
|
||||
"/steam": "https://steamcommunity.com/id/Luihh23",
|
||||
"/paypal": "https://www.paypal.com/paypalme/luihhdev"
|
||||
},
|
||||
"redirect_paths": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"description": "My personal website",
|
||||
"repo": "https://github.com/is-a-dev/docs",
|
||||
"owner": {
|
||||
"username": "ducmanh86",
|
||||
"email": "ducmanh86@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "tranducmanh-info.web.app"
|
||||
},
|
||||
"proxied": true
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "martinvruiz",
|
||||
"email": "martinvruiz10@gmail.com",
|
||||
"discord": "martinvruiz10"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "portfoliomvr.vercel.app"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "mohammadusman666",
|
||||
"email": "mohammadusman666@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "portfolio-1cw.pages.dev"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"description": "tuan.myprofile.dev",
|
||||
"owner": {
|
||||
"username": "tuannguyen2002",
|
||||
"email": "coixaygio107@gmail.com",
|
||||
"discord": "minhtuan9039"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "cname.vercel-dns.com"
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "syedtahseen",
|
||||
"email": "itxtahseen@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "xproject-xi.vercel.app"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +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"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "samishoukat12",
|
||||
"email": "samishoukat12@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "dev-samishoukat.vercel.app"
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,9 @@
|
||||
"email": "sevindaherath@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "sevinda-herath.github.io"
|
||||
"CNAME": "sevinda-herath.github.io",
|
||||
"MX": ["mx.zoho.com", "mx2.zoho.com", "mx3.zoho.com"],
|
||||
"TXT": "v=spf1 include:zohomail.com ~all"
|
||||
},
|
||||
"proxied": true
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"description": "Landing page for suryababu.is-a.dev",
|
||||
"owner": {
|
||||
"username": "suryababu",
|
||||
"email": "suryababu.k.s@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "suryababus.github.io"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "umer-islam",
|
||||
"email": "umer.islam474@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "umerislam.netlify.app"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "UsmanBaig001",
|
||||
"email": "usmanbaig1572@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "usmanbaig-dev.vercel.app"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "wdhdev",
|
||||
"email": "william@is-a.dev"
|
||||
},
|
||||
"record": {
|
||||
"URL": "https://william.is-a.dev"
|
||||
},
|
||||
"redirect_config": {
|
||||
"redirect_paths": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"owner": {
|
||||
"username": "Joe50097",
|
||||
"email": "zcell9500@gmail.com"
|
||||
},
|
||||
"record": {
|
||||
"CNAME": "fungaming-discord-server.netlify.app"
|
||||
}
|
||||
}
|
||||
@@ -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 = {};
|
||||
|
||||
|
||||
+35
-5
@@ -30,12 +30,12 @@ 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);
|
||||
|
||||
const expandReservedDomains = (reserved) => {
|
||||
function expandReservedDomains(reserved) {
|
||||
const expandedList = [...reserved];
|
||||
|
||||
reserved.forEach((item) => {
|
||||
@@ -52,16 +52,36 @@ const 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}"`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
+39
-11
@@ -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}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -237,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`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
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.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);
|
||||
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();
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
[
|
||||
"is-a-dev",
|
||||
"wdhdev"
|
||||
]
|
||||
@@ -1,122 +1,120 @@
|
||||
[
|
||||
"_atproto",
|
||||
"_vercel",
|
||||
"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"
|
||||
]
|
||||
Reference in New Issue
Block a user