1
0
mirror of https://github.com/fumiama/yamaih.git synced 2026-06-07 01:10:29 +08:00

feat: add more log

This commit is contained in:
源文雨
2025-03-30 22:22:25 +09:00
parent 81afb1e117
commit 6854500103

View File

@@ -10,16 +10,18 @@ import (
)
func (g *Gemini) handler(w http.ResponseWriter, r *http.Request) {
extractIP(r)
if len(r.URL.Path) <= 1 {
fmt.Println("[ERR]", r.RemoteAddr, "400 Invalid Path", r.URL.String())
http.Error(w, "400 Invalid Path", http.StatusBadRequest)
return
}
k := r.URL.Query().Get("key")
if k == "" {
fmt.Println("[ERR]", r.RemoteAddr, "400 Empty API Key", r.URL.String())
http.Error(w, "400 Empty API Key", http.StatusBadRequest)
return
}
extractIP(r)
v := &Visit{
UserKey: k,
Time: time.Now().UnixMilli(),