mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 06:25:41 +00:00
refactor(api): F.50 — extract 7 small domain modules (#615)
Seven domain-eng splits peel ~200 LOC of read endpoints out of `api/subsonic.ts`: - `subsonicStreamUrl.ts` — `buildStreamUrl`, `coverArtCacheKey`, `buildCoverArtUrl`, `buildDownloadUrl` (token-signed URL builders for the four /rest endpoints we hand to the browser). - `subsonicStarRating.ts` — `getStarred`, `star`, `unstar`, `setRating`, `probeEntityRatingSupport`. `setRating` still triggers the lazy `navidromeBrowse` cache invalidation; the same-folder lazy import path is preserved. - `subsonicSearch.ts` — `search`, `searchSongsPaged`. - `subsonicScrobble.ts` — `scrobbleSong`, `reportNowPlaying`, `getNowPlaying`. - `subsonicAlbumInfo.ts` — `getAlbumInfo2`. - `subsonicLyrics.ts` — `getLyricsBySongId`. - `subsonicGenres.ts` — `getGenres`, `getAlbumsByGenre`. 63 external call sites migrated to direct imports. Four `vi.mock` targets in the store-level tests pointed at `../api/subsonic` and were updated to the new module paths. Pure code-move. subsonic.ts: 762 → 561 LOC (−201).
This commit is contained in:
committed by
GitHub
parent
006635de4b
commit
9606a99efb
@@ -1,3 +1,4 @@
|
||||
import { probeEntityRatingSupport } from '../api/subsonicStarRating';
|
||||
import { getMusicFolders } from '../api/subsonicLibrary';
|
||||
import React, { Suspense, useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
@@ -37,7 +38,6 @@ import { useOrbitStore } from '../store/orbitStore';
|
||||
import { IS_LINUX, IS_MACOS, IS_WINDOWS } from '../utils/platform';
|
||||
import { useConnectionStatus } from '../hooks/useConnectionStatus';
|
||||
import { useAuthStore } from '../store/authStore';
|
||||
import { probeEntityRatingSupport } from '../api/subsonic';
|
||||
import { useOfflineStore } from '../store/offlineStore';
|
||||
import { usePlayerStore } from '../store/playerStore';
|
||||
import { useThemeStore } from '../store/themeStore';
|
||||
|
||||
@@ -13,7 +13,7 @@ import { showToast } from '../utils/toast';
|
||||
import { endOrbitSession, leaveOrbitSession } from '../utils/orbit';
|
||||
import { useOrbitStore } from '../store/orbitStore';
|
||||
import { useAuthStore } from '../store/authStore';
|
||||
import { search as subsonicSearch } from '../api/subsonic';
|
||||
import { search as subsonicSearch } from '../api/subsonicSearch';
|
||||
import i18n from '../i18n';
|
||||
import { switchActiveServer } from '../utils/switchActiveServer';
|
||||
import { usePlayerStore } from '../store/playerStore';
|
||||
|
||||
Reference in New Issue
Block a user