Fix server queue saving/restoring on Navidrome and OpenSubsonic (#1828)

* fix server queue saving

* fix error when attempting to restore empty queue

* queue items optional

* make playQueueByIndex optional

* fix incorrect error message
This commit is contained in:
Lyall
2026-03-12 13:41:50 +00:00
committed by GitHub
parent 16b713bc85
commit dfdac28f53
5 changed files with 32 additions and 46 deletions
@@ -1137,15 +1137,15 @@ export const SubsonicController: InternalControllerEndpoint = {
const res = await ssApiClient(apiClientProps).getPlayQueueByIndex();
if (res.status !== 200) {
throw new Error('Failed to get random songs');
throw new Error('Failed to get play queue');
}
const { changed, changedBy, currentIndex, entry, position, username } =
res.body.playQueueByIndex;
res.body.playQueueByIndex || {}; // if there is no queue saved, playQueueByIndex may be undefined from a bug in Navidrome
return {
changed,
changedBy,
changed: changed ?? '',
changedBy: changedBy ?? '',
currentIndex: currentIndex ?? 0,
entry:
entry?.map((song) =>
@@ -1157,13 +1157,13 @@ export const SubsonicController: InternalControllerEndpoint = {
),
) || [],
positionMs: position ?? 0,
username,
username: username ?? '',
};
} else {
const res = await ssApiClient(apiClientProps).getPlayQueue();
if (res.status !== 200) {
throw new Error('Failed to get random songs');
throw new Error('Failed to get play queue');
}
const { changed, changedBy, current, entry, position, username } = res.body.playQueue;