mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
fe6acdaa4c
Seven small domain-eng factories peel ~53 trivial setters out of the authStore body: - `createCacheStorageActions` — disk caches (max cache MB, download folder, offline download dir, hot-cache enable/MB/debounce/dir). - `createDiscordSettingsActions` — rich presence, cover source, Bandsintown toggle, three template strings. - `createUiAppearanceActions` — visual chrome: tray, titlebar, sidebar toggles, fullscreen-lyrics rendering, changelog banner, seekbar style, queue collapse, kinetic scroll, mini-player preload. - `createLyricsSettingsActions` — lyrics fetch pipeline (server-first, netease enablement, source order, mode, static-only). - `createTrackPreviewActions` — preview enable + per-location + start ratio (clamped 0…0.9) + duration (clamped 5…120s). - `createDiscoveryActions` — mix min-rating filters (clamped 0…3), random-mix size (snapped to allowed bucket), lucky-mix visibility, random-nav mode, infinite-queue, preserve-play-next-order. - `createPlumbingSettingsActions` — logging mode, getNowPlaying toggle, preload mode + custom seconds, audiobook exclusion, genre blacklist. Pure code-move. authStore.ts: 428 → 384 LOC (−44).
27 lines
861 B
TypeScript
27 lines
861 B
TypeScript
import type { AuthState } from './authStoreTypes';
|
|
|
|
type SetState = (
|
|
partial: Partial<AuthState> | ((state: AuthState) => Partial<AuthState>),
|
|
) => void;
|
|
|
|
export function createCacheStorageActions(set: SetState): Pick<
|
|
AuthState,
|
|
| 'setMaxCacheMb'
|
|
| 'setDownloadFolder'
|
|
| 'setOfflineDownloadDir'
|
|
| 'setHotCacheEnabled'
|
|
| 'setHotCacheMaxMb'
|
|
| 'setHotCacheDebounceSec'
|
|
| 'setHotCacheDownloadDir'
|
|
> {
|
|
return {
|
|
setMaxCacheMb: (v) => set({ maxCacheMb: v }),
|
|
setDownloadFolder: (v) => set({ downloadFolder: v }),
|
|
setOfflineDownloadDir: (v) => set({ offlineDownloadDir: v }),
|
|
setHotCacheEnabled: (v) => set({ hotCacheEnabled: v }),
|
|
setHotCacheMaxMb: (v) => set({ hotCacheMaxMb: v }),
|
|
setHotCacheDebounceSec: (v) => set({ hotCacheDebounceSec: v }),
|
|
setHotCacheDownloadDir: (v) => set({ hotCacheDownloadDir: v }),
|
|
};
|
|
}
|