Player: opening the PWA no longer auto-plays when the user had paused. Pausing via the media notification while backgrounded routes through togglePlay, which now sets S._userPaused; _onForeground only auto-resumes an INVOLUNTARY background stop (_wasPlayingBeforeHide && !_userPaused). playCurrent clears the flag on a new track. Involuntary-stop/freeze recovery on foreground is preserved. Stats modal: no more small→big flash when switching period/tab — the body keeps a stable min-height and retains its current content until the new data arrives (only the first open shows 'Lade…'); a per-request token drops out-of-order responses. SW cache -> ns-v71. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
75 lines
1.4 KiB
JavaScript
75 lines
1.4 KiB
JavaScript
// Shared mutable state — imported as { S } in every module
|
|
export const S = {
|
|
cfg: { url: '', user: '', pass: '', lastfmKey: '', backendUrl: '', scrobbleUrl: '', showPlayCount: false, showRomaji: false },
|
|
|
|
// Playback
|
|
queue: [],
|
|
qIdx: -1,
|
|
_origQueue: null,
|
|
shuffle: false,
|
|
repeat: false,
|
|
radioMode: false,
|
|
audio: null,
|
|
previewAudio: null,
|
|
previewCurrent: null,
|
|
_scrubbing: false,
|
|
_msPosLast: 0,
|
|
_trackChanging: false,
|
|
_userPaused: false, // true when the user deliberately paused → foreground must NOT auto-resume
|
|
queueOpen: false,
|
|
|
|
// Now Playing overlay
|
|
npOpen: false,
|
|
npQueueMode: false,
|
|
npLyricsMode: false,
|
|
|
|
// Navigation history
|
|
_navStack: [],
|
|
_navCursor: -1,
|
|
_navJumping: false,
|
|
|
|
// Search
|
|
searchTimer: null,
|
|
globalSearchTimer: null,
|
|
_mobileSearchTimer: null,
|
|
|
|
// Song info / edit
|
|
infoSong: null,
|
|
|
|
// Download
|
|
downloadTarget: null,
|
|
dlType: 'track',
|
|
jobs: {},
|
|
|
|
// Playlists
|
|
_currentPlaylist: null,
|
|
plModalSongs: [],
|
|
cachedPlaylists: [],
|
|
|
|
// Navidrome REST auth
|
|
_ndToken: null,
|
|
|
|
// Artist images cache
|
|
artistImgCache: {},
|
|
|
|
// Audiobookshelf
|
|
abs: {
|
|
url: '', token: null, userId: null,
|
|
currentLibraryId: null,
|
|
},
|
|
absPlayer: {
|
|
open: false,
|
|
item: null,
|
|
_sessionId: null,
|
|
audioTracks: [],
|
|
trackIdx: 0,
|
|
chapters: [],
|
|
chapterIdx: -1,
|
|
playing: false,
|
|
currentTime: 0,
|
|
duration: 0,
|
|
speed: 1.0,
|
|
sleepRemaining: null,
|
|
},
|
|
};
|