Add devEnableShare config option (#1141)
* add devEnableShare config option * Toggle in config.js
This commit is contained in:
@@ -64,6 +64,7 @@ type configOptions struct {
|
|||||||
DevFastAccessCoverArt bool
|
DevFastAccessCoverArt bool
|
||||||
DevOldCacheLayout bool
|
DevOldCacheLayout bool
|
||||||
DevActivityPanel bool
|
DevActivityPanel bool
|
||||||
|
DevEnableShare bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type scannerOptions struct {
|
type scannerOptions struct {
|
||||||
@@ -211,6 +212,7 @@ func init() {
|
|||||||
viper.SetDefault("devoldcachelayout", false)
|
viper.SetDefault("devoldcachelayout", false)
|
||||||
viper.SetDefault("devFastAccessCoverArt", false)
|
viper.SetDefault("devFastAccessCoverArt", false)
|
||||||
viper.SetDefault("devactivitypanel", true)
|
viper.SetDefault("devactivitypanel", true)
|
||||||
|
viper.SetDefault("devenableshare", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitConfig(cfgFile string) {
|
func InitConfig(cfgFile string) {
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {
|
|||||||
"devActivityPanel": conf.Server.DevActivityPanel,
|
"devActivityPanel": conf.Server.DevActivityPanel,
|
||||||
"devFastAccessCoverArt": conf.Server.DevFastAccessCoverArt,
|
"devFastAccessCoverArt": conf.Server.DevFastAccessCoverArt,
|
||||||
"enableUserEditing": conf.Server.EnableUserEditing,
|
"enableUserEditing": conf.Server.EnableUserEditing,
|
||||||
|
"devEnableShare": conf.Server.DevEnableShare,
|
||||||
}
|
}
|
||||||
j, err := json.Marshal(appConfig)
|
j, err := json.Marshal(appConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -199,6 +199,16 @@ var _ = Describe("serveIndex", func() {
|
|||||||
config := extractAppConfig(w.Body.String())
|
config := extractAppConfig(w.Body.String())
|
||||||
Expect(config).To(HaveKeyWithValue("enableUserEditing", true))
|
Expect(config).To(HaveKeyWithValue("enableUserEditing", true))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("sets the devEnableShare", func() {
|
||||||
|
r := httptest.NewRequest("GET", "/index.html", nil)
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
|
||||||
|
serveIndex(ds, fs)(w, r)
|
||||||
|
|
||||||
|
config := extractAppConfig(w.Body.String())
|
||||||
|
Expect(config).To(HaveKeyWithValue("devEnableShare", false))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
var appConfigRegex = regexp.MustCompile(`(?m)window.__APP_CONFIG__="([^"]*)`)
|
var appConfigRegex = regexp.MustCompile(`(?m)window.__APP_CONFIG__="([^"]*)`)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ const defaultConfig = {
|
|||||||
enableStarRating: true,
|
enableStarRating: true,
|
||||||
defaultTheme: 'Dark',
|
defaultTheme: 'Dark',
|
||||||
enableUserEditing: true,
|
enableUserEditing: true,
|
||||||
|
devEnableShare: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
let config
|
let config
|
||||||
|
|||||||
Reference in New Issue
Block a user