[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
deezer docker jellyfin koito lastfm listenbrainz maloja mopidy mpris music music-assistant plex scrobble self-hosted spotify subsonic tautulli youtube-music
0

Configure Feed

Select the types of activity you want to include in your feed.

feat(musicbrainz): Implement apikey header

FoxxMD (Dec 11, 2025, 1:31 AM UTC) 802484c1 4dfb485c

+24 -8
+17 -6
patches/musicbrainz-api+0.27.0.patch
··· 1 1 diff --git a/node_modules/musicbrainz-api/lib/http-client.js b/node_modules/musicbrainz-api/lib/http-client.js 2 - index a5ca5f7..0c3705b 100644 2 + index a5ca5f7..f693ca3 100644 3 3 --- a/node_modules/musicbrainz-api/lib/http-client.js 4 4 +++ b/node_modules/musicbrainz-api/lib/http-client.js 5 5 @@ -9,6 +9,7 @@ function isConnectionReset(err) { ··· 10 10 } 11 11 get(path, options) { 12 12 return this._fetch('get', path, options); 13 - @@ -36,11 +37,16 @@ export class HttpClient { 13 + @@ -29,18 +30,25 @@ export class HttpClient { 14 + options = {}; 15 + let retryLimit = options.retryLimit && options.retryLimit > 1 ? options.retryLimit : 1; 16 + const retryTimeout = this.httpOptions.timeout ? this.httpOptions.timeout : 500; 17 + - const url = this._buildUrl(path, options.query); 18 + + let url = this._buildUrl(path, options.query); 19 + const cookies = await this.getCookies(); 20 + - const headers = new Headers(options.headers); 21 + + let headers = new Headers(options.headers); 22 + headers.set('User-Agent', this.httpOptions.userAgent); 14 23 if (cookies !== null) { 15 24 headers.set('Cookie', cookies); 16 25 } 17 26 + if(this.preRequest !== undefined) { 18 - + this.preRequest(method, url, headers); 27 + + const [m, u, h] = this.preRequest(method, url, headers); 28 + + url = u; 29 + + headers = h; 19 30 + } 20 31 + let signal = this.httpOptions.requestTimeout !== undefined ? AbortSignal.timeout(this.httpOptions.requestTimeout) : undefined; 21 32 while (retryLimit > 0) { ··· 27 38 ...options, 28 39 headers, 29 40 body: options.body, 30 - @@ -56,8 +62,8 @@ export class HttpClient { 41 + @@ -56,8 +64,8 @@ export class HttpClient { 31 42 throw err; 32 43 } 33 44 if (response.status === 429 || response.status === 503) { ··· 53 64 } 54 65 async login() { 55 66 diff --git a/node_modules/musicbrainz-api/lib/musicbrainz-api.d.ts b/node_modules/musicbrainz-api/lib/musicbrainz-api.d.ts 56 - index cd05017..b37e0b2 100644 67 + index cd05017..4664ff0 100644 57 68 --- a/node_modules/musicbrainz-api/lib/musicbrainz-api.d.ts 58 69 +++ b/node_modules/musicbrainz-api/lib/musicbrainz-api.d.ts 59 70 @@ -2,6 +2,7 @@ import type { XmlMetadata } from './xml/xml-metadata.js'; ··· 68 79 * Default is [15, 18], which allows up to 15 requests every 18 seconds 69 80 */ 70 81 rateLimit?: [number, number]; 71 - + preRequest?: (method: string, url: string, headers: Headers) => void 82 + + preRequest?: (method: string, url: string, headers: Headers) => [string,string,Headers] 72 83 + requestTimeout?: number 73 84 + retryLimit?: number 74 85 }
+2 -1
src/backend/common/infrastructure/Atomic.ts
··· 339 339 340 340 export interface MusicbrainzApiConfigData { 341 341 url?: string 342 - rateLimit?: number 342 + rateLimit?: [number, number] 343 343 contact: string, 344 344 ttl?: string 345 + apiKey?: string 345 346 } 346 347 347 348 export const MUSICBRAINZ_URL = 'https://musicbrainz.org';
+5 -1
src/backend/common/vendor/musicbrainz/MusicbrainzApiClient.ts
··· 67 67 appVersion: version, 68 68 appContactInfo: mbConfig.contact, 69 69 baseUrl: u.url.toString(), 70 - rateLimit: [1,1], 70 + rateLimit: mbConfig.rateLimit ?? [1,1], 71 71 preRequest: options.logUrl === true || isDebugMode() ? (method, url, headers) => { 72 72 const cacheKey = this.asyncStore.getStore() ?? nanoid(); 73 73 this.cache.set(`${cacheKey}-url`, `${method} - ${url}`, mbConfig.ttl ?? '1hr'); 74 + if(mbConfig.apiKey !== undefined) { 75 + headers.set('X-Api_key', mbConfig.apiKey); 76 + } 77 + return [method, url, headers]; 74 78 } : () => null, 75 79 requestTimeout: 6000, 76 80 retryLimit: 2