Add option to change max playlists shown in UI's sidebar, MaxSidebarPlaylists. Fix #2077

This commit is contained in:
Deluan
2023-02-01 10:21:30 -05:00
parent d683297fa7
commit 128b626ec9
7 changed files with 21 additions and 6 deletions
+1
View File
@@ -44,6 +44,7 @@ func serveIndex(ds model.DataStore, fs fs.FS, shareInfo *model.Share) http.Handl
"baseURL": utils.SanitizeText(strings.TrimSuffix(conf.Server.BaseURL, "/")),
"loginBackgroundURL": utils.SanitizeText(conf.Server.UILoginBackgroundURL),
"welcomeMessage": utils.SanitizeText(conf.Server.UIWelcomeMessage),
"maxSidebarPlaylists": conf.Server.MaxSidebarPlaylists,
"enableTranscodingConfig": conf.Server.EnableTranscodingConfig,
"enableDownloads": conf.Server.EnableDownloads,
"enableFavourites": conf.Server.EnableFavourites,
+11
View File
@@ -94,6 +94,17 @@ var _ = Describe("serveIndex", func() {
Expect(config).To(HaveKeyWithValue("welcomeMessage", "Hello"))
})
It("sets the maxSidebarPlaylists", func() {
conf.Server.MaxSidebarPlaylists = 42
r := httptest.NewRequest("GET", "/index.html", nil)
w := httptest.NewRecorder()
serveIndex(ds, fs, nil)(w, r)
config := extractAppConfig(w.Body.String())
Expect(config).To(HaveKeyWithValue("maxSidebarPlaylists", float64(42)))
})
It("sets the enableTranscodingConfig", func() {
conf.Server.EnableTranscodingConfig = true
r := httptest.NewRequest("GET", "/index.html", nil)