From 659b4d0e60556b05d5c7ec05a4e6b2c7e8e54466 Mon Sep 17 00:00:00 2001 From: Zhe Fang Date: Sat, 10 Jan 2026 13:19:39 -0500 Subject: [PATCH 1/5] Create plugins-registry.json --- Community/plugins-registry.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 Community/plugins-registry.json diff --git a/Community/plugins-registry.json b/Community/plugins-registry.json new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Community/plugins-registry.json @@ -0,0 +1 @@ + From 5082c4c24506dc9f3ba8c6754261ef036af20134 Mon Sep 17 00:00:00 2001 From: Zhe Fang Date: Sat, 10 Jan 2026 13:20:59 -0500 Subject: [PATCH 2/5] Create check-hash-collision.js --- Community/scripts/check-hash-collision.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 Community/scripts/check-hash-collision.js diff --git a/Community/scripts/check-hash-collision.js b/Community/scripts/check-hash-collision.js new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Community/scripts/check-hash-collision.js @@ -0,0 +1 @@ + From 0513c3a1288412caa49164008300753dc1033f99 Mon Sep 17 00:00:00 2001 From: Zhe Fang Date: Sat, 10 Jan 2026 13:22:32 -0500 Subject: [PATCH 3/5] Add GitHub Actions workflow for plugin registry check --- .github/workflows/plugin-registry-check.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/plugin-registry-check.yml diff --git a/.github/workflows/plugin-registry-check.yml b/.github/workflows/plugin-registry-check.yml new file mode 100644 index 0000000..e89fb66 --- /dev/null +++ b/.github/workflows/plugin-registry-check.yml @@ -0,0 +1,20 @@ +name: Plugin Registry Check + +on: + pull_request: + paths: + - 'Community/plugins-registry.json' + +jobs: + check-collision: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Run Hash Collision Check + run: node Community/scripts/check-hash-collision.js From 9d2e245a999e2bc9350e90a0345b06e7dca57e72 Mon Sep 17 00:00:00 2001 From: Zhe Fang Date: Sat, 10 Jan 2026 13:25:17 -0500 Subject: [PATCH 4/5] Rename releases-to-discord.yml to release-to-discord.yml --- .../workflows/{releases-to-discord.yml => release-to-discord.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{releases-to-discord.yml => release-to-discord.yml} (100%) diff --git a/.github/workflows/releases-to-discord.yml b/.github/workflows/release-to-discord.yml similarity index 100% rename from .github/workflows/releases-to-discord.yml rename to .github/workflows/release-to-discord.yml From 2b3169e5f62f63ed75739536681ee95201fd4154 Mon Sep 17 00:00:00 2001 From: Zhe Fang Date: Sat, 10 Jan 2026 13:32:08 -0500 Subject: [PATCH 5/5] Update check-hash-collision.js --- Community/scripts/check-hash-collision.js | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Community/scripts/check-hash-collision.js b/Community/scripts/check-hash-collision.js index 8b13789..fe64853 100644 --- a/Community/scripts/check-hash-collision.js +++ b/Community/scripts/check-hash-collision.js @@ -1 +1,40 @@ +// Community/scripts/check-hash-collision.js +const fs = require('fs'); +const path = require('path'); +const registryPath = path.join(__dirname, '../plugins-registry.json'); +const registry = JSON.parse(fs.readFileSync(registryPath, 'utf8')); + +function getStableId(pluginId) { + let hash = 23; + for (let i = 0; i < pluginId.length; i++) { + hash = (hash * 31 + pluginId.charCodeAt(i)) | 0; + } + return Math.abs(hash) + 1000; +} + +const seenIds = new Set(); +let hasError = false; + +console.log("🔍 Starting to check for plugin ID conflicts..."); + +registry.forEach(item => { + const stableId = getStableId(item.id); + + console.log(`Checking [${item.id}] -> Hash: ${stableId}`); + + if (seenIds.has(stableId)) { + console.error(`⛔ Fatel error! Conflict detected!`); + console.error(`The hash value (${stableId}) calculated from the plugin ID [${item.id}] is duplicated with an existing plugin.`); + hasError = true; + } + seenIds.add(stableId); +}); + +if (hasError) { + console.log("⛔ Check failed, please change the plugin ID."); + process.exit(1); +} else { + console.log("✅ The check passed; no conflicts were found."); + process.exit(0); +}