Add config option to set default theme

This commit is contained in:
Deluan
2021-04-18 13:51:00 -04:00
parent b6f525bda5
commit f63a912341
6 changed files with 36 additions and 4 deletions
+3 -2
View File
@@ -40,11 +40,12 @@ func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {
"loginBackgroundURL": policy.Sanitize(conf.Server.UILoginBackgroundURL),
"welcomeMessage": policy.Sanitize(conf.Server.UIWelcomeMessage),
"enableTranscodingConfig": conf.Server.EnableTranscodingConfig,
"gaTrackingId": conf.Server.GATrackingID,
"enableDownloads": conf.Server.EnableDownloads,
"enableFavourites": conf.Server.EnableFavourites,
"losslessFormats": strings.ToUpper(strings.Join(consts.LosslessFormats, ",")),
"enableStarRating": conf.Server.EnableStarRating,
"defaultTheme": conf.Server.DefaultTheme,
"gaTrackingId": conf.Server.GATrackingID,
"losslessFormats": strings.ToUpper(strings.Join(consts.LosslessFormats, ",")),
"devActivityPanel": conf.Server.DevActivityPanel,
"devFastAccessCoverArt": conf.Server.DevFastAccessCoverArt,
}
+11
View File
@@ -147,6 +147,17 @@ var _ = Describe("serveIndex", func() {
Expect(config).To(HaveKeyWithValue("enableStarRating", true))
})
It("sets the defaultTheme", func() {
conf.Server.DefaultTheme = "Light"
r := httptest.NewRequest("GET", "/index.html", nil)
w := httptest.NewRecorder()
serveIndex(ds, fs)(w, r)
config := extractAppConfig(w.Body.String())
Expect(config).To(HaveKeyWithValue("defaultTheme", "Light"))
})
It("sets the gaTrackingId", func() {
conf.Server.GATrackingID = "UA-12345"
r := httptest.NewRequest("GET", "/index.html", nil)