🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Add `DefaultUIVolume` option. Closes #1679
Deluan1467036efd75
diff --git a/conf/configuration.go b/conf/configuration.goindex 945e21394..f265f3bbe 100644--- a/conf/configuration.go+++ b/conf/configuration.go@@ -49,6 +49,7 @@ type configOptions struct {EnableUserEditing boolDefaultTheme stringDefaultLanguage string+ DefaultUIVolume intEnableCoverAnimation boolGATrackingID stringEnableLogRedacting bool@@ -240,6 +241,7 @@ func init() {viper.SetDefault("enableuserediting", true)viper.SetDefault("defaulttheme", "Dark")viper.SetDefault("defaultlanguage", "")+ viper.SetDefault("defaultuivolume", consts.DefaultUIVolume)viper.SetDefault("enablecoveranimation", true)viper.SetDefault("gatrackingid", "")viper.SetDefault("enablelogredacting", true)diff --git a/consts/consts.go b/consts/consts.goindex 2942de273..0a749d3f8 100644--- a/consts/consts.go+++ b/consts/consts.go@@ -51,6 +51,8 @@ const (PlaceholderAlbumArt = "placeholder.png"PlaceholderAvatar = "logo-192x192.png"+ DefaultUIVolume = 100+DefaultHttpClientTimeOut = 10 * time.SecondDefaultScannerExtractor = "taglib"diff --git a/server/serve_index.go b/server/serve_index.goindex 6ad363a36..5102525df 100644--- a/server/serve_index.go+++ b/server/serve_index.go@@ -39,6 +39,7 @@ func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {"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, ",")),diff --git a/server/serve_index_test.go b/server/serve_index_test.goindex 223309de4..154ec5c72 100644--- a/server/serve_index_test.go+++ b/server/serve_index_test.go@@ -170,6 +170,17 @@ var _ = Describe("serveIndex", func() {Expect(config).To(HaveKeyWithValue("defaultLanguage", "pt"))})+ It("sets the defaultUIVolume", func() {+ conf.Server.DefaultUIVolume = 45+ r := httptest.NewRequest("GET", "/index.html", nil)+ w := httptest.NewRecorder()++ serveIndex(ds, fs)(w, r)++ config := extractAppConfig(w.Body.String())+ Expect(config).To(HaveKeyWithValue("defaultUIVolume", float64(45)))+ })+It("sets the enableCoverAnimation", func() {conf.Server.EnableCoverAnimation = truer := httptest.NewRequest("GET", "/index.html", nil)diff --git a/ui/src/config.js b/ui/src/config.jsindex 97b0d9655..6f2621106 100644--- a/ui/src/config.js+++ b/ui/src/config.js@@ -19,6 +19,7 @@ const defaultConfig = {enableStarRating: true,defaultTheme: 'Dark',defaultLanguage: '',+ defaultUIVolume: 100,enableUserEditing: true,devEnableShare: true,devSidebarPlaylists: true,diff --git a/ui/src/reducers/playerReducer.js b/ui/src/reducers/playerReducer.jsindex f82e48f4f..428be7fcf 100644--- a/ui/src/reducers/playerReducer.js+++ b/ui/src/reducers/playerReducer.js@@ -16,7 +16,7 @@ const initialState = {queue: [],current: {},clear: false,- volume: 0.5, // 50%+ volume: config.defaultUIVolume / 100,savedPlayIndex: 0,}