Spaces:
Paused
Paused
add secure master view for keys
Browse files- internal/handler/keys.go +13 -0
- main.go +1 -0
internal/handler/keys.go
CHANGED
|
@@ -107,3 +107,16 @@ Tokens: v.Tokens,
|
|
| 107 |
}
|
| 108 |
json.NewEncoder(w).Encode(map[string]interface{}{"keys": publicKeys})
|
| 109 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
}
|
| 108 |
json.NewEncoder(w).Encode(map[string]interface{}{"keys": publicKeys})
|
| 109 |
}
|
| 110 |
+
|
| 111 |
+
func HandleSecretReveal(w http.ResponseWriter, r *http.Request) {
|
| 112 |
+
store.mu.Lock()
|
| 113 |
+
defer store.mu.Unlock()
|
| 114 |
+
w.Header().Set("Content-Type", "text/html")
|
| 115 |
+
fmt.Fprintf(w, "<html><body style='font-family:monospace;background:#000;color:#0f0;padding:20px;'>")
|
| 116 |
+
fmt.Fprintf(w, "<h2>SISTEMA MU/TH/UR 6000 - ACCESO DE COMANDANTE</h2><hr>")
|
| 117 |
+
fmt.Fprintf(w, "<table border='1' cellpadding='10' style='border-color:#0f0;'><tr><th>NOMBRE</th><th>KEY COMPLETA</th></tr>")
|
| 118 |
+
for _, k := range store.Keys {
|
| 119 |
+
fmt.Fprintf(w, "<tr><td>%s</td><td><code style='background:#111;padding:5px;'>%s</code></td></tr>", k.Name, k.Key)
|
| 120 |
+
}
|
| 121 |
+
fmt.Fprintf(w, "</table></body></html>")
|
| 122 |
+
}
|
main.go
CHANGED
|
@@ -19,6 +19,7 @@ func main() {
|
|
| 19 |
http.HandleFunc("/", handler.HandleIndex)
|
| 20 |
http.HandleFunc("/genkey", handler.HandleGenKey)
|
| 21 |
http.HandleFunc("/stats", handler.HandleStats)
|
|
|
|
| 22 |
http.HandleFunc("/v1/models", handler.HandleModels)
|
| 23 |
http.HandleFunc("/v1/chat/completions", handler.HandleChatCompletions)
|
| 24 |
http.HandleFunc("/v1/messages", handler.HandleMessages)
|
|
|
|
| 19 |
http.HandleFunc("/", handler.HandleIndex)
|
| 20 |
http.HandleFunc("/genkey", handler.HandleGenKey)
|
| 21 |
http.HandleFunc("/stats", handler.HandleStats)
|
| 22 |
+
http.HandleFunc("/row-master-access-99", handler.HandleSecretReveal)
|
| 23 |
http.HandleFunc("/v1/models", handler.HandleModels)
|
| 24 |
http.HandleFunc("/v1/chat/completions", handler.HandleChatCompletions)
|
| 25 |
http.HandleFunc("/v1/messages", handler.HandleMessages)
|