Add DefaultUIVolume option. Closes #1679
This commit is contained in:
@@ -49,6 +49,7 @@ type configOptions struct {
|
|||||||
EnableUserEditing bool
|
EnableUserEditing bool
|
||||||
DefaultTheme string
|
DefaultTheme string
|
||||||
DefaultLanguage string
|
DefaultLanguage string
|
||||||
|
DefaultUIVolume int
|
||||||
EnableCoverAnimation bool
|
EnableCoverAnimation bool
|
||||||
GATrackingID string
|
GATrackingID string
|
||||||
EnableLogRedacting bool
|
EnableLogRedacting bool
|
||||||
@@ -240,6 +241,7 @@ func init() {
|
|||||||
viper.SetDefault("enableuserediting", true)
|
viper.SetDefault("enableuserediting", true)
|
||||||
viper.SetDefault("defaulttheme", "Dark")
|
viper.SetDefault("defaulttheme", "Dark")
|
||||||
viper.SetDefault("defaultlanguage", "")
|
viper.SetDefault("defaultlanguage", "")
|
||||||
|
viper.SetDefault("defaultuivolume", consts.DefaultUIVolume)
|
||||||
viper.SetDefault("enablecoveranimation", true)
|
viper.SetDefault("enablecoveranimation", true)
|
||||||
viper.SetDefault("gatrackingid", "")
|
viper.SetDefault("gatrackingid", "")
|
||||||
viper.SetDefault("enablelogredacting", true)
|
viper.SetDefault("enablelogredacting", true)
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ const (
|
|||||||
PlaceholderAlbumArt = "placeholder.png"
|
PlaceholderAlbumArt = "placeholder.png"
|
||||||
PlaceholderAvatar = "logo-192x192.png"
|
PlaceholderAvatar = "logo-192x192.png"
|
||||||
|
|
||||||
|
DefaultUIVolume = 100
|
||||||
|
|
||||||
DefaultHttpClientTimeOut = 10 * time.Second
|
DefaultHttpClientTimeOut = 10 * time.Second
|
||||||
|
|
||||||
DefaultScannerExtractor = "taglib"
|
DefaultScannerExtractor = "taglib"
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {
|
|||||||
"enableStarRating": conf.Server.EnableStarRating,
|
"enableStarRating": conf.Server.EnableStarRating,
|
||||||
"defaultTheme": conf.Server.DefaultTheme,
|
"defaultTheme": conf.Server.DefaultTheme,
|
||||||
"defaultLanguage": conf.Server.DefaultLanguage,
|
"defaultLanguage": conf.Server.DefaultLanguage,
|
||||||
|
"defaultUIVolume": conf.Server.DefaultUIVolume,
|
||||||
"enableCoverAnimation": conf.Server.EnableCoverAnimation,
|
"enableCoverAnimation": conf.Server.EnableCoverAnimation,
|
||||||
"gaTrackingId": conf.Server.GATrackingID,
|
"gaTrackingId": conf.Server.GATrackingID,
|
||||||
"losslessFormats": strings.ToUpper(strings.Join(consts.LosslessFormats, ",")),
|
"losslessFormats": strings.ToUpper(strings.Join(consts.LosslessFormats, ",")),
|
||||||
|
|||||||
@@ -170,6 +170,17 @@ var _ = Describe("serveIndex", func() {
|
|||||||
Expect(config).To(HaveKeyWithValue("defaultLanguage", "pt"))
|
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() {
|
It("sets the enableCoverAnimation", func() {
|
||||||
conf.Server.EnableCoverAnimation = true
|
conf.Server.EnableCoverAnimation = true
|
||||||
r := httptest.NewRequest("GET", "/index.html", nil)
|
r := httptest.NewRequest("GET", "/index.html", nil)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ const defaultConfig = {
|
|||||||
enableStarRating: true,
|
enableStarRating: true,
|
||||||
defaultTheme: 'Dark',
|
defaultTheme: 'Dark',
|
||||||
defaultLanguage: '',
|
defaultLanguage: '',
|
||||||
|
defaultUIVolume: 100,
|
||||||
enableUserEditing: true,
|
enableUserEditing: true,
|
||||||
devEnableShare: true,
|
devEnableShare: true,
|
||||||
devSidebarPlaylists: true,
|
devSidebarPlaylists: true,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const initialState = {
|
|||||||
queue: [],
|
queue: [],
|
||||||
current: {},
|
current: {},
|
||||||
clear: false,
|
clear: false,
|
||||||
volume: 0.5, // 50%
|
volume: config.defaultUIVolume / 100,
|
||||||
savedPlayIndex: 0,
|
savedPlayIndex: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user