mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-04 04:57:37 +03:00
Use defaultDownsamplingFormat in share options
This commit is contained in:
parent
63b4a12a93
commit
364fdfbd8d
6 changed files with 54 additions and 37 deletions
|
@ -36,31 +36,32 @@ func serveIndex(ds model.DataStore, fs fs.FS, shareInfo *model.Share) http.Handl
|
|||
return
|
||||
}
|
||||
appConfig := map[string]interface{}{
|
||||
"version": consts.Version,
|
||||
"firstTime": firstTime,
|
||||
"variousArtistsId": consts.VariousArtistsID,
|
||||
"baseURL": utils.SanitizeText(strings.TrimSuffix(conf.Server.BaseURL, "/")),
|
||||
"loginBackgroundURL": utils.SanitizeText(conf.Server.UILoginBackgroundURL),
|
||||
"welcomeMessage": utils.SanitizeText(conf.Server.UIWelcomeMessage),
|
||||
"enableTranscodingConfig": conf.Server.EnableTranscodingConfig,
|
||||
"enableDownloads": conf.Server.EnableDownloads,
|
||||
"enableFavourites": conf.Server.EnableFavourites,
|
||||
"enableStarRating": conf.Server.EnableStarRating,
|
||||
"defaultTheme": conf.Server.DefaultTheme,
|
||||
"defaultLanguage": conf.Server.DefaultLanguage,
|
||||
"defaultUIVolume": conf.Server.DefaultUIVolume,
|
||||
"enableCoverAnimation": conf.Server.EnableCoverAnimation,
|
||||
"gaTrackingId": conf.Server.GATrackingID,
|
||||
"losslessFormats": strings.ToUpper(strings.Join(consts.LosslessFormats, ",")),
|
||||
"devActivityPanel": conf.Server.DevActivityPanel,
|
||||
"enableUserEditing": conf.Server.EnableUserEditing,
|
||||
"devEnableShare": conf.Server.DevEnableShare,
|
||||
"devSidebarPlaylists": conf.Server.DevSidebarPlaylists,
|
||||
"lastFMEnabled": conf.Server.LastFM.Enabled,
|
||||
"lastFMApiKey": conf.Server.LastFM.ApiKey,
|
||||
"devShowArtistPage": conf.Server.DevShowArtistPage,
|
||||
"listenBrainzEnabled": conf.Server.ListenBrainz.Enabled,
|
||||
"enableReplayGain": conf.Server.EnableReplayGain,
|
||||
"version": consts.Version,
|
||||
"firstTime": firstTime,
|
||||
"variousArtistsId": consts.VariousArtistsID,
|
||||
"baseURL": utils.SanitizeText(strings.TrimSuffix(conf.Server.BaseURL, "/")),
|
||||
"loginBackgroundURL": utils.SanitizeText(conf.Server.UILoginBackgroundURL),
|
||||
"welcomeMessage": utils.SanitizeText(conf.Server.UIWelcomeMessage),
|
||||
"enableTranscodingConfig": conf.Server.EnableTranscodingConfig,
|
||||
"enableDownloads": conf.Server.EnableDownloads,
|
||||
"enableFavourites": conf.Server.EnableFavourites,
|
||||
"enableStarRating": conf.Server.EnableStarRating,
|
||||
"defaultTheme": conf.Server.DefaultTheme,
|
||||
"defaultLanguage": conf.Server.DefaultLanguage,
|
||||
"defaultUIVolume": conf.Server.DefaultUIVolume,
|
||||
"enableCoverAnimation": conf.Server.EnableCoverAnimation,
|
||||
"gaTrackingId": conf.Server.GATrackingID,
|
||||
"losslessFormats": strings.ToUpper(strings.Join(consts.LosslessFormats, ",")),
|
||||
"devActivityPanel": conf.Server.DevActivityPanel,
|
||||
"enableUserEditing": conf.Server.EnableUserEditing,
|
||||
"devEnableShare": conf.Server.DevEnableShare,
|
||||
"devSidebarPlaylists": conf.Server.DevSidebarPlaylists,
|
||||
"lastFMEnabled": conf.Server.LastFM.Enabled,
|
||||
"lastFMApiKey": conf.Server.LastFM.ApiKey,
|
||||
"devShowArtistPage": conf.Server.DevShowArtistPage,
|
||||
"listenBrainzEnabled": conf.Server.ListenBrainz.Enabled,
|
||||
"enableReplayGain": conf.Server.EnableReplayGain,
|
||||
"defaultDownsamplingFormat": conf.Server.DefaultDownsamplingFormat,
|
||||
}
|
||||
if strings.HasPrefix(conf.Server.UILoginBackgroundURL, "/") {
|
||||
appConfig["loginBackgroundURL"] = path.Join(conf.Server.BaseURL, conf.Server.UILoginBackgroundURL)
|
||||
|
|
|
@ -234,6 +234,16 @@ var _ = Describe("serveIndex", func() {
|
|||
Expect(config).To(HaveKeyWithValue("devEnableShare", false))
|
||||
})
|
||||
|
||||
It("sets the defaultDownsamplingFormat", func() {
|
||||
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("defaultDownsamplingFormat", conf.Server.DefaultDownsamplingFormat))
|
||||
})
|
||||
|
||||
It("sets the devSidebarPlaylists", func() {
|
||||
conf.Server.DevSidebarPlaylists = true
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue