Expose Last.fm's ApiKey to UI
This commit is contained in:
@@ -45,6 +45,7 @@ func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {
|
||||
"enableUserEditing": conf.Server.EnableUserEditing,
|
||||
"devEnableShare": conf.Server.DevEnableShare,
|
||||
"devEnableScrobble": conf.Server.DevEnableScrobble,
|
||||
"lastFMApiKey": conf.Server.LastFM.ApiKey,
|
||||
}
|
||||
auth := handleLoginFromHeaders(ds, r)
|
||||
if auth != nil {
|
||||
|
||||
@@ -209,6 +209,17 @@ var _ = Describe("serveIndex", func() {
|
||||
config := extractAppConfig(w.Body.String())
|
||||
Expect(config).To(HaveKeyWithValue("devEnableScrobble", false))
|
||||
})
|
||||
|
||||
It("sets the lastFMApiKey", func() {
|
||||
conf.Server.LastFM.ApiKey = "APIKEY-123"
|
||||
r := httptest.NewRequest("GET", "/index.html", nil)
|
||||
w := httptest.NewRecorder()
|
||||
|
||||
serveIndex(ds, fs)(w, r)
|
||||
|
||||
config := extractAppConfig(w.Body.String())
|
||||
Expect(config).To(HaveKeyWithValue("lastFMApiKey", "APIKEY-123"))
|
||||
})
|
||||
})
|
||||
|
||||
var appConfigRegex = regexp.MustCompile(`(?m)window.__APP_CONFIG__="([^"]*)`)
|
||||
|
||||
Reference in New Issue
Block a user