From 7600774bdda7f52a5dce9bb573a88617973bdd66 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 10 Apr 2025 23:29:58 -0400 Subject: [PATCH 01/10] chore: create testing file --- domains/testingdibbyhot.json | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 domains/testingdibbyhot.json diff --git a/domains/testingdibbyhot.json b/domains/testingdibbyhot.json new file mode 100644 index 000000000..926d664ef --- /dev/null +++ b/domains/testingdibbyhot.json @@ -0,0 +1,29 @@ +{ + "owner": { + "username": "DEV-DIBSTER", + "email": "dibster@danbot.host" + }, + "record": { + "NS": ["teagan.ns.cloudflare.com", "yevgen.ns.cloudflare.com"] + "DS": [ + { + "key_tag": 10684, + "algorithm": 13, + "digest_type": 1, + "digest": "LMFAOSAODASLASDASDASDADADASDASDASDASDASDADASDASDASD" + }, + { + "key_tag": 10684, + "algorithm": 13, + "digest_type": 2, + "digest": "ASDGHJFGDSGASDSSDFASDFFSDFASDASDASDADASDSADSADSADS" + }, + { + "key_tag": 10684, + "algorithm": 13, + "digest_type": 1, + "digest": "LMFAOSAODASLASDASDASDADADASDASDASDASDASDADASDASDASD" + } + ] + } +} From 7a67ce30a34e251b15287f0c8a1f3ac619beb79b Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 10 Apr 2025 23:30:25 -0400 Subject: [PATCH 02/10] chore: fix json --- domains/testingdibbyhot.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domains/testingdibbyhot.json b/domains/testingdibbyhot.json index 926d664ef..684a9f8e4 100644 --- a/domains/testingdibbyhot.json +++ b/domains/testingdibbyhot.json @@ -4,7 +4,7 @@ "email": "dibster@danbot.host" }, "record": { - "NS": ["teagan.ns.cloudflare.com", "yevgen.ns.cloudflare.com"] + "NS": ["teagan.ns.cloudflare.com", "yevgen.ns.cloudflare.com"], "DS": [ { "key_tag": 10684, From a04fcd0e04eaccf6e80c7d145f63a153e9a0ff01 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Fri, 11 Apr 2025 11:34:17 +0800 Subject: [PATCH 03/10] Update testingdibbyhot.json --- domains/testingdibbyhot.json | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/domains/testingdibbyhot.json b/domains/testingdibbyhot.json index 684a9f8e4..07c93504f 100644 --- a/domains/testingdibbyhot.json +++ b/domains/testingdibbyhot.json @@ -1,29 +1,11 @@ { "owner": { "username": "DEV-DIBSTER", + "email": "dibster@danbot.host", "email": "dibster@danbot.host" }, "record": { "NS": ["teagan.ns.cloudflare.com", "yevgen.ns.cloudflare.com"], - "DS": [ - { - "key_tag": 10684, - "algorithm": 13, - "digest_type": 1, - "digest": "LMFAOSAODASLASDASDASDADADASDASDASDASDASDADASDASDASD" - }, - { - "key_tag": 10684, - "algorithm": 13, - "digest_type": 2, - "digest": "ASDGHJFGDSGASDSSDFASDFFSDFASDASDASDADASDSADSADSADS" - }, - { - "key_tag": 10684, - "algorithm": 13, - "digest_type": 1, - "digest": "LMFAOSAODASLASDASDASDADADASDASDASDASDASDADASDASDASD" - } - ] + "NS": ["teagan.ns.cloudflare.com", "yevgen.ns.cloudflare.com"] } } From a0762cc49ce400e48b26b3481d100b9c0214f4eb Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 10 Apr 2025 23:35:12 -0400 Subject: [PATCH 04/10] Update testingdibbyhot.json --- domains/testingdibbyhot.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/domains/testingdibbyhot.json b/domains/testingdibbyhot.json index 07c93504f..a00e7d625 100644 --- a/domains/testingdibbyhot.json +++ b/domains/testingdibbyhot.json @@ -2,10 +2,10 @@ "owner": { "username": "DEV-DIBSTER", "email": "dibster@danbot.host", - "email": "dibster@danbot.host" + "email": "dibster+whyyoucheckingthis@danbot.host" }, "record": { "NS": ["teagan.ns.cloudflare.com", "yevgen.ns.cloudflare.com"], - "NS": ["teagan.ns.cloudflare.com", "yevgen.ns.cloudflare.com"] + "NS": ["mygoatmike.ns.cloudflare.com", "stefsmells.ns.cloudflare.com"] } } From 165500fdba64d64dc53f2c928b4f0cf9aefb4b04 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Fri, 11 Apr 2025 11:41:20 +0800 Subject: [PATCH 05/10] Update json.test.js --- tests/json.test.js | 53 +++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/tests/json.test.js b/tests/json.test.js index 2ebd3bace..aa1cd7f3d 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -36,30 +36,49 @@ const domainsPath = path.resolve("domains"); const files = fs.readdirSync(domainsPath); function findDuplicateKeys(jsonString) { - const duplicateKeys = []; + const duplicateKeys = new Set(); + const objectStack = []; - const stack = []; + const keyRegex = /"(.*?)"\s*:/g; - const obj = JSON.parse(jsonString, (key, value) => { - if (typeof key === "string") { - const current = stack[stack.length - 1]; - if (current) { - if (current[key]) { - duplicateKeys.push(key); + let match; + let currentKeys = {}; + let lastIndex = 0; + + for (let i = 0; i < jsonString.length; i++) { + const char = jsonString[i]; + + // Start of new object + if (char === '{') { + objectStack.push(currentKeys); + currentKeys = {}; + } + + // End of current object + if (char === '}') { + currentKeys = objectStack.pop() || {}; + } + + // Match key if it's at the current index + if (i === lastIndex) { + keyRegex.lastIndex = i; + match = keyRegex.exec(jsonString); + if (match && match.index === i) { + const key = match[1]; + + if (currentKeys[key]) { + duplicateKeys.add(key); } else { - current[key] = true; + currentKeys[key] = true; } + + lastIndex = keyRegex.lastIndex; + i = lastIndex - 1; // skip ahead } } + } - if (typeof value === "object" && value !== null) { - stack.push({}); - } - - return value; - }); - - return [...new Set(duplicateKeys)]; + return [...duplicateKeys]; } async function validateFields(t, obj, fields, file, prefix = "") { From bc619508f289cba3d0563818b445ccd09249d140 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Fri, 11 Apr 2025 11:44:11 +0800 Subject: [PATCH 06/10] Update json.test.js --- tests/json.test.js | 48 +++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/json.test.js b/tests/json.test.js index aa1cd7f3d..12a89133b 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -38,43 +38,43 @@ const files = fs.readdirSync(domainsPath); function findDuplicateKeys(jsonString) { const duplicateKeys = new Set(); const objectStack = []; + const keyMapStack = []; const keyRegex = /"(.*?)"\s*:/g; - let match; - let currentKeys = {}; - let lastIndex = 0; - - for (let i = 0; i < jsonString.length; i++) { + let i = 0; + while (i < jsonString.length) { const char = jsonString[i]; - // Start of new object if (char === '{') { - objectStack.push(currentKeys); - currentKeys = {}; + keyMapStack.push({}); + objectStack.push('{'); + i++; + continue; } - // End of current object if (char === '}') { - currentKeys = objectStack.pop() || {}; + keyMapStack.pop(); + objectStack.pop(); + i++; + continue; } - // Match key if it's at the current index - if (i === lastIndex) { - keyRegex.lastIndex = i; - match = keyRegex.exec(jsonString); - if (match && match.index === i) { - const key = match[1]; + keyRegex.lastIndex = i; + const match = keyRegex.exec(jsonString); + if (match && objectStack.length) { + const key = match[1]; + const currentKeyMap = keyMapStack[keyMapStack.length - 1]; - if (currentKeys[key]) { - duplicateKeys.add(key); - } else { - currentKeys[key] = true; - } - - lastIndex = keyRegex.lastIndex; - i = lastIndex - 1; // skip ahead + if (currentKeyMap[key]) { + duplicateKeys.add(key); + } else { + currentKeyMap[key] = true; } + + i = keyRegex.lastIndex; + } else { + i++; } } From 7879637c2d998b57d63a434129cc22ecf8d471c2 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Fri, 11 Apr 2025 11:46:26 +0800 Subject: [PATCH 07/10] Update json.test.js --- tests/json.test.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/json.test.js b/tests/json.test.js index 12a89133b..5549f37a2 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -37,8 +37,7 @@ const files = fs.readdirSync(domainsPath); function findDuplicateKeys(jsonString) { const duplicateKeys = new Set(); - const objectStack = []; - const keyMapStack = []; + const keyStack = []; const keyRegex = /"(.*?)"\s*:/g; @@ -47,29 +46,27 @@ function findDuplicateKeys(jsonString) { const char = jsonString[i]; if (char === '{') { - keyMapStack.push({}); - objectStack.push('{'); + keyStack.push({}); i++; continue; } if (char === '}') { - keyMapStack.pop(); - objectStack.pop(); + keyStack.pop(); i++; continue; } keyRegex.lastIndex = i; const match = keyRegex.exec(jsonString); - if (match && objectStack.length) { + if (match && match.index === i && keyStack.length > 0) { const key = match[1]; - const currentKeyMap = keyMapStack[keyMapStack.length - 1]; + const currentScope = keyStack[keyStack.length - 1]; - if (currentKeyMap[key]) { + if (currentScope[key]) { duplicateKeys.add(key); } else { - currentKeyMap[key] = true; + currentScope[key] = true; } i = keyRegex.lastIndex; From 3030814092bafcf5db3d731e56daa085ef3bbe1b Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Fri, 11 Apr 2025 11:47:18 +0800 Subject: [PATCH 08/10] Update testingdibbyhot.json --- domains/testingdibbyhot.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/domains/testingdibbyhot.json b/domains/testingdibbyhot.json index a00e7d625..710a5311e 100644 --- a/domains/testingdibbyhot.json +++ b/domains/testingdibbyhot.json @@ -1,11 +1,9 @@ { "owner": { "username": "DEV-DIBSTER", - "email": "dibster@danbot.host", - "email": "dibster+whyyoucheckingthis@danbot.host" + "email": "dibster@danbot.host" }, "record": { - "NS": ["teagan.ns.cloudflare.com", "yevgen.ns.cloudflare.com"], - "NS": ["mygoatmike.ns.cloudflare.com", "stefsmells.ns.cloudflare.com"] + "NS": ["teagan.ns.cloudflare.com", "yevgen.ns.cloudflare.com"] } } From 7483089f9a81b0a80c4fa73d13235af1809b18e1 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Fri, 11 Apr 2025 11:48:14 +0800 Subject: [PATCH 09/10] format --- tests/json.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/json.test.js b/tests/json.test.js index 5549f37a2..4da5b896f 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -45,13 +45,13 @@ function findDuplicateKeys(jsonString) { while (i < jsonString.length) { const char = jsonString[i]; - if (char === '{') { + if (char === "{") { keyStack.push({}); i++; continue; } - if (char === '}') { + if (char === "}") { keyStack.pop(); i++; continue; From 49a1293024d3172c962f1c9d769bee01bdd2f1ef Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Fri, 11 Apr 2025 11:48:42 +0800 Subject: [PATCH 10/10] Delete domains/testingdibbyhot.json --- domains/testingdibbyhot.json | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 domains/testingdibbyhot.json diff --git a/domains/testingdibbyhot.json b/domains/testingdibbyhot.json deleted file mode 100644 index 710a5311e..000000000 --- a/domains/testingdibbyhot.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "owner": { - "username": "DEV-DIBSTER", - "email": "dibster@danbot.host" - }, - "record": { - "NS": ["teagan.ns.cloudflare.com", "yevgen.ns.cloudflare.com"] - } -}