From 85a2d46feb981668aa676e18767bf32a3d752956 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Sat, 5 Sep 2026 15:10:11 -0400 Subject: [PATCH 1/2] chore: adding additional domains to reserved --- util/reserved.json | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/util/reserved.json b/util/reserved.json index a007df5b1b..47e083ea7c 100644 --- a/util/reserved.json +++ b/util/reserved.json @@ -17,6 +17,8 @@ "blog", "bot", "cdn", + "cert", + "certs", "chat", "checkout", "cname", @@ -38,6 +40,7 @@ "example", "file", "files", + "ftp", "get", "git", "github", @@ -51,6 +54,7 @@ "http", "https", "iad", + "imap", "info", "int", "internal", @@ -58,18 +62,21 @@ "is-a-dev", "isa", "isadev", + "legal", "link", "links", + "log", "login", + "logs", "m", "mail", "mailbox", "maintainer", "maintainers", "manage", - "metrics", "mc", "media", + "metrics", "mobile", "net", "network", @@ -84,24 +91,27 @@ "ns8", "ns9", "oauth", + "open", "org", "organisation", "organisations", "organization", "organizations", - "open", "panel", "pay", "payment", "payments", + "pop", + "pop3", "portal", "preview", - "public", + "privacy", "private", "prod", "production", "proxied", "proxy", + "public", "rdap", "redirect", "register", @@ -109,28 +119,36 @@ "registry", "reserved", "root", + "rsync", "secure", "security", + "server", + "servers", "service", "services", + "sftp", "shop", + "smtp", + "srv", + "ssl", "sso", "staff", "staging", "static", "stats", "status", - "server", - "srv", "store", "subdomain", "subdomains", "support", "sys", + "syslog", + "syslogs", "system", "team", "test", "testing", + "tls", "tools", "uptime", "url", From 335496335bc42fad6e09e570a0edabb53986e97c Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Sat, 5 Sep 2026 15:10:22 -0400 Subject: [PATCH 2/2] chore: adding scripts to validate util --- package.json | 4 ++- util/add-reserved-subdomain.cjs | 57 +++++++++++++++++++++++++++++++++ util/check-reserved-order.cjs | 31 ++++++++++++++++++ 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 util/add-reserved-subdomain.cjs create mode 100644 util/check-reserved-order.cjs diff --git a/package.json b/package.json index 18e2a8b0a2..2b5d1b81b9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,9 @@ { "type": "module", "scripts": { - "test": "npx ava tests/*.test.js" + "test": "npx ava tests/*.test.js", + "check:reserved-order": "node util/check-reserved-order.cjs", + "add:reserved": "node util/add-reserved-subdomain.cjs" }, "devDependencies": { "ava": "^8.0.1", diff --git a/util/add-reserved-subdomain.cjs b/util/add-reserved-subdomain.cjs new file mode 100644 index 0000000000..500759cd3b --- /dev/null +++ b/util/add-reserved-subdomain.cjs @@ -0,0 +1,57 @@ +const { readFileSync, writeFileSync } = require("node:fs"); +const { join } = require("node:path"); +const readline = require("node:readline"); + +const filePath = join(__dirname, "reserved.json"); +const prompt = "What subdomain would you want to add to the reserved.json list: "; + +const interface = readline.createInterface({ + input: process.stdin, + output: process.stdout, +}); + +interface.question(prompt, (input) => { + const subdomain = input.trim(); + + if (!subdomain) { + console.error("Subdomain cannot be empty."); + interface.close(); + process.exitCode = 1; + return; + } + + if (subdomain !== subdomain.toLowerCase() || /\s/.test(subdomain)) { + console.error("Subdomain must be lowercase and cannot contain whitespace."); + interface.close(); + process.exitCode = 1; + return; + } + + const fileContents = readFileSync(filePath, "utf8"); + const reserved = JSON.parse(fileContents); + + if (reserved.includes(subdomain)) { + console.error(`"${subdomain}" is already in reserved.json.`); + interface.close(); + process.exitCode = 1; + return; + } + + const insertionIndex = reserved.findIndex( + (entry) => entry > subdomain, + ); + const index = insertionIndex === -1 ? reserved.length : insertionIndex; + reserved.splice(index, 0, subdomain); + + const newline = fileContents.includes("\r\n") ? "\r\n" : "\n"; + const output = `${JSON.stringify(reserved, null, 4)}${newline}`; + writeFileSync(filePath, output); + + const lineNumber = index + 2; + const precedingEntry = index > 0 ? reserved[index - 1] : "["; + const followingEntry = index < reserved.length - 1 ? reserved[index + 1] : "]"; + console.log( + `Added "${subdomain}" on line ${lineNumber}, after "${precedingEntry}" and before "${followingEntry}".`, + ); + interface.close(); +}); \ No newline at end of file diff --git a/util/check-reserved-order.cjs b/util/check-reserved-order.cjs new file mode 100644 index 0000000000..5456ee6c05 --- /dev/null +++ b/util/check-reserved-order.cjs @@ -0,0 +1,31 @@ +const { readFileSync } = require("node:fs"); +const { join } = require("node:path"); + +const filePath = join(__dirname, "reserved.json"); +const fileContents = readFileSync(filePath, "utf8"); +const reserved = JSON.parse(fileContents); + +for (let index = 1; index < reserved.length; index += 1) { + if (reserved[index - 1] > reserved[index]) { + let precedingIndex = index - 1; + + while ( + precedingIndex >= 0 && + reserved[precedingIndex] > reserved[index] + ) { + precedingIndex -= 1; + } + + const precedingLine = precedingIndex + 2; + + console.error( + `reserved.json is not in alphabetical order: line ${index + 2} ("${reserved[index]}") should go after line ${precedingLine} ("${precedingIndex >= 0 ? reserved[precedingIndex] : "["}") and before line ${index + 1} ("${reserved[index - 1]}").`, + ); + process.exitCode = 1; + break; + } +} + +if (process.exitCode !== 1) { + console.log("reserved.json is in alphabetical order."); +} \ No newline at end of file