mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
45e0e1206f
* fix(playback): pin queue streams, cover art, and library links to queue server When the active server changes while a queue from another server is playing, keep streams and UI on queueServerId; switch back for artist/album links and queue or player-bar context menus. * fix(playback): switch to queue server when opening Now Playing Ensure active server matches queueServerId before Subsonic fetches on the Now Playing page, mobile player route, and queue info panel; scope caches by server id. * docs(credits): mention Now Playing in PR #717 contribution line * fix(playback): route scrobble and queue sync to queue server Address PR review: apiForServer for scrobble/now-playing/savePlayQueue, clear queueServerId on server removal, mini-player queueServerId sync, block cross-server enqueue with toast, and regression tests.
18 lines
842 B
TypeScript
18 lines
842 B
TypeScript
import { useMemo } from 'react';
|
|
import { useAuthStore } from '../store/authStore';
|
|
import { usePlayerStore } from '../store/playerStore';
|
|
import { playbackCoverArtForId } from '../utils/playback/playbackServer';
|
|
|
|
/** Cover art for the playing queue — uses {@link queueServerId} when it differs from the browsed server. */
|
|
export function usePlaybackCoverArt(coverId: string | undefined, size: number) {
|
|
const queueServerId = usePlayerStore(s => s.queueServerId);
|
|
const queueLength = usePlayerStore(s => s.queue.length);
|
|
const activeServerId = useAuthStore(s => s.activeServerId);
|
|
const servers = useAuthStore(s => s.servers);
|
|
|
|
return useMemo(() => {
|
|
if (!coverId) return { src: '', cacheKey: '' };
|
|
return playbackCoverArtForId(coverId, size);
|
|
}, [coverId, size, queueServerId, queueLength, activeServerId, servers]);
|
|
}
|