mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-11 00:10:38 -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")
|
||||
timestampStr := r.FormValue("unix") // unix
|
||||
timestampStr := r.FormValue("unix")
|
||||
client := r.FormValue("client")
|
||||
if client == "" {
|
||||
client = defaultClientStr
|
||||
|
|
@ -54,8 +54,8 @@ func SubmitListenWithIDHandler(store db.DB) http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
unix, err := strconv.ParseInt(timestampStr, 10, 64)
|
||||
if err != nil {
|
||||
l.Debug().AnErr("error", err).Msg("SubmitListenWithIDHandler: Invalid track id")
|
||||
if err != nil || time.Now().Unix() < unix {
|
||||
l.Debug().AnErr("error", err).Msg("SubmitListenWithIDHandler: Invalid unix timestamp")
|
||||
utils.WriteError(w, "invalid timestamp", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue