diff --git a/dashboard/server.js b/dashboard/server.js index 717a6fa..93b4539 100644 --- a/dashboard/server.js +++ b/dashboard/server.js @@ -48,7 +48,7 @@ function run(cmd) { function readIgnoreIP() { try { const content = fs.readFileSync(JAIL_LOCAL, 'utf8'); - const match = content.match(/^ignoreip\s*=\s*(.+)$/m); + const match = content.match(/^ignoreip[ \t]*=[ \t]*(.*)$/m); if (!match) return []; return match[1].split(/\s+/).filter(s => s && !s.startsWith('#')); } catch { return []; } @@ -65,7 +65,7 @@ function getWhitelistNote(ip) { async function addWhitelist(ip, note) { const lines = fs.readFileSync(JAIL_LOCAL, 'utf8').split('\n'); for (let i = 0; i < lines.length; i++) { - if (lines[i].trimStart().startsWith('ignoreip') && !lines[i].includes(ip)) { + if (/^ignoreip[ \t]*=/.test(lines[i]) && !lines[i].includes(ip)) { lines[i] = lines[i].trimEnd() + ` ${ip}${note ? ` # ${note}` : ''}\n`; break; }