feat(ui): add EnableNowPlaying configuration (default true) (#4219)
* Add EnableNowPlaying config option * Return 501 for disabled NowPlaying * chore(tests): remove get_now_playing_route test * Disable now playing events when disabled * fix(tests): add mutex for thread-safe access to scrobble buffer Signed-off-by: Deluan <deluan@navidrome.org> --------- Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
@@ -2,6 +2,7 @@ package tests
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/navidrome/navidrome/model"
|
||||
)
|
||||
@@ -25,6 +26,7 @@ type MockDataStore struct {
|
||||
MockedUserProps model.UserPropsRepository
|
||||
MockedScrobbleBuffer model.ScrobbleBufferRepository
|
||||
MockedRadio model.RadioRepository
|
||||
scrobbleBufferMu sync.Mutex
|
||||
}
|
||||
|
||||
func (db *MockDataStore) Library(ctx context.Context) model.LibraryRepository {
|
||||
@@ -193,6 +195,8 @@ func (db *MockDataStore) Player(ctx context.Context) model.PlayerRepository {
|
||||
}
|
||||
|
||||
func (db *MockDataStore) ScrobbleBuffer(ctx context.Context) model.ScrobbleBufferRepository {
|
||||
db.scrobbleBufferMu.Lock()
|
||||
defer db.scrobbleBufferMu.Unlock()
|
||||
if db.MockedScrobbleBuffer == nil {
|
||||
if db.RealDS != nil {
|
||||
db.MockedScrobbleBuffer = db.RealDS.ScrobbleBuffer(ctx)
|
||||
|
||||
Reference in New Issue
Block a user