From 8e6d35a85b212da3ebf027f52e1ce820d12a7b37 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Wed, 5 Aug 2026 19:08:08 +0000 Subject: [PATCH] fix(lz endpoint): Fix missing early return when no sources for playing now response --- src/backend/server/endpointListenbrainzRoutes.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backend/server/endpointListenbrainzRoutes.ts b/src/backend/server/endpointListenbrainzRoutes.ts index 36411484..58a59a6c 100644 --- a/src/backend/server/endpointListenbrainzRoutes.ts +++ b/src/backend/server/endpointListenbrainzRoutes.ts @@ -92,10 +92,13 @@ export const setupLZEndpointRoutes = (app: Express, parentLogger: Logger, scrobb const sources = scrobbleSources.getByType('endpointlz') as EndpointListenbrainzSource[]; if (sources.length === 0) { - logger.warn('Received Listenbrainz endpoint payload but no Listenbrainz endpoint sources are configured'); + return res.status(409).json({error: `Received Listenbrainz endpoint payload but no Listenbrainz endpoint sources are configured`, code: 409}); } - const matchedSource = sources.find(x => x.config.data?.username === user || x.name === user); + let matchedSource = sources.find(x => x.config.data?.username === user || x.name === user); + if(matchedSource === undefined) { + matchedSource = sources[0]; + } const playObjs = scrobbleClients.getPlayingNow(matchedSource.name, matchedSource.clients); listens = playObjs.map(x => ({playing_now: true, track_metadata: playToListenPayload(x).track_metadata})); -- 2.51.2