From 5550c2eeeb39ac551b2ec2e02d82b4bd050f14b7 Mon Sep 17 00:00:00 2001 From: tiago <70700766+tiagozip@users.noreply.github.com> Date: Mon, 2 Mar 2026 15:55:21 +0000 Subject: [PATCH] feat: standalone: minor improvements --- server/index.js | 2 +- standalone/public/js/dashboard.js | 9 +++++++-- standalone/src/ratelimit.js | 3 ++- standalone/src/server.js | 9 +++++---- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/server/index.js b/server/index.js index 51437f7..c4d4dfa 100644 --- a/server/index.js +++ b/server/index.js @@ -331,7 +331,7 @@ class Cap extends EventEmitter { }), ); - const isValid = hashes.every((pair) => pair?.[0].startsWith(pair[1])); + const isValid = hashes.every((pair) => pair?.[0]?.startsWith?.(pair[1])); if (!isValid) return { success: false, message: "Invalid solution" }; diff --git a/standalone/public/js/dashboard.js b/standalone/public/js/dashboard.js index 54e96cd..30cbd44 100644 --- a/standalone/public/js/dashboard.js +++ b/standalone/public/js/dashboard.js @@ -8,7 +8,12 @@ const welcomeScreen = document.getElementById("welcomeScreen"); const keyDetail = document.getElementById("keyDetail"); const escapeHtml = (s) => { - return s.replaceAll("<", "<").replaceAll(">", ">"); + return String(s) + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); }; const api = async (method, path, body) => { @@ -508,7 +513,7 @@ async function saveConfig() { if (!name || difficulty < 2 || challengeCount < 1 || saltSize < 7) { showModal( - "Validation Error", + "Validation error", `
Please check your input values. Difficulty must be ≥2, challenge count ≥1, and salt size ≥7.