mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
refactor(auth): E.45 — extract seven settings factories (#610)
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).
This commit is contained in:
committed by
GitHub
parent
b8ddb09b78
commit
fe6acdaa4c
@@ -0,0 +1,26 @@
|
||||
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 }),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user