mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
refactor(lib): extract clean server + navigation infra to lib/ (decouple-knot files stay in utils/ pending seam)
This commit is contained in:
@@ -23,7 +23,7 @@ import { useDragDrop } from '@/lib/dnd/DragDropContext';
|
||||
import { isAlbumRecentlyAdded } from '@/features/album/utils/albumRecency';
|
||||
import { albumArtistDisplayName, deriveAlbumArtistRefs } from '@/features/album/utils/deriveAlbumHeaderArtistRefs';
|
||||
import { coverServerScopeForServerId } from '@/cover/serverScope';
|
||||
import { appendServerQuery } from '@/utils/navigation/detailServerScope';
|
||||
import { appendServerQuery } from '@/lib/navigation/detailServerScope';
|
||||
|
||||
interface AlbumCardProps {
|
||||
album: SubsonicAlbum;
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
loadArtistFromLocalPlayback,
|
||||
offlineLocalBrowseEnabled,
|
||||
} from '@/features/offline';
|
||||
import { readDetailServerId } from '@/utils/navigation/detailServerScope';
|
||||
import { readDetailServerId } from '@/lib/navigation/detailServerScope';
|
||||
import { libraryIsReady } from '@/lib/library/libraryReady';
|
||||
import {
|
||||
shouldAttemptSubsonicForActiveServer,
|
||||
|
||||
@@ -45,7 +45,7 @@ import { VirtualCardGrid } from '@/ui/VirtualCardGrid';
|
||||
import LosslessModeBanner from '@/ui/LosslessModeBanner';
|
||||
import { isLosslessSuffix } from '@/lib/library/losslessFormats';
|
||||
import { isLosslessMode } from '@/lib/library/losslessMode';
|
||||
import { readDetailServerId } from '@/utils/navigation/detailServerScope';
|
||||
import { readDetailServerId } from '@/lib/navigation/detailServerScope';
|
||||
import { useOfflineBrowseContext } from '@/features/offline';
|
||||
import { offlineActionPolicy } from '@/features/offline';
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useArtistCoverRef } from '@/cover/useLibraryCoverRef';
|
||||
import { COVER_DENSE_GRID_MIN_CELL_CSS_PX } from '@/cover/layoutSizes';
|
||||
import { useNavigateToArtist } from '@/features/artist/hooks/useNavigateToArtist';
|
||||
import { coverServerScopeForServerId } from '@/cover/serverScope';
|
||||
import { appendServerQuery } from '@/utils/navigation/detailServerScope';
|
||||
import { appendServerQuery } from '@/lib/navigation/detailServerScope';
|
||||
|
||||
interface Props {
|
||||
artist: SubsonicArtist;
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useConnectionStatus } from '@/hooks/useConnectionStatus';
|
||||
import { loadArtistFromLibraryIndex } from '@/features/offline';
|
||||
import { useOfflineBrowseContext } from '@/features/offline';
|
||||
import { loadArtistFromLocalPlayback, offlineLocalBrowseEnabled } from '@/features/offline';
|
||||
import { readDetailServerId } from '@/utils/navigation/detailServerScope';
|
||||
import { readDetailServerId } from '@/lib/navigation/detailServerScope';
|
||||
import { runLocalArtistLosslessBrowse } from '@/lib/library/browseTextSearch';
|
||||
import { isLosslessSuffix } from '@/lib/library/losslessFormats';
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ import { useWarmGridCovers } from '@/cover/useWarmGridCovers';
|
||||
import { VirtualCardGrid } from '@/ui/VirtualCardGrid';
|
||||
import { LOSSLESS_MODE_QUERY } from '@/lib/library/losslessMode';
|
||||
import { sortArtistAlbumsByYear } from '@/features/artist/utils/sortArtistAlbums';
|
||||
import { readDetailServerId } from '@/utils/navigation/detailServerScope';
|
||||
import { readDetailServerId } from '@/lib/navigation/detailServerScope';
|
||||
|
||||
|
||||
export default function ArtistDetail() {
|
||||
|
||||
@@ -4,7 +4,7 @@ import userEvent from '@testing-library/user-event';
|
||||
import { renderWithProviders } from '@/test/helpers/renderWithProviders';
|
||||
import { resetAuthStore } from '@/test/helpers/storeReset';
|
||||
import { useAuthStore } from '@/store/authStore';
|
||||
import { encodeServerMagicString } from '@/utils/server/serverMagicString';
|
||||
import { encodeServerMagicString } from '@/lib/server/serverMagicString';
|
||||
|
||||
vi.mock('@/lib/api/subsonic', () => ({
|
||||
pingWithCredentialsForProfile: vi.fn(async () => ({
|
||||
@@ -16,7 +16,7 @@ vi.mock('@/lib/api/subsonic', () => ({
|
||||
scheduleInstantMixProbeForServer: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@/utils/server/syncServerHttpContext', () => ({
|
||||
vi.mock('@/lib/server/syncServerHttpContext', () => ({
|
||||
syncServerHttpContextForProfile: vi.fn(async () => undefined),
|
||||
}));
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ import {
|
||||
DEFAULT_CUSTOM_HEADERS_APPLY_TO,
|
||||
serverCustomHeadersFromForm,
|
||||
validateCustomHeaders,
|
||||
} from '@/utils/server/serverHttpHeaders';
|
||||
import { syncServerHttpContextForProfile } from '@/utils/server/syncServerHttpContext';
|
||||
} from '@/lib/server/serverHttpHeaders';
|
||||
import { syncServerHttpContextForProfile } from '@/lib/server/syncServerHttpContext';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import i18n from '@/lib/i18n';
|
||||
import CustomSelect from '@/ui/CustomSelect';
|
||||
@@ -19,8 +19,8 @@ import {
|
||||
DECODED_PASSWORD_VISUAL_MASK,
|
||||
encodeServerMagicString,
|
||||
type ServerMagicPayload,
|
||||
} from '@/utils/server/serverMagicString';
|
||||
import { shortHostFromServerUrl, serverListDisplayLabel } from '@/utils/server/serverDisplayName';
|
||||
} from '@/lib/server/serverMagicString';
|
||||
import { shortHostFromServerUrl, serverListDisplayLabel } from '@/lib/server/serverDisplayName';
|
||||
|
||||
const PsysonicLogo = () => (
|
||||
<img src="/logo-psysonic.png" width="64" height="64" alt="Psysonic" style={{ borderRadius: 18 }} />
|
||||
|
||||
@@ -13,7 +13,7 @@ import { useThemeStore } from '@/store/themeStore';
|
||||
import { useDragDrop } from '@/lib/dnd/DragDropContext';
|
||||
import { useOrbitSongRowBehavior } from '@/features/orbit';
|
||||
import { songToTrack } from '@/lib/media/songToTrack';
|
||||
import { appendServerQuery } from '@/utils/navigation/detailServerScope';
|
||||
import { appendServerQuery } from '@/lib/navigation/detailServerScope';
|
||||
import { APP_MAIN_SCROLL_VIEWPORT_ID } from '@/constants/appScroll';
|
||||
import { useElementClientHeightById } from '@/lib/hooks/useResizeClientHeight';
|
||||
import { SORTABLE_COLUMNS } from '@/features/favorites/hooks/useFavoritesSongFiltering';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useLibraryIndexStore } from '@/store/libraryIndexStore';
|
||||
import { fetchGenreCatalog, filterGenresWithContent } from '@/features/playback/utils/playback/genreBrowsePlayback';
|
||||
import { libraryScopeForServer } from '@/lib/api/subsonicClient';
|
||||
import { peekGenreCatalogCache } from '@/lib/library/genreCatalogCountsCache';
|
||||
import { resolveIndexKey } from '@/utils/server/serverIndexKey';
|
||||
import { resolveIndexKey } from '@/lib/server/serverIndexKey';
|
||||
import { genreColor } from '@/lib/library/genreColor';
|
||||
|
||||
const SCROLL_KEY = 'genres-scroll';
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
import { showToast } from '@/lib/dom/toast';
|
||||
import { shuffleArray } from '@/lib/util/shuffleArray';
|
||||
import { getMediaDir } from '@/lib/media/mediaDir';
|
||||
import { canonicalQueueServerKey, resolveIndexKey } from '@/utils/server/serverIndexKey';
|
||||
import { canonicalQueueServerKey, resolveIndexKey } from '@/lib/server/serverIndexKey';
|
||||
import { reconcileAllLibraryTiersFromDisk } from '@/features/offline/utils/libraryTierReconcile';
|
||||
import {
|
||||
inferPinSourcesFromLibraryIndex,
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
pendingOfflinePinSongs,
|
||||
} from '@/features/offline/utils/offlineLibraryHelpers';
|
||||
import { librarySqlServerId } from '@/api/coverCache';
|
||||
import { resolveIndexKey, serverIndexKeyForProfile } from '@/utils/server/serverIndexKey';
|
||||
import { resolveIndexKey, serverIndexKeyForProfile } from '@/lib/server/serverIndexKey';
|
||||
import { isSmartPlaylistName } from '@/utils/componentHelpers/playlistDetailHelpers';
|
||||
import {
|
||||
enqueueOfflinePin,
|
||||
|
||||
@@ -12,7 +12,7 @@ import { cancelledDownloads, useOfflineJobStore } from '@/features/offline/store
|
||||
import { useFavoritesOfflineSyncStore } from '@/features/offline/store/favoritesOfflineSyncStore';
|
||||
import { useLocalPlaybackStore } from '@/store/localPlaybackStore';
|
||||
import { getMediaDir } from '@/lib/media/mediaDir';
|
||||
import { resolveIndexKey, serverIndexKeyForProfile } from '@/utils/server/serverIndexKey';
|
||||
import { resolveIndexKey, serverIndexKeyForProfile } from '@/lib/server/serverIndexKey';
|
||||
import { FAVORITES_OFFLINE_JOB_ID } from '@/features/offline/utils/favoritesOfflineConstants';
|
||||
import { isActiveServerReachable } from '@/utils/network/activeServerReachability';
|
||||
import { favoritesServerIds } from '@/features/offline/utils/favoritesOfflineBrowse';
|
||||
|
||||
@@ -6,8 +6,8 @@ import { useLocalPlaybackStore, type LocalPlaybackEntry, type PinSource } from '
|
||||
import { localPlaybackEntryKey } from '@/store/localPlaybackKeys';
|
||||
import { importLegacyLocalPlayback } from '@/store/localPlaybackMigration';
|
||||
import { getMediaDir } from '@/lib/media/mediaDir';
|
||||
import { resolveServerIdForIndexKey } from '@/utils/server/serverLookup';
|
||||
import { resolveIndexKey } from '@/utils/server/serverIndexKey';
|
||||
import { resolveServerIdForIndexKey } from '@/lib/server/serverLookup';
|
||||
import { resolveIndexKey } from '@/lib/server/serverIndexKey';
|
||||
|
||||
interface LegacyOfflineMigrationResult {
|
||||
trackId: string;
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useAuthStore } from '@/store/authStore';
|
||||
import type { LocalPlaybackEntry, PinSource } from '@/store/localPlaybackStore';
|
||||
import { useLocalPlaybackStore } from '@/store/localPlaybackStore';
|
||||
import { getMediaDir } from '@/lib/media/mediaDir';
|
||||
import { resolveIndexKey, serverIndexKeyForProfile } from '@/utils/server/serverIndexKey';
|
||||
import { resolveIndexKey, serverIndexKeyForProfile } from '@/lib/server/serverIndexKey';
|
||||
import {
|
||||
entryBelongsToServer,
|
||||
findLocalPlaybackEntry,
|
||||
|
||||
@@ -8,10 +8,10 @@ import { useLocalPlaybackStore } from '@/store/localPlaybackStore';
|
||||
import { findLocalPlaybackEntry, hasLocalLibraryBytes } from '@/store/localPlaybackResolve';
|
||||
import { useOfflineStore, type OfflineAlbumMeta } from '@/features/offline/store/offlineStore';
|
||||
import { resolveTrackCoverArtId, trackToSong } from '@/lib/library/advancedSearchLocal';
|
||||
import { canonicalQueueServerKey, resolveIndexKey } from '@/utils/server/serverIndexKey';
|
||||
import { canonicalQueueServerKey, resolveIndexKey } from '@/lib/server/serverIndexKey';
|
||||
import type { Track } from '@/lib/media/trackTypes';
|
||||
import { findServerByIdOrIndexKey, resolveServerIdForIndexKey } from '@/utils/server/serverLookup';
|
||||
import { serverIndexKeyForProfile } from '@/utils/server/serverIndexKey';
|
||||
import { findServerByIdOrIndexKey, resolveServerIdForIndexKey } from '@/lib/server/serverLookup';
|
||||
import { serverIndexKeyForProfile } from '@/lib/server/serverIndexKey';
|
||||
|
||||
export interface OfflineLibraryCard {
|
||||
serverIndexKey: string;
|
||||
|
||||
@@ -15,8 +15,8 @@ import {
|
||||
isActiveServerReachable,
|
||||
onActiveServerBecameReachable,
|
||||
} from '@/utils/network/activeServerReachability';
|
||||
import { resolveIndexKey, serverIndexKeyForProfile } from '@/utils/server/serverIndexKey';
|
||||
import { resolveServerIdForIndexKey } from '@/utils/server/serverLookup';
|
||||
import { resolveIndexKey, serverIndexKeyForProfile } from '@/lib/server/serverIndexKey';
|
||||
import { resolveServerIdForIndexKey } from '@/lib/server/serverLookup';
|
||||
import { findLocalPlaybackEntry } from '@/store/localPlaybackResolve';
|
||||
import { enqueueOfflinePin } from '@/features/offline/utils/offlinePinQueue';
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useOfflineStore } from '@/features/offline/store/offlineStore';
|
||||
import { trackToSong } from '@/lib/library/advancedSearchLocal';
|
||||
import { isActiveServerReachable, onActiveServerBecameReachable } from '@/utils/network/activeServerReachability';
|
||||
import { shouldAttemptSubsonicForServer } from '@/utils/network/subsonicNetworkGuard';
|
||||
import { resolveServerIdForIndexKey } from '@/utils/server/serverLookup';
|
||||
import { resolveServerIdForIndexKey } from '@/lib/server/serverLookup';
|
||||
import { isOfflinePinComplete } from '@/features/offline/utils/offlineLibraryHelpers';
|
||||
import { resolveAlbumForServer } from '@/features/offline/utils/offlineMediaResolve';
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { useOrbitStore } from '@/features/orbit/store/orbitStore';
|
||||
import { useAuthStore } from '@/store/authStore';
|
||||
import { buildOrbitShareLink } from '@/features/orbit/utils/orbit';
|
||||
import { serverShareBaseUrl } from '@/utils/server/serverEndpoint';
|
||||
import { serverShareBaseUrl } from '@/lib/server/serverEndpoint';
|
||||
|
||||
interface Props {
|
||||
anchorRef: React.RefObject<HTMLElement | null>;
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
import { randomOrbitSessionName } from '@/features/orbit/utils/orbitNames';
|
||||
import { useAuthStore } from '@/store/authStore';
|
||||
import { usePlayerStore } from '@/features/playback/store/playerStore';
|
||||
import { isLanUrl, serverShareBaseUrl } from '@/utils/server/serverEndpoint';
|
||||
import { isLanUrl, serverShareBaseUrl } from '@/lib/server/serverEndpoint';
|
||||
import { ORBIT_DEFAULT_MAX_USERS } from '@/features/orbit/api/orbit';
|
||||
|
||||
interface Props { onClose: () => void; }
|
||||
|
||||
@@ -13,7 +13,7 @@ import type { QueueItemRef } from '@/lib/media/trackTypes';
|
||||
import type { PlayerState } from '@/features/playback/store/playerStoreTypes';
|
||||
import { resolveQueueTrack } from '@/features/playback/store/queueTrackView';
|
||||
import { seedQueueResolver } from '@/features/playback/store/queueTrackResolver';
|
||||
import { canonicalQueueServerKey } from '@/utils/server/serverIndexKey';
|
||||
import { canonicalQueueServerKey } from '@/lib/server/serverIndexKey';
|
||||
import { sameQueueTrackId } from '@/features/playback/utils/playback/queueIdentity';
|
||||
import { queueUndoRestoreAudioEngine } from '@/features/playback/store/queueUndoAudioRestore';
|
||||
import {
|
||||
|
||||
@@ -7,7 +7,7 @@ vi.mock('@/lib/api/subsonicPlayQueue', () => ({
|
||||
getPlayQueueForServer: (...args: unknown[]) => getPlayQueueForServerMock(...args),
|
||||
}));
|
||||
|
||||
vi.mock('@/utils/server/serverLookup', () => ({
|
||||
vi.mock('@/lib/server/serverLookup', () => ({
|
||||
resolveServerIdForIndexKey: (id: string) => id,
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getPlayQueueForServer, type PlayQueueResult } from '@/lib/api/subsonicPlayQueue';
|
||||
import { songToTrack } from '@/lib/media/songToTrack';
|
||||
import { bindQueueServerId } from '@/features/playback/utils/playback/playbackServer';
|
||||
import { resolveServerIdForIndexKey } from '@/utils/server/serverLookup';
|
||||
import { resolveServerIdForIndexKey } from '@/lib/server/serverLookup';
|
||||
import { toQueueItemRefs } from '@/features/playback/store/queueItemRef';
|
||||
import { seedQueueResolver } from '@/features/playback/store/queueTrackResolver';
|
||||
import type { Track } from '@/lib/media/trackTypes';
|
||||
|
||||
@@ -39,7 +39,7 @@ const hoisted = vi.hoisted(() => {
|
||||
|
||||
vi.mock('@tauri-apps/api/core', () => ({ invoke: hoisted.invokeMock }));
|
||||
vi.mock('@/lib/api/subsonicStreamUrl', () => ({ buildStreamUrl: hoisted.buildStreamUrlMock }));
|
||||
vi.mock('@/utils/server/redactSubsonicUrl', () => ({ redactSubsonicUrlForLog: hoisted.redactMock }));
|
||||
vi.mock('@/lib/server/redactSubsonicUrl', () => ({ redactSubsonicUrlForLog: hoisted.redactMock }));
|
||||
vi.mock('@/store/authStore', () => ({ useAuthStore: { getState: () => hoisted.auth } }));
|
||||
vi.mock('@/features/playback/store/playerStore', () => ({
|
||||
usePlayerStore: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { buildStreamUrl } from '@/lib/api/subsonicStreamUrl';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { getPlaybackIndexKey } from '@/features/playback/utils/playback/playbackServer';
|
||||
import { redactSubsonicUrlForLog } from '@/utils/server/redactSubsonicUrl';
|
||||
import { redactSubsonicUrlForLog } from '@/lib/server/redactSubsonicUrl';
|
||||
import { useAuthStore } from '@/store/authStore';
|
||||
import { usePlayerStore } from '@/features/playback/store/playerStore';
|
||||
import { emitNormalizationDebug } from '@/features/playback/store/normalizationDebug';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { findLocalPlaybackUrl } from '@/store/localPlaybackResolve';
|
||||
import { resolvePlaybackUrl, type PlaybackSourceKind } from '@/features/playback/utils/playback/resolvePlaybackUrl';
|
||||
import { resolveServerIdForIndexKey } from '@/utils/server/serverLookup';
|
||||
import { resolveServerIdForIndexKey } from '@/lib/server/serverLookup';
|
||||
import { sameQueueTrackId } from '@/features/playback/utils/playback/queueIdentity';
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ import { emitPlaybackProgress } from '@/features/playback/store/playbackProgress
|
||||
import type { QueueItemRef, Track } from '@/lib/media/trackTypes';
|
||||
import type { PlayerState } from '@/features/playback/store/playerStoreTypes';
|
||||
import { toQueueItemRefs } from '@/features/playback/store/queueItemRef';
|
||||
import { canonicalQueueServerKey } from '@/utils/server/serverIndexKey';
|
||||
import { canonicalQueueServerKey } from '@/lib/server/serverIndexKey';
|
||||
import { readInitialQueueVisibility } from '@/features/playback/store/queueVisibilityStorage';
|
||||
import { createNetworkLoveActions } from '@/features/playback/store/networkLoveActions';
|
||||
import { createMiscActions } from '@/features/playback/store/miscActions';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { QueueItemRef, Track } from '@/lib/media/trackTypes';
|
||||
import { stampTrackServerId } from '@/lib/media/trackServerScope';
|
||||
import { canonicalQueueServerKey } from '@/utils/server/serverIndexKey';
|
||||
import { canonicalQueueServerKey } from '@/lib/server/serverIndexKey';
|
||||
|
||||
/**
|
||||
* Derive thin `QueueItemRef`s from a `Track[]` queue (thin-state). Per-item
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useAuthStore } from '@/store/authStore';
|
||||
import { usePlayerStore } from '@/features/playback/store/playerStore';
|
||||
import type { QueueItemRef } from '@/lib/media/trackTypes';
|
||||
import { canonicalQueueServerKey } from '@/utils/server/serverIndexKey';
|
||||
import { canonicalQueueServerKey } from '@/lib/server/serverIndexKey';
|
||||
import { resolveBatch } from './queueTrackResolver';
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,8 +3,8 @@ import { getSongForServer } from '@/lib/api/subsonicLibrary';
|
||||
import { usePlayerStore } from '@/features/playback/store/playerStore';
|
||||
import type { QueueItemRef, Track } from '@/lib/media/trackTypes';
|
||||
import { songToTrack } from '@/lib/media/songToTrack';
|
||||
import { resolveServerIdForIndexKey } from '@/utils/server/serverLookup';
|
||||
import { canonicalQueueServerKey } from '@/utils/server/serverIndexKey';
|
||||
import { resolveServerIdForIndexKey } from '@/lib/server/serverLookup';
|
||||
import { canonicalQueueServerKey } from '@/lib/server/serverIndexKey';
|
||||
import { trackToSong } from '@/lib/library/advancedSearchLocal';
|
||||
import { libraryIsReady } from '@/lib/library/libraryReady';
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ import { usePlayerStore } from '@/features/playback/store/playerStore';
|
||||
import { switchActiveServer } from '@/utils/server/switchActiveServer';
|
||||
import { sameQueueTrackId } from '@/features/playback/utils/playback/queueIdentity';
|
||||
import type { QueueItemRef, Track } from '@/lib/media/trackTypes';
|
||||
import { findServerByIdOrIndexKey, resolveServerIdForIndexKey } from '@/utils/server/serverLookup';
|
||||
import { findServerByIdOrIndexKey, resolveServerIdForIndexKey } from '@/lib/server/serverLookup';
|
||||
import {
|
||||
canonicalQueueServerKey,
|
||||
resolveIndexKey,
|
||||
serverIndexKeyForProfile,
|
||||
serverIndexKeyFromUrl,
|
||||
} from '@/utils/server/serverIndexKey';
|
||||
} from '@/lib/server/serverIndexKey';
|
||||
import {
|
||||
activeServerProfileId,
|
||||
isMultiServerQueue,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { buildStreamUrlForServer } from '@/lib/api/subsonicStreamUrl';
|
||||
import { findLocalPlaybackUrl } from '@/store/localPlaybackResolve';
|
||||
import { resolveServerIdForIndexKey } from '@/utils/server/serverLookup';
|
||||
import { resolveServerIdForIndexKey } from '@/lib/server/serverLookup';
|
||||
import { getPlaybackCacheServerKey, getPlaybackServerId } from '@/features/playback/utils/playback/playbackServer';
|
||||
|
||||
/** Same resolution order as {@link resolvePlaybackUrl} — for UI hints only. */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { QueueItemRef } from '@/lib/media/trackTypes';
|
||||
import { usePlayerStore } from '@/features/playback/store/playerStore';
|
||||
import { resolveServerIdForIndexKey } from '@/utils/server/serverLookup';
|
||||
import { resolveServerIdForIndexKey } from '@/lib/server/serverLookup';
|
||||
import { activeServerProfileId, profileIdFromQueueRef } from '@/lib/media/trackServerScope';
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,8 +13,8 @@ import { useTranslation } from 'react-i18next';
|
||||
import { usePlaybackLibraryNavigate } from '@/features/playback/hooks/usePlaybackLibraryNavigate';
|
||||
import { useAuthStore } from '@/store/authStore';
|
||||
import { encodeSharePayload } from '@/utils/share/shareLink';
|
||||
import { serverShareBaseUrl } from '@/utils/server/serverEndpoint';
|
||||
import { copyTextToClipboard } from '@/utils/server/serverMagicString';
|
||||
import { serverShareBaseUrl } from '@/lib/server/serverEndpoint';
|
||||
import { copyTextToClipboard } from '@/lib/server/serverMagicString';
|
||||
import { showToast } from '@/lib/dom/toast';
|
||||
import { useThemeStore } from '@/store/themeStore';
|
||||
import { useLyricsStore } from '@/store/lyricsStore';
|
||||
|
||||
@@ -54,7 +54,7 @@ import {
|
||||
resolveLiveSearchScopeGhost,
|
||||
} from '@/features/search/components/liveSearchScope';
|
||||
import { useLiveSearchScopeStore } from '@/store/liveSearchScopeStore';
|
||||
import { resolveIndexKey } from '@/utils/server/serverIndexKey';
|
||||
import { resolveIndexKey } from '@/lib/server/serverIndexKey';
|
||||
|
||||
type LiveSearchSource = 'local' | 'network';
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { ServerProfile } from '@/store/authStoreTypes';
|
||||
import { findServerIdForShareUrl } from '@/utils/share/shareLink';
|
||||
import { shareServerOriginLabel } from '@/utils/share/shareServerOriginLabel';
|
||||
import { parseShareSearchText } from '@/utils/share/shareSearch';
|
||||
import { serverIndexKeyFromUrl } from '@/utils/server/serverIndexKey';
|
||||
import { serverIndexKeyFromUrl } from '@/lib/server/serverIndexKey';
|
||||
import { useShareSearchPreview } from '@/features/search/hooks/useShareSearchPreview';
|
||||
|
||||
export function useShareSearch(query: string, onSuccess?: () => void) {
|
||||
|
||||
@@ -35,8 +35,8 @@ import {
|
||||
registerAdvancedSearchSessionProvider,
|
||||
resolveAdvancedSearchLeaveSnapshot,
|
||||
type AdvancedSearchLeaveSnapshot,
|
||||
} from '@/utils/navigation/advancedSearchScrollSnapshot';
|
||||
import { restoreMainViewportScroll } from '@/utils/navigation/restoreMainViewportScroll';
|
||||
} from '@/lib/navigation/advancedSearchScrollSnapshot';
|
||||
import { restoreMainViewportScroll } from '@/lib/navigation/restoreMainViewportScroll';
|
||||
import {
|
||||
loadMoreLocalSongs,
|
||||
runNetworkAdvancedTextSearch,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { renderWithProviders } from '@/test/helpers/renderWithProviders';
|
||||
import { AddServerForm } from '@/features/settings/components/AddServerForm';
|
||||
import { encodeServerMagicString } from '@/utils/server/serverMagicString';
|
||||
import { encodeServerMagicString } from '@/lib/server/serverMagicString';
|
||||
|
||||
// resolve_host_addresses Tauri command — hint-only, must not block save.
|
||||
vi.mock('@/api/network', () => ({
|
||||
|
||||
@@ -6,16 +6,16 @@ import {
|
||||
DEFAULT_CUSTOM_HEADERS_APPLY_TO,
|
||||
serverCustomHeadersFromForm,
|
||||
validateCustomHeaders,
|
||||
} from '@/utils/server/serverHttpHeaders';
|
||||
} from '@/lib/server/serverHttpHeaders';
|
||||
import { CustomHttpHeadersEditor } from '@/features/settings/components/CustomHttpHeadersEditor';
|
||||
import {
|
||||
decodeServerMagicString,
|
||||
encodeServerMagicString,
|
||||
DECODED_PASSWORD_VISUAL_MASK,
|
||||
type ServerMagicPayload,
|
||||
} from '@/utils/server/serverMagicString';
|
||||
import { shortHostFromServerUrl } from '@/utils/server/serverDisplayName';
|
||||
import { isLanUrl } from '@/utils/server/serverEndpoint';
|
||||
} from '@/lib/server/serverMagicString';
|
||||
import { shortHostFromServerUrl } from '@/lib/server/serverDisplayName';
|
||||
import { isLanUrl } from '@/lib/server/serverEndpoint';
|
||||
import { resolveHostAddresses } from '@/api/network';
|
||||
|
||||
type FormState = {
|
||||
|
||||
@@ -21,8 +21,8 @@ import {
|
||||
} from '@/api/analysis';
|
||||
import { libraryGetTracksBatch, type LibraryTrackDto, type TrackRefDto } from '@/lib/api/library';
|
||||
import { buildStreamUrlForServer } from '@/lib/api/subsonicStreamUrl';
|
||||
import { serverListDisplayLabel } from '@/utils/server/serverDisplayName';
|
||||
import { serverIndexKeyForProfile } from '@/utils/server/serverIndexKey';
|
||||
import { serverListDisplayLabel } from '@/lib/server/serverDisplayName';
|
||||
import { serverIndexKeyForProfile } from '@/lib/server/serverIndexKey';
|
||||
import { showToast } from '@/lib/dom/toast';
|
||||
import {
|
||||
ANALYTICS_STRATEGIES,
|
||||
|
||||
@@ -14,8 +14,8 @@ import {
|
||||
libraryCoverProgress,
|
||||
} from '@/api/coverCache';
|
||||
import { clearDiskSrcCacheForServer } from '@/cover/diskSrcCache';
|
||||
import { serverListDisplayLabel } from '@/utils/server/serverDisplayName';
|
||||
import { serverIndexKeyForProfile } from '@/utils/server/serverIndexKey';
|
||||
import { serverListDisplayLabel } from '@/lib/server/serverDisplayName';
|
||||
import { serverIndexKeyForProfile } from '@/lib/server/serverIndexKey';
|
||||
import { showToast } from '@/lib/dom/toast';
|
||||
import { formatBytes } from '@/lib/format/formatBytes';
|
||||
import { clearImageCache, getImageCacheSize } from '@/utils/imageCache';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import { open as openUrl } from '@tauri-apps/plugin-shell';
|
||||
import { AlertTriangle, CheckCircle2, Info, Lock, LogOut, Pencil, Plus, Power, Server, Sparkles, Wifi, WifiOff } from 'lucide-react';
|
||||
import { useAuthStore } from '@/store/authStore';
|
||||
import { formatServerSoftware, isNavidromeAudiomuseSoftwareEligible, type InstantMixProbeResult, type SubsonicServerIdentity } from '@/utils/server/subsonicServerIdentity';
|
||||
import { formatServerSoftware, isNavidromeAudiomuseSoftwareEligible, type InstantMixProbeResult, type SubsonicServerIdentity } from '@/lib/server/subsonicServerIdentity';
|
||||
import { buildCapabilityContext } from '@/serverCapabilities/context';
|
||||
import { useLibraryIndexStore } from '@/store/libraryIndexStore';
|
||||
import { libraryDeleteServerData, librarySyncClearSession } from '@/lib/api/library';
|
||||
@@ -16,24 +16,24 @@ import { pingWithCredentialsForProfile, scheduleInstantMixProbeForServer } from
|
||||
import {
|
||||
clearServerHttpContext,
|
||||
syncServerHttpContextForProfile,
|
||||
} from '@/utils/server/syncServerHttpContext';
|
||||
import { type ServerMagicPayload } from '@/utils/server/serverMagicString';
|
||||
import { ensureConnectUrlResolved, invalidateReachableEndpointCache } from '@/utils/server/serverEndpoint';
|
||||
} from '@/lib/server/syncServerHttpContext';
|
||||
import { type ServerMagicPayload } from '@/lib/server/serverMagicString';
|
||||
import { ensureConnectUrlResolved, invalidateReachableEndpointCache } from '@/lib/server/serverEndpoint';
|
||||
import {
|
||||
verifySameServerEndpoints,
|
||||
type VerifySameServerResult,
|
||||
} from '@/utils/server/serverFingerprint';
|
||||
} from '@/lib/server/serverFingerprint';
|
||||
import {
|
||||
indexKeyRemapForUrlChange,
|
||||
runIndexKeyRemigration,
|
||||
} from '@/utils/server/serverUrlRemigration';
|
||||
} from '@/lib/server/serverUrlRemigration';
|
||||
import { useConfirmModalStore } from '@/store/confirmModalStore';
|
||||
import { showToast } from '@/lib/dom/toast';
|
||||
import { FEATURE_AUDIOMUSE_SIMILAR_TRACKS } from '@/serverCapabilities/catalog';
|
||||
import { isFeatureActiveForServer, resolveFeatureForServer } from '@/serverCapabilities/storeView';
|
||||
import type { ResolvedCapability } from '@/serverCapabilities/types';
|
||||
import { serverIdentityLabel, serverListDisplayLabel, serverSettingsEntryTitle } from '@/utils/server/serverDisplayName';
|
||||
import { serverIndexKeyForProfile } from '@/utils/server/serverIndexKey';
|
||||
import { serverIdentityLabel, serverListDisplayLabel, serverSettingsEntryTitle } from '@/lib/server/serverDisplayName';
|
||||
import { serverIndexKeyForProfile } from '@/lib/server/serverIndexKey';
|
||||
import { switchActiveServer } from '@/utils/server/switchActiveServer';
|
||||
import { AddServerForm } from '@/features/settings/components/AddServerForm';
|
||||
import { ServerCapabilityHeaderBadge } from '@/features/settings/components/ServerCapabilityHeaderBadge';
|
||||
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
copyTextToClipboard,
|
||||
encodeServerMagicString,
|
||||
magicPayloadAddressFields,
|
||||
} from '@/utils/server/serverMagicString';
|
||||
import { shortHostFromServerUrl } from '@/utils/server/serverDisplayName';
|
||||
} from '@/lib/server/serverMagicString';
|
||||
import { shortHostFromServerUrl } from '@/lib/server/serverDisplayName';
|
||||
import { useAuthStore } from '@/store/authStore';
|
||||
|
||||
export interface UserFormState {
|
||||
|
||||
@@ -8,8 +8,8 @@ import {
|
||||
copyTextToClipboard,
|
||||
encodeServerMagicString,
|
||||
magicPayloadAddressFields,
|
||||
} from '@/utils/server/serverMagicString';
|
||||
import { shortHostFromServerUrl } from '@/utils/server/serverDisplayName';
|
||||
} from '@/lib/server/serverMagicString';
|
||||
import { shortHostFromServerUrl } from '@/lib/server/serverDisplayName';
|
||||
import { useAuthStore } from '@/store/authStore';
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -12,8 +12,8 @@ import { showToast } from '@/lib/dom/toast';
|
||||
import {
|
||||
copyTextToClipboard,
|
||||
encodeServerMagicString,
|
||||
} from '@/utils/server/serverMagicString';
|
||||
import { shortHostFromServerUrl } from '@/utils/server/serverDisplayName';
|
||||
} from '@/lib/server/serverMagicString';
|
||||
import { shortHostFromServerUrl } from '@/lib/server/serverDisplayName';
|
||||
import type { UserFormState } from '@/features/settings/components/UserForm';
|
||||
|
||||
interface UseUserMgmtActionsArgs {
|
||||
|
||||
@@ -21,7 +21,7 @@ import { searchSettings, type SettingsSearchHit } from '@/features/settings/comp
|
||||
import { type Tab, resolveTab } from '@/features/settings/components/settingsTabs';
|
||||
import { UserManagementSection } from '@/features/settings/components/UserManagementSection';
|
||||
import { ndLogin } from '@/lib/api/navidromeAdmin';
|
||||
import { type ServerMagicPayload } from '@/utils/server/serverMagicString';
|
||||
import { type ServerMagicPayload } from '@/lib/server/serverMagicString';
|
||||
|
||||
|
||||
export default function Settings() {
|
||||
|
||||
@@ -2,8 +2,8 @@ import { useAuthStore } from '@/store/authStore';
|
||||
import { usePlayerStore } from '@/features/playback/store/playerStore';
|
||||
import { useConnectionStatus } from '@/hooks/useConnectionStatus';
|
||||
import { useNavidromeAdminRole } from '@/hooks/useNavidromeAdminRole';
|
||||
import { serverListDisplayLabel } from '@/utils/server/serverDisplayName';
|
||||
import { findServerByIdOrIndexKey } from '@/utils/server/serverLookup';
|
||||
import { serverListDisplayLabel } from '@/lib/server/serverDisplayName';
|
||||
import { findServerByIdOrIndexKey } from '@/lib/server/serverLookup';
|
||||
import { PerfProbeMetricSection } from '@/features/sidebar/components/perfProbe/PerfProbeMetricCard';
|
||||
import PerfProbeDetailList from '@/features/sidebar/components/perfProbe/PerfProbeDetailList';
|
||||
import PerfProbeStatusBadge, { type PerfProbeBadgeTone } from '@/features/sidebar/components/perfProbe/PerfProbeStatusBadge';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAuthStore } from '@/store/authStore';
|
||||
import type { NavidromeAdminRole } from '@/hooks/useNavidromeAdminRole';
|
||||
import { isNavidromeServer, formatServerSoftware } from '@/utils/server/subsonicServerIdentity';
|
||||
import { isNavidromeServer, formatServerSoftware } from '@/lib/server/subsonicServerIdentity';
|
||||
import { FEATURE_AUDIOMUSE_SIMILAR_TRACKS, OP_SIMILAR_TRACKS } from '@/serverCapabilities/catalog';
|
||||
import {
|
||||
isFeatureActiveForServer,
|
||||
|
||||
Reference in New Issue
Block a user