feat: Agent zeigt Warnung wenn er nicht den Kunden-Key nutzt

- last_api_key Spalte in agents, wird bei Heartbeat gesetzt
- GetAgentsByCustomer liefert last_api_key mit
- Frontend: rot + Warnsymbol wenn Key abweicht vom Kunden-Agent-Key
- Grau wenn noch kein Heartbeat mit Key-Info
This commit is contained in:
cynfo3000
2026-03-10 00:23:59 +01:00
parent 20a976767b
commit 4023a14fe1
4 changed files with 40 additions and 13 deletions
+5
View File
@@ -252,6 +252,11 @@ func (h *Handler) heartbeat(w http.ResponseWriter, r *http.Request) {
h.db.UpdateAgentVersion(req.AgentID, req.AgentVersion)
}
// Genutzten API-Key speichern (aus Middleware-Kontext)
if keyInfo := GetAPIKeyFromContext(r); keyInfo != nil {
h.db.UpdateAgentAPIKey(req.AgentID, keyInfo.Key)
}
if err := h.db.SaveSystemData(req.AgentID, &req.SystemData); err != nil {
if strings.Contains(err.Error(), "nicht gefunden") {
writeError(w, http.StatusNotFound, "Agent nicht gefunden")