Merge branch 'main' into main

This commit is contained in:
Muhammad Usman Baig authored and GitHub committed 2025-01-13 16:59:27 +05:00
commit 513823b364
18 files changed
+290 -155

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
{
"owner": {
"username": "heyjumanji",
"email": "madhuchutiya.unhinge50@silomails.com"
},
"record": {
"TXT": "vc-domain-verify=jumanji.is-a.dev,291766e76a7ab5de1bc7"
}
}
-9
View File
@@ -1,9 +0,0 @@
{
"owner": {
"username": "syedtahseen",
"email": "itxtahseen@gmail.com"
},
"record": {
"TXT": ["vc-domain-verify=n.is-a.dev,8435c76be2d4e8aaa229"]
}
}
+9
View File
@@ -0,0 +1,9 @@
{
"owner": {
"username": "samishoukat12",
"email": "samishoukat12@gmail.com"
},
"record": {
"TXT": "vc-domain-verify=samishoukat.is-a.dev,f7c3cb972c650104d507"
}
}
+1 -1
View File
@@ -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"
}
+9
View File
@@ -0,0 +1,9 @@
{
"owner": {
"username": "mohammadusman666",
"email": "mohammadusman666@gmail.com"
},
"record": {
"CNAME": "portfolio-1cw.pages.dev"
}
}
-9
View File
@@ -1,9 +0,0 @@
{
"owner": {
"username": "syedtahseen",
"email": "itxtahseen@gmail.com"
},
"record": {
"CNAME": "xproject-xi.vercel.app"
}
}
+9
View File
@@ -0,0 +1,9 @@
{
"owner": {
"username": "samishoukat12",
"email": "samishoukat12@gmail.com"
},
"record": {
"CNAME": "dev-samishoukat.vercel.app"
}
}
+10
View File
@@ -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"
}
}
+9
View File
@@ -0,0 +1,9 @@
{
"owner": {
"username": "umer-islam",
"email": "umer.islam474@gmail.com"
},
"record": {
"CNAME": "umerislam.netlify.app"
}
}
+12
View File
@@ -0,0 +1,12 @@
{
"owner": {
"username": "wdhdev",
"email": "william@is-a.dev"
},
"record": {
"URL": "https://william.is-a.dev"
},
"redirect_config": {
"redirect_paths": true
}
}
+9
View File
@@ -0,0 +1,9 @@
{
"owner": {
"username": "Joe50097",
"email": "zcell9500@gmail.com"
},
"record": {
"CNAME": "fungaming-discord-server.netlify.app"
}
}
+1 -1
View File
@@ -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
View File
@@ -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);
-10
View File
@@ -275,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`);
});
});
+53
View File
@@ -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();
});
+4
View File
@@ -0,0 +1,4 @@
[
"is-a-dev",
"wdhdev"
]
File renamed without changes.
+120 -120
View File
@@ -1,120 +1,120 @@
[
"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"
]