Listenbrainz scrobbling (#1424)
* Refactor session_keys to its own package * Adjust play_tracker - Don't send external NowPlaying/Scrobble for tracks with unknown artist - Continue to the next agent on error * Implement ListenBrainz Agent and Auth Router * Implement frontend for ListenBrainz linking * Update listenBrainzRequest - Don't marshal Player to json - Rename Track to Title * Return ErrRetryLater on ListenBrainz server errors * Add tests for listenBrainzAgent * Add tests for ListenBrainz Client * Adjust ListenBrainzTokenDialog to handle errors better * Refactor listenbrainz.formatListen and listenBrainzRequest structs * Refactor agent auth_routers * Refactor session_keys to agents package * Add test for listenBrainzResponse * Add tests for ListenBrainz auth_router * Update ListenBrainzTokenDialog and auth_router * Adjust player scrobble toggle
This commit is contained in:
@@ -49,6 +49,7 @@ func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {
|
||||
"lastFMEnabled": conf.Server.LastFM.Enabled,
|
||||
"lastFMApiKey": conf.Server.LastFM.ApiKey,
|
||||
"devShowArtistPage": conf.Server.DevShowArtistPage,
|
||||
"devListenBrainzEnabled": conf.Server.DevListenBrainzEnabled,
|
||||
}
|
||||
auth := handleLoginFromHeaders(ds, r)
|
||||
if auth != nil {
|
||||
|
||||
@@ -254,6 +254,7 @@ var _ = Describe("serveIndex", func() {
|
||||
config := extractAppConfig(w.Body.String())
|
||||
Expect(config).To(HaveKeyWithValue("lastFMApiKey", "APIKEY-123"))
|
||||
})
|
||||
|
||||
It("sets the devShowArtistPage", func() {
|
||||
conf.Server.DevShowArtistPage = true
|
||||
r := httptest.NewRequest("GET", "/index.html", nil)
|
||||
@@ -265,6 +266,16 @@ var _ = Describe("serveIndex", func() {
|
||||
Expect(config).To(HaveKeyWithValue("devShowArtistPage", true))
|
||||
})
|
||||
|
||||
It("sets the devListenBrainzEnabled", func() {
|
||||
conf.Server.DevListenBrainzEnabled = true
|
||||
r := httptest.NewRequest("GET", "/index.html", nil)
|
||||
w := httptest.NewRecorder()
|
||||
|
||||
serveIndex(ds, fs)(w, r)
|
||||
|
||||
config := extractAppConfig(w.Body.String())
|
||||
Expect(config).To(HaveKeyWithValue("devListenBrainzEnabled", true))
|
||||
})
|
||||
})
|
||||
|
||||
var appConfigRegex = regexp.MustCompile(`(?m)window.__APP_CONFIG__="([^"]*)`)
|
||||
|
||||
Reference in New Issue
Block a user