Migrate to Vite + ES module architecture
Split monolithic app.js (~1850 lines) into maintainable ES modules: - src/state.js — shared mutable state (S object) - src/utils.js — md5, esc, formatDur, toast - src/api.js — Subsonic API, Navidrome REST, iTunes API - src/player.js — playback, transport, queue, media session, preview - src/views.js — navigation, page loaders, card makers, search - src/ui.js — all modals, overlays, sidebar, settings - src/pwa.js — service worker registration + update banner - src/main.js — app init, connect, window globals Updated Dockerfile to multi-stage (Node build → nginx serve). Static assets (sw.js, manifest.json, icon.svg) moved to public/. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
ce53c48835
commit
9aded56713
18 files changed
+3134
-2
No files matched your search
@@ -0,0 +1,47 @@
|
||||
// Shared mutable state — imported as { S } in every module
|
||||
export const S = {
|
||||
cfg: { url: '', user: '', pass: '', lastfmKey: '', backendUrl: '' },
|
||||
|
||||
// Playback
|
||||
queue: [],
|
||||
qIdx: -1,
|
||||
shuffle: false,
|
||||
repeat: false,
|
||||
radioMode: false,
|
||||
audio: null,
|
||||
previewAudio: null,
|
||||
previewCurrent: null,
|
||||
_scrubbing: false,
|
||||
_msPosLast: 0,
|
||||
queueOpen: false,
|
||||
|
||||
// Now Playing overlay
|
||||
npOpen: false,
|
||||
npQueueMode: false,
|
||||
|
||||
// Navigation history
|
||||
_navStack: [],
|
||||
_navCursor: -1,
|
||||
_navJumping: false,
|
||||
|
||||
// Search
|
||||
searchTimer: null,
|
||||
globalSearchTimer: null,
|
||||
_mobileSearchTimer: null,
|
||||
|
||||
// Download
|
||||
downloadTarget: null,
|
||||
dlType: 'track',
|
||||
jobs: {},
|
||||
|
||||
// Playlists
|
||||
_currentPlaylist: null,
|
||||
plModalSongs: [],
|
||||
cachedPlaylists: [],
|
||||
|
||||
// Navidrome REST auth
|
||||
_ndToken: null,
|
||||
|
||||
// Artist images cache
|
||||
artistImgCache: {},
|
||||
};
|
||||
Reference in new issue
Block a user