Moge-Row commited on
Commit
fa7824a
·
1 Parent(s): 73a43c4

hide tokens from public stats

Browse files
Files changed (1) hide show
  1. internal/handler/keys.go +5 -1
internal/handler/keys.go CHANGED
@@ -71,7 +71,11 @@ func HandleGenKey(w http.ResponseWriter, r *http.Request) {
71
  func HandleStats(w http.ResponseWriter, r *http.Request) {
72
  s.mu.Lock(); defer s.mu.Unlock()
73
  w.Header().Set("Content-Type", "application/json")
74
- json.NewEncoder(w).Encode(s)
 
 
 
 
75
  }
76
 
77
  func HandleSecretReveal(w http.ResponseWriter, r *http.Request) {
 
71
  func HandleStats(w http.ResponseWriter, r *http.Request) {
72
  s.mu.Lock(); defer s.mu.Unlock()
73
  w.Header().Set("Content-Type", "application/json")
74
+ public := make(map[string]interface{})
75
+ for _, v := range s.Keys {
76
+ public[v.Name] = map[string]interface{}{"name": v.Name, "requests": v.Requests}
77
+ }
78
+ json.NewEncoder(w).Encode(map[string]interface{}{"keys": public})
79
  }
80
 
81
  func HandleSecretReveal(w http.ResponseWriter, r *http.Request) {