Frontend: Firewall-Tabelle mit CPU/RAM/Disk/Uptime/Gateways, sortierbar, Slide-in Detail-Panel mit Tabs (Uebersicht, Interfaces, Dienste, VPN, Routen, DHCP, Zertifikate, Backups)

This commit is contained in:
cynfo3000
2026-02-28 16:03:02 +01:00
parent c56fded7d7
commit 616a0cb6ac
5 changed files with 747 additions and 73 deletions
+1
View File
@@ -50,6 +50,7 @@ func (h *Handler) SetupRoutes(mux *http.ServeMux, hub *ws.Hub) {
// User-Routes
mux.HandleFunc("GET /api/v1/users", h.listUsers)
mux.HandleFunc("POST /api/v1/users", h.createUser)
mux.HandleFunc("PUT /api/v1/users/{id}/password", h.changePassword)
mux.HandleFunc("DELETE /api/v1/users/{id}", h.deleteUser)
// WebSocket und Tunnel-Routes
+25
View File
@@ -39,6 +39,31 @@ func (h *Handler) createUser(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusCreated, u)
}
// PUT /api/v1/users/{id}/password
func (h *Handler) changePassword(w http.ResponseWriter, r *http.Request) {
id, err := strconv.Atoi(r.PathValue("id"))
if err != nil {
writeError(w, http.StatusBadRequest, "Ungueltige ID")
return
}
var req struct {
Password string `json:"password"`
}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil || req.Password == "" {
writeError(w, http.StatusBadRequest, "password ist erforderlich")
return
}
if len(req.Password) < 6 {
writeError(w, http.StatusBadRequest, "Passwort muss mindestens 6 Zeichen lang sein")
return
}
if err := h.db.ChangePassword(id, req.Password); err != nil {
writeError(w, http.StatusInternalServerError, "Passwort aendern fehlgeschlagen")
return
}
writeJSON(w, http.StatusOK, map[string]string{"message": "Passwort geaendert"})
}
// DELETE /api/v1/users/{id}
func (h *Handler) deleteUser(w http.ResponseWriter, r *http.Request) {
id, err := strconv.Atoi(r.PathValue("id"))