🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Rename ListenBrainz config flag and enable by default (#1443)
Steve Richter3bd6f82c804b
diff --git a/cmd/root.go b/cmd/root.goindex 238042c5e..dcb75ca60 100644--- a/cmd/root.go+++ b/cmd/root.go@@ -80,7 +80,7 @@ func startServer() (func() error, func(err error)) {if conf.Server.LastFM.Enabled {a.MountRouter("LastFM Auth", consts.URLPathNativeAPI+"/lastfm", CreateLastFMRouter())}- if conf.Server.DevListenBrainzEnabled {+ if conf.Server.ListenBrainz.Enabled {a.MountRouter("ListenBrainz Auth", consts.URLPathNativeAPI+"/listenbrainz", CreateListenBrainzRouter())}return a.Run(fmt.Sprintf("%s:%d", conf.Server.Address, conf.Server.Port))diff --git a/conf/configuration.go b/conf/configuration.goindex 9f33472f0..c4f9ba61c 100644--- a/conf/configuration.go+++ b/conf/configuration.go@@ -59,9 +59,10 @@ type configOptions struct {Scanner scannerOptions- Agents string- LastFM lastfmOptions- Spotify spotifyOptions+ Agents string+ LastFM lastfmOptions+ Spotify spotifyOptions+ ListenBrainz listenBrainzOptions// DevFlags. These are used to enable/disable debugging and incomplete featuresDevLogSourceLine bool@@ -75,7 +76,6 @@ type configOptions struct {DevSidebarPlaylists boolDevEnableBufferedScrobble boolDevShowArtistPage bool- DevListenBrainzEnabled bool}type scannerOptions struct {@@ -95,6 +95,10 @@ type spotifyOptions struct {Secret string}+type listenBrainzOptions struct {+ Enabled bool+}+var (Server = &configOptions{}hooks []func()@@ -153,10 +157,10 @@ func disableExternalServices() {log.Info("All external integrations are DISABLED!")Server.LastFM.Enabled = falseServer.Spotify.ID = ""+ Server.ListenBrainz.Enabled = falseif Server.UILoginBackgroundURL == consts.DefaultUILoginBackgroundURL {Server.UILoginBackgroundURL = consts.DefaultUILoginBackgroundURLOffline}- Server.DevListenBrainzEnabled = false}func validateScanSchedule() error {@@ -246,6 +250,7 @@ func init() {viper.SetDefault("lastfm.secret", consts.LastFMAPISecret)viper.SetDefault("spotify.id", "")viper.SetDefault("spotify.secret", "")+ viper.SetDefault("listenbrainz.enabled", true)// DevFlags. These are used to enable/disable debugging and incomplete featuresviper.SetDefault("devlogsourceline", false)@@ -258,7 +263,6 @@ func init() {viper.SetDefault("devenablebufferedscrobble", true)viper.SetDefault("devsidebarplaylists", true)viper.SetDefault("devshowartistpage", true)- viper.SetDefault("devlistenbrainzenabled", false)}func InitConfig(cfgFile string) {diff --git a/core/agents/listenbrainz/agent.go b/core/agents/listenbrainz/agent.goindex bb699a8a1..05b80be38 100644--- a/core/agents/listenbrainz/agent.go+++ b/core/agents/listenbrainz/agent.go@@ -104,7 +104,7 @@ func (l *listenBrainzAgent) IsAuthorized(ctx context.Context, userId string) boofunc init() {conf.AddHook(func() {- if conf.Server.DevListenBrainzEnabled {+ if conf.Server.ListenBrainz.Enabled {scrobbler.Register(listenBrainzAgentName, func(ds model.DataStore) scrobbler.Scrobbler {return listenBrainzConstructor(ds)})diff --git a/server/serve_index.go b/server/serve_index.goindex e2f8a5ca0..399dde1ee 100644--- a/server/serve_index.go+++ b/server/serve_index.go@@ -49,7 +49,7 @@ func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {"lastFMEnabled": conf.Server.LastFM.Enabled,"lastFMApiKey": conf.Server.LastFM.ApiKey,"devShowArtistPage": conf.Server.DevShowArtistPage,- "devListenBrainzEnabled": conf.Server.DevListenBrainzEnabled,+ "listenBrainzEnabled": conf.Server.ListenBrainz.Enabled,}auth := handleLoginFromHeaders(ds, r)if auth != nil {diff --git a/server/serve_index_test.go b/server/serve_index_test.goindex 6b04e62b3..00bd88eaa 100644--- a/server/serve_index_test.go+++ b/server/serve_index_test.go@@ -266,15 +266,15 @@ var _ = Describe("serveIndex", func() {Expect(config).To(HaveKeyWithValue("devShowArtistPage", true))})- It("sets the devListenBrainzEnabled", func() {- conf.Server.DevListenBrainzEnabled = true+ It("sets the listenBrainzEnabled", func() {+ conf.Server.ListenBrainz.Enabled = truer := httptest.NewRequest("GET", "/index.html", nil)w := httptest.NewRecorder()serveIndex(ds, fs)(w, r)config := extractAppConfig(w.Body.String())- Expect(config).To(HaveKeyWithValue("devListenBrainzEnabled", true))+ Expect(config).To(HaveKeyWithValue("listenBrainzEnabled", true))})})diff --git a/ui/src/config.js b/ui/src/config.jsindex 965f26ae7..18ad34997 100644--- a/ui/src/config.js+++ b/ui/src/config.js@@ -23,9 +23,9 @@ const defaultConfig = {devSidebarPlaylists: true,lastFMEnabled: true,lastFMApiKey: '9b94a5515ea66b2da3ec03c12300327e',+ listenBrainzEnabled: true,enableCoverAnimation: true,devShowArtistPage: true,- devListenBrainzEnabled: true,}let configdiff --git a/ui/src/personal/Personal.js b/ui/src/personal/Personal.jsindex 7bee5dbbe..86cea55c5 100644--- a/ui/src/personal/Personal.js+++ b/ui/src/personal/Personal.js@@ -26,7 +26,7 @@ const Personal = () => {<SelectDefaultView /><NotificationsToggle />{config.lastFMEnabled && <LastfmScrobbleToggle />}- {config.devListenBrainzEnabled && <ListenBrainzScrobbleToggle />}+ {config.listenBrainzEnabled && <ListenBrainzScrobbleToggle />}</SimpleForm></Card>)diff --git a/ui/src/player/PlayerEdit.js b/ui/src/player/PlayerEdit.jsindex 58a695cbe..60cff0a74 100644--- a/ui/src/player/PlayerEdit.js+++ b/ui/src/player/PlayerEdit.js@@ -48,7 +48,7 @@ const PlayerEdit = (props) => (]}/><BooleanInput source="reportRealPath" fullWidth />- {(config.lastFMEnabled || config.devListenBrainzEnabled) && (+ {(config.lastFMEnabled || config.listenBrainzEnabled) && (<BooleanInput source="scrobbleEnabled" fullWidth />)}<TextField source="client" />