mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 07:15:47 +00:00
db98d30a78
* fix(playback): keep browsed server when queue plays elsewhere Lucky Mix on a non-playback server now clears the old queue and pins the active server before building. Now Playing metadata uses apiForServer against the queue server instead of forcing ensurePlaybackServerActive on every activeServerId change. * docs: note PR #768 in CHANGELOG and settings credits * fix(now-playing): gate AudioMuse similar artists on playback server Match getArtistInfoForServer credentials: when browsing another server while the queue plays elsewhere, similar-artist count follows the queue server's AudioMuse flag, not the browsed server.
19 lines
731 B
TypeScript
19 lines
731 B
TypeScript
import { useMemo } from 'react';
|
|
import { useAuthStore } from '../store/authStore';
|
|
import { usePlayerStore } from '../store/playerStore';
|
|
import { getPlaybackServerId } from '../utils/playback/playbackServer';
|
|
|
|
/**
|
|
* Subsonic server that owns the current queue / stream (may differ from the browsed
|
|
* server). Use for Now Playing metadata without calling `ensurePlaybackServerActive`.
|
|
*/
|
|
export function usePlaybackServerId(): string {
|
|
const queueServerId = usePlayerStore(s => s.queueServerId);
|
|
const queueLength = usePlayerStore(s => s.queue.length);
|
|
const activeServerId = useAuthStore(s => s.activeServerId);
|
|
return useMemo(
|
|
() => getPlaybackServerId(),
|
|
[queueServerId, queueLength, activeServerId],
|
|
);
|
|
}
|