From 358682e5f33337c7607df874be1d8c6702f224d7 Mon Sep 17 00:00:00 2001 From: cynfo3000 Date: Mon, 9 Mar 2026 20:31:26 +0100 Subject: [PATCH] fix: Backend platform-aware Agent-Update (nicht mehr hardcoded freebsd) --- backend/api/firmware.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/api/firmware.go b/backend/api/firmware.go index 8d6971f..4212fc9 100644 --- a/backend/api/firmware.go +++ b/backend/api/firmware.go @@ -184,8 +184,20 @@ func (h *Handler) pushAgentUpdate(hub *ws.Hub) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { agentID := r.PathValue("id") - // TODO: Agent-Plattform aus DB lesen; fuer jetzt default freebsd - version, hash, binary, err := h.db.GetLatestFirmware("freebsd") + // Plattform aus Request-Body oder Query-Parameter lesen, default linux + platform := r.URL.Query().Get("platform") + if platform == "" { + var reqBody struct { + Platform string `json:"platform"` + } + body, _ := io.ReadAll(r.Body) + json.Unmarshal(body, &reqBody) + platform = reqBody.Platform + } + if platform == "" { + platform = "linux" + } + version, hash, binary, err := h.db.GetLatestFirmware(platform) if err != nil { writeError(w, http.StatusNotFound, "Keine Firmware verfuegbar") return