fix(portal): bind Active bans to /crowdsec/decisions count (2.2.2)
Some checks are pending
License Headers / check (push) Waiting to run

This commit is contained in:
CyberMind-FR 2026-06-29 17:25:16 +02:00
parent 5e4c0d2dac
commit 877fb9e19a
2 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,11 @@
secubox-portal (2.2.2-1~bookworm1) bookworm; urgency=medium
* fix(ui): 'Active bans' now reflects the live /crowdsec/decisions list
(includes CAPI community blocklist) instead of the local-only
health/summary.active_decisions; hero 'Bans active' kept consistent.
-- Gerald KERMA <devel@cybermind.fr> Mon, 29 Jun 2026 21:00:00 +0200
secubox-portal (2.2.1-1~bookworm1) bookworm; urgency=medium secubox-portal (2.2.1-1~bookworm1) bookworm; urgency=medium
* fix(ui): reskin the portal to the standard SecuBox template — shared * fix(ui): reskin the portal to the standard SecuBox template — shared

View File

@ -355,7 +355,12 @@
} }
function renderBans(h, decisions) { function renderBans(h, decisions) {
const ban = h && h.crowdsec && h.crowdsec.active_decisions; // Prefer the live /crowdsec/decisions list (includes CAPI community
// blocklist), falling back to health/summary's local-only count.
const decList = decisions && Array.isArray(decisions.decisions) ? decisions.decisions
: (Array.isArray(decisions) ? decisions : null);
const ban = decList ? decList.filter(d => (d.type || 'ban') === 'ban').length
: (h && h.crowdsec ? h.crowdsec.active_decisions : null);
const alerts = h && h.crowdsec && h.crowdsec.alerts_today; const alerts = h && h.crowdsec && h.crowdsec.alerts_today;
const wafPct = h && h.waf && h.waf.blocked_pct; const wafPct = h && h.waf && h.waf.blocked_pct;
const wafCls = wafPct == null ? '' : (wafPct >= 25 ? 'crit' : wafPct >= 10 ? 'warn' : 'ok'); const wafCls = wafPct == null ? '' : (wafPct >= 25 ? 'crit' : wafPct >= 10 ? 'warn' : 'ok');
@ -365,6 +370,8 @@
$('t-waf').textContent = wafPct != null ? wafPct + '%' : '—'; $('t-waf').textContent = wafPct != null ? wafPct + '%' : '—';
$('t-waf').className = 'v ' + wafCls; $('t-waf').className = 'v ' + wafCls;
$('t-alerts').textContent = alerts != null ? alerts : '—'; $('t-alerts').textContent = alerts != null ? alerts : '—';
// Keep the hero "Bans active" consistent with the real blocked-IP count.
if (ban != null && $('hero-bans')) $('hero-bans').textContent = ban;
} }
function renderVhosts(d) { function renderVhosts(d) {