From 445eb031d34c89cb599a105acb9bf9eab541f4a6 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Sun, 13 Apr 2025 16:21:13 -0400 Subject: [PATCH 1/5] chore: spelling mistake --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 95f66629..7285fdb9 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -5,7 +5,7 @@ - [x] The website is reachable. - [x] The CNAME record doesn't contain `https://` or `/`. - [x] There is sufficient information at the `owner` field. -- [x] There is no NS Records (Enforced as of Sepetember 4th, 2024) +- [x] There is no NS Records (Enforced as of September 4th, 2024) ## Description From 5fd170a9b7a3a17e441a50a56188f1de011293e8 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Sun, 13 Apr 2025 16:21:49 -0400 Subject: [PATCH 2/5] chore: actual checklist --- .github/PULL_REQUEST_TEMPLATE.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7285fdb9..aa36c5ed 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,11 +1,11 @@ ## Requirements -- [x] You have completed your website. -- [x] The website is reachable. -- [x] The CNAME record doesn't contain `https://` or `/`. -- [x] There is sufficient information at the `owner` field. -- [x] There is no NS Records (Enforced as of September 4th, 2024) +- [ ] You have completed your website. +- [ ] The website is reachable. +- [ ] The CNAME record doesn't contain `https://` or `/`. +- [ ] There is sufficient information at the `owner` field. +- [ ] There is no NS Records (Enforced as of September 4th, 2024) ## Description From 02f06767c09e72817ae8cf1234e79a446ded7eb8 Mon Sep 17 00:00:00 2001 From: Shadow Gaming <81495140+ShadowGaming100@users.noreply.github.com> Date: Sun, 13 Apr 2025 22:26:27 +0100 Subject: [PATCH 3/5] Update and rename wisard-gaming.is-not-a.dev.json to ram-llc.is-local.org.json --- domains/ram-llc.is-local.org.json | 17 +++++++++++++++++ domains/wisard-gaming.is-not-a.dev.json | 15 --------------- 2 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 domains/ram-llc.is-local.org.json delete mode 100644 domains/wisard-gaming.is-not-a.dev.json diff --git a/domains/ram-llc.is-local.org.json b/domains/ram-llc.is-local.org.json new file mode 100644 index 00000000..3a9a9901 --- /dev/null +++ b/domains/ram-llc.is-local.org.json @@ -0,0 +1,17 @@ +{ + "description": "", + + "domain": "is-local.org", + "subdomain": "ram-llc", + + "owner": { + "repo": "https://github.com/ShadowGaming100", + "email": "workspace.shadowgaming@gmail.com" + }, + + "record": { + "NS": ["darwin.ns.cloudflare.com", "mallory.ns.cloudflare.com"] + }, + + "proxied": false +} diff --git a/domains/wisard-gaming.is-not-a.dev.json b/domains/wisard-gaming.is-not-a.dev.json deleted file mode 100644 index 8bfeb0ba..00000000 --- a/domains/wisard-gaming.is-not-a.dev.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "description": "", - "domain": "is-not-a.dev", - "subdomain": "wisard-gaming", - "owner": { - "repo": "https://github.com/ShadowGaming100" - }, - "record": { - "NS": [ - "darwin.ns.cloudflare.com", - "mallory.ns.cloudflare.com" - ] - }, - "proxied": false -} \ No newline at end of file From 7fcf329fad1ec5b215a8970565e6d0ab77334c64 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Sun, 13 Apr 2025 23:57:32 +0000 Subject: [PATCH 4/5] feat: more test cases --- tests/json.test.js | 93 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/tests/json.test.js b/tests/json.test.js index c3274b6e..3c6b6434 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -11,6 +11,11 @@ const optionalOwnerFields = { email: "string" }; +const ignoredRootJSONFiles = ["package-lock.json", "package.json"]; + + +const domains = [".is-a-fullstack.dev", ".is-cool.dev", ".is-local.org", ".is-not-a.dev", ".localplayer.dev"]; + 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}$/; @@ -41,6 +46,24 @@ function validateOptionalFields(t, obj, optionalFields, file) { }); } +t("All JSON files must be valid JSON", (t) => { + const files = fs.readdirSync(domainsPath).filter(file => { + const filePath = path.join(domainsPath, file); + return file.endsWith(".json") && fs.lstatSync(filePath).isFile(); + }); + + files.forEach(file => { + const filePath = path.join(domainsPath, file); + try { + const data = fs.readFileSync(filePath, "utf8"); + JSON.parse(data); + t.pass(`${file} is valid JSON`); + } catch (err) { + t.fail(`${file} contains invalid JSON: ${err.message}`); + } + }); +}); + t("All files should have the required fields", (t) => { const files = fs.readdirSync(domainsPath).filter(file => { const filePath = path.join(domainsPath, file); @@ -73,3 +96,73 @@ t("All files should have valid optional owner fields", (t) => { } }); }); + +t("All files should have lowercase subdomain/domain and match filename", (t) => { + const files = fs.readdirSync(domainsPath).filter(file => { + const filePath = path.join(domainsPath, file); + return file.endsWith(".json") && fs.lstatSync(filePath).isFile(); + }); + + files.forEach(file => { + const filePath = path.join(domainsPath, file); + const data = fs.readJsonSync(filePath); + + const { subdomain, domain } = data; + + t.truthy(subdomain, `${file}: Missing subdomain field`); + t.truthy(domain, `${file}: Missing domain field`); + + t.is(subdomain, subdomain.toLowerCase(), `${file}: 'subdomain' must be lowercase`); + t.is(domain, domain.toLowerCase(), `${file}: 'domain' must be lowercase`); + + const expectedFileName = `${subdomain}.${domain}.json`; + t.is(file, expectedFileName, `${file}: Filename does not match subdomain and domain`); + }); +}); + +t("All files should use a valid root domain", (t) => { + const files = fs.readdirSync(domainsPath).filter(file => { + const filePath = path.join(domainsPath, file); + return file.endsWith(".json") && fs.lstatSync(filePath).isFile(); + }); + + files.forEach(file => { + const data = fs.readJsonSync(path.join(domainsPath, file)); + const domain = data.domain; + + t.truthy(domain, `${file}: Missing domain field`); + t.true( + domains.includes(`.${domain}`), + `${file}: Domain '${domain}' is not in the list of allowed domains` + ); + }); +}); + + +// Thanks is-a.dev for this. +t("JSON files should not be in the root directory", (t) => { + const rootFiles = fs + .readdirSync(path.resolve()) + .filter((file) => file.endsWith(".json") && !ignoredRootJSONFiles.includes(file)); + + if (rootFiles.length > 0) { + t.fail(`❌ JSON files should not be in the root directory: ${rootFiles.join(", ")}`); + } else { + t.pass(); + } +}); + +t("All files in the domains directory must have a .json extension", (t) => { + const files = fs.readdirSync(domainsPath).filter(file => { + const filePath = path.join(domainsPath, file); + return fs.lstatSync(filePath).isFile(); + }); + + const nonJsonFiles = files.filter(file => !file.endsWith(".json")); + + if (nonJsonFiles.length > 0) { + t.fail(`❌ Found non-JSON files in domains directory: ${nonJsonFiles.join(", ")}`); + } else { + t.pass(); + } +}); \ No newline at end of file From 4b5a641d4e76ae861c5658b915da037a374722a8 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Sun, 13 Apr 2025 20:03:18 -0400 Subject: [PATCH 5/5] chore: more conditions for template --- .github/PULL_REQUEST_TEMPLATE.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index aa36c5ed..a71a5642 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,6 +6,8 @@ - [ ] The CNAME record doesn't contain `https://` or `/`. - [ ] There is sufficient information at the `owner` field. - [ ] There is no NS Records (Enforced as of September 4th, 2024) +- [ ] I fully accept and undestand the [Terms of Service](https://github.com/open-domains/register/blob/main/terms.md) outline when using this service. +- [ ] I understand that if these requirements are not met my pull request will be closed. ## Description