mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-29 06:37:17 +01:00
Add EnableUserEditing, to control whether a regular user can change their own details (default true)
This commit is contained in:
parent
2ff1c79b64
commit
7feda4bea4
6 changed files with 22 additions and 0 deletions
|
|
@ -48,6 +48,7 @@ func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {
|
|||
"losslessFormats": strings.ToUpper(strings.Join(consts.LosslessFormats, ",")),
|
||||
"devActivityPanel": conf.Server.DevActivityPanel,
|
||||
"devFastAccessCoverArt": conf.Server.DevFastAccessCoverArt,
|
||||
"enableUserEditing": conf.Server.EnableUserEditing,
|
||||
}
|
||||
j, err := json.Marshal(appConfig)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -189,6 +189,16 @@ var _ = Describe("serveIndex", func() {
|
|||
expected := strings.ToUpper(strings.Join(consts.LosslessFormats, ","))
|
||||
Expect(config).To(HaveKeyWithValue("losslessFormats", expected))
|
||||
})
|
||||
|
||||
It("sets the enableUserEditing", 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("enableUserEditing", true))
|
||||
})
|
||||
})
|
||||
|
||||
var appConfigRegex = regexp.MustCompile(`(?m)window.__APP_CONFIG__="([^"]*)`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue