Add flag to disable Scrobble config in the UI

This commit is contained in:
Deluan
2021-06-10 21:04:26 -04:00
committed by Deluan Quintão
parent a4f91b74d2
commit ffa76bba6a
6 changed files with 60 additions and 0 deletions
+1
View File
@@ -44,6 +44,7 @@ func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {
"devFastAccessCoverArt": conf.Server.DevFastAccessCoverArt,
"enableUserEditing": conf.Server.EnableUserEditing,
"devEnableShare": conf.Server.DevEnableShare,
"devEnableScrobble": conf.Server.DevEnableScrobble,
}
auth := handleLoginFromHeaders(ds, r)
if auth != nil {
+10
View File
@@ -199,6 +199,16 @@ var _ = Describe("serveIndex", func() {
config := extractAppConfig(w.Body.String())
Expect(config).To(HaveKeyWithValue("devEnableShare", false))
})
It("sets the devEnableScrobble", func() {
r := httptest.NewRequest("GET", "/index.html", nil)
w := httptest.NewRecorder()
serveIndex(ds, fs)(w, r)
config := extractAppConfig(w.Body.String())
Expect(config).To(HaveKeyWithValue("devEnableScrobble", false))
})
})
var appConfigRegex = regexp.MustCompile(`(?m)window.__APP_CONFIG__="([^"]*)`)