1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

chore: introduce heartbeat max age

This commit is contained in:
Ferdinand Mütsch
2022-03-17 11:35:20 +01:00
parent b763c4acc6
commit 8e558d8dee
5 changed files with 21 additions and 1 deletions

View File

@ -86,7 +86,7 @@ func (h *HeartbeatApiHandler) Post(w http.ResponseWriter, r *http.Request) {
hb.UserID = user.ID
hb.UserAgent = userAgent
if !hb.Valid() {
if !hb.Valid() || !hb.Timely(h.config.App.HeartbeatsMaxAge()) {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte("invalid heartbeat object"))
return