diff --git a/main.go b/main.go index 44989b9..85badf9 100644 --- a/main.go +++ b/main.go @@ -184,10 +184,16 @@ func adminHandler(w http.ResponseWriter, r *http.Request) { defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) + // If JSON format requested, return raw API response + if r.URL.Query().Get("format") == "json" { + w.Header().Set("Content-Type", "application/json") + w.Write(body) + return + } + tmpl := template.Must(template.New("admin").Parse(adminHTML)) w.Header().Set("Content-Type", "text/html; charset=utf-8") tmpl.Execute(w, map[string]interface{}{ - "Users": string(body), "ApiError": resp.StatusCode != 200, }) @@ -355,7 +361,9 @@ const adminHTML = ` .btn-primary:hover { background: #2d3748; } input, select { padding: 0.4rem 0.6rem; border: 1px solid #e2e8f0; border-radius: 4px; font-size: 0.9rem; margin-right: 0.5rem; } .form-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; } + .success { background: #c6f6d5; color: #276749; padding: 0.75rem; border-radius: 6px; margin-bottom: 1rem; } .error { background: #fed7d7; color: #c53030; padding: 0.75rem; border-radius: 6px; margin-bottom: 1rem; } + .password-box { background: #1a1a2e; color: #63b3ed; padding: 0.75rem; border-radius: 4px; font-family: monospace; margin-top: 0.5rem; }
@@ -373,7 +381,6 @@ const adminHTML = ` -