Moge-Row commited on
Commit
68d3540
·
verified ·
1 Parent(s): 00db127

Update internal/handler/keys.go

Browse files
Files changed (1) hide show
  1. internal/handler/keys.go +4 -4
internal/handler/keys.go CHANGED
@@ -106,8 +106,7 @@ func HandleStats(w http.ResponseWriter, r *http.Request) {
106
  s.mu.Lock(); defer s.mu.Unlock()
107
  w.Header().Set("Content-Type", "application/json")
108
  public := make(map[string]interface{})
109
- for k, v := range s.Keys {
110
- // k aquí es "NOMBRE:KEY", usamos v.Name para las estadísticas públicas
111
  public[v.Name] = map[string]interface{}{"name": v.Name, "requests": v.Requests}
112
  }
113
  json.NewEncoder(w).Encode(map[string]interface{}{"keys": public})
@@ -118,7 +117,8 @@ func HandleSecretReveal(w http.ResponseWriter, r *http.Request) {
118
  s.mu.Lock(); defer s.mu.Unlock()
119
  w.Header().Set("Content-Type", "text/html")
120
  w.Write([]byte("<body style='background:#000;color:#0f0;font-family:monospace;'>"))
121
- for compositeKey, k := range s.Keys {
122
  w.Write([]byte("<p>" + compositeKey + "</p>"))
123
  }
124
- w.Write([]byte("</body>"))
 
 
106
  s.mu.Lock(); defer s.mu.Unlock()
107
  w.Header().Set("Content-Type", "application/json")
108
  public := make(map[string]interface{})
109
+ for _, v := range s.Keys {
 
110
  public[v.Name] = map[string]interface{}{"name": v.Name, "requests": v.Requests}
111
  }
112
  json.NewEncoder(w).Encode(map[string]interface{}{"keys": public})
 
117
  s.mu.Lock(); defer s.mu.Unlock()
118
  w.Header().Set("Content-Type", "text/html")
119
  w.Write([]byte("<body style='background:#000;color:#0f0;font-family:monospace;'>"))
120
+ for compositeKey := range s.Keys {
121
  w.Write([]byte("<p>" + compositeKey + "</p>"))
122
  }
123
+ w.Write([]byte("</body>"))
124
+ }