fix(subsonic): a handler without a caller answers error 50 everywhere (#8002)
Sixteen handlers answered a missing caller with error 50 "Not authenticated"; the star, unstar and scrobble handlers answered error 0 "Unauthenticated". Middleware stops such a request first, so no app saw it, but the next handler copied would pick one at random. requireUser now holds the check, the same shape as /api's, at all 21 sites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -350,18 +350,16 @@ func (b *browseHandlers) listAlbums(w http.ResponseWriter, r *http.Request, q *d
|
||||
FromYear: int32(from), ToYear: int32(to), Lim: int32(size), Off: int32(offset),
|
||||
})
|
||||
case "starred", "highest":
|
||||
user, ok := UserFromContext(r.Context())
|
||||
user, ok := requireUser(w, r)
|
||||
if !ok {
|
||||
WriteFail(w, r, ErrNotAuthorized, "Not authenticated")
|
||||
return nil, false
|
||||
}
|
||||
albums, err = q.ListLikedAlbumRows(r.Context(), dbq.ListLikedAlbumRowsParams{
|
||||
UserID: user.ID, Limit: int32(size), Offset: int32(offset),
|
||||
})
|
||||
case "recent", "frequent":
|
||||
user, ok := UserFromContext(r.Context())
|
||||
user, ok := requireUser(w, r)
|
||||
if !ok {
|
||||
WriteFail(w, r, ErrNotAuthorized, "Not authenticated")
|
||||
return nil, false
|
||||
}
|
||||
if listType == "recent" {
|
||||
|
||||
Reference in New Issue
Block a user