mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-13 17:40:26 -07:00
fix: ensure timestamp is in the past, log fix
This commit is contained in:
parent
b4ce44c658
commit
52e955b1b6
1 changed files with 3 additions and 3 deletions
|
|
@ -36,7 +36,7 @@ func SubmitListenWithIDHandler(store db.DB) http.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
trackIDStr := r.FormValue("track_id")
|
trackIDStr := r.FormValue("track_id")
|
||||||
timestampStr := r.FormValue("unix") // unix
|
timestampStr := r.FormValue("unix")
|
||||||
client := r.FormValue("client")
|
client := r.FormValue("client")
|
||||||
if client == "" {
|
if client == "" {
|
||||||
client = defaultClientStr
|
client = defaultClientStr
|
||||||
|
|
@ -54,8 +54,8 @@ func SubmitListenWithIDHandler(store db.DB) http.HandlerFunc {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
unix, err := strconv.ParseInt(timestampStr, 10, 64)
|
unix, err := strconv.ParseInt(timestampStr, 10, 64)
|
||||||
if err != nil {
|
if err != nil || time.Now().Unix() < unix {
|
||||||
l.Debug().AnErr("error", err).Msg("SubmitListenWithIDHandler: Invalid track id")
|
l.Debug().AnErr("error", err).Msg("SubmitListenWithIDHandler: Invalid unix timestamp")
|
||||||
utils.WriteError(w, "invalid timestamp", http.StatusBadRequest)
|
utils.WriteError(w, "invalid timestamp", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue