geoip and config editor online

This commit is contained in:
2026-05-17 15:38:10 +00:00
parent f4a88035ee
commit 1293bafffa
25 changed files with 1645 additions and 31 deletions
+14 -1
View File
@@ -3,6 +3,7 @@ package handlers
import (
"context"
"net/http"
"strings"
"time"
"crowdsec-dashy/internal/crowdsec"
@@ -33,7 +34,19 @@ func (h *DashboardHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if h.deps.CLIAvailable {
decisions, _ = h.deps.CLI.ListDecisions(ctx, crowdsec.DecisionFilter{Limit: 10})
}
alerts, _ := h.deps.LAPI.ListAlerts(ctx, crowdsec.AlertFilter{Limit: 10})
// Fetch extra so filtering "update :" scenarios still yields 10 real threats.
rawAlerts, _ := h.deps.LAPI.ListAlerts(ctx, crowdsec.AlertFilter{Limit: 50})
var alerts []crowdsec.Alert
for _, a := range rawAlerts {
s := a.Scenario
if strings.HasPrefix(s, "update :") || strings.HasPrefix(s, "update:") {
continue
}
alerts = append(alerts, a)
if len(alerts) == 10 {
break
}
}
h.deps.Renderer.Render(w, "dashboard", DashboardData{
PageData: NewPageData(r, "Dashboard", h.deps.CLIAvailable, h.deps.PollInterval),