mirror of
https://github.com/fumiama/yamaih.git
synced 2026-06-21 19:12:03 +08:00
feat: add more log
This commit is contained in:
@@ -10,16 +10,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (g *Gemini) handler(w http.ResponseWriter, r *http.Request) {
|
func (g *Gemini) handler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
extractIP(r)
|
||||||
if len(r.URL.Path) <= 1 {
|
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)
|
http.Error(w, "400 Invalid Path", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
k := r.URL.Query().Get("key")
|
k := r.URL.Query().Get("key")
|
||||||
if k == "" {
|
if k == "" {
|
||||||
|
fmt.Println("[ERR]", r.RemoteAddr, "400 Empty API Key", r.URL.String())
|
||||||
http.Error(w, "400 Empty API Key", http.StatusBadRequest)
|
http.Error(w, "400 Empty API Key", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
extractIP(r)
|
|
||||||
v := &Visit{
|
v := &Visit{
|
||||||
UserKey: k,
|
UserKey: k,
|
||||||
Time: time.Now().UnixMilli(),
|
Time: time.Now().UnixMilli(),
|
||||||
|
|||||||
Reference in New Issue
Block a user