aboutsummaryrefslogtreecommitdiffstats
path: root/names
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-08 16:10:44 -0700
committerAdam Soltys <[email protected]>2026-10-08 16:10:51 -0700
commitd3a0af140dabdd6b53c1be0532b37f28254633be (patch)
tree07d12a26b9f3557300e728d458b122041f8664b2 /names
parente76d643835c45f6624856850137e71e986315eb0 (diff)
downloadcoinosv3-d3a0af140dabdd6b53c1be0532b37f28254633be.tar.gz
coinosv3-d3a0af140dabdd6b53c1be0532b37f28254633be.zip
Registrar: rateExempt IPs in names-config.json skip the per-minute limits (the operator's own IP while testing sign-ups)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'names')
-rw-r--r--names/server.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/names/server.js b/names/server.js
index a40cff6..9b57ce7 100644
--- a/names/server.js
+++ b/names/server.js
@@ -871,7 +871,11 @@ setInterval(() => { drainWebhooks().catch(() => {}); }, 30_000);
// crude per-IP limiter
const rate = new Map();
const previews = new Map(); // url -> { meta, until }
+// rateExempt: IPs (e.g. the operator's own, while testing sign-ups) the
+// per-minute limits never apply to
+const RATE_EXEMPT = new Set(CFG.rateExempt || []);
function rateOk(ip, limit = 10) {
+ if (RATE_EXEMPT.has(ip)) return true;
const now = Date.now();
const arr = (rate.get(ip) || []).filter((t) => t > now - 60_000);
if (arr.length >= limit) return false;