fix(subsonic): a scrobble's time is bounded as a native play's is (#8076)
The native events endpoint clamps a client's play time to between the account's creation and a few minutes past now. A Subsonic scrobble took its time as sent, so an app with a wrong clock dated plays years out, onto the wrong day in History and into Rediscover's ordering. The clamp moves to playevents.ClampClientTime and both surfaces use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -192,8 +192,9 @@ func (m *mediaHandlers) handleScrobble(w http.ResponseWriter, r *http.Request) {
|
||||
if ms, err := strconv.ParseInt(t, 10, 64); err == nil {
|
||||
at = time.UnixMilli(ms).UTC()
|
||||
} else if parsed, err := time.Parse(time.RFC3339, t); err == nil {
|
||||
at = parsed
|
||||
at = parsed.UTC()
|
||||
}
|
||||
at = playevents.ClampClientTime(at, user.CreatedAt.Time, time.Now().UTC())
|
||||
}
|
||||
clientID := params.Get("c")
|
||||
source, err := m.recall.sourceFor(r.Context(), dbq.New(m.pool), user.ID, clientID, trackID)
|
||||
|
||||
Reference in New Issue
Block a user