sync fixes:

- file counter
- popup text
- default settings not syncing
This commit is contained in:
olcxja 2026-10-01 20:57:45 +02:00
commit b087db1b4d
4 changed files with 69 additions and 38 deletions

View file

@ -1337,13 +1337,13 @@ async function runLanSync(device, code, categories, force) {
state.lanPushing = true
window.plwl.onLanSyncProgress(data => {
if (!active) return
// Every line keeps its value while the sync moves between phases: hashing
// reports its own file counter, copying its own, and the bar follows the
// bytes the whole way through
// Every line keeps its value while the sync moves between phases: the
// file counter is CUMULATIVE across units (it never resets to 0/N with
// the next app) and phases that move no files simply do not touch it -
// only the byte bar follows the phase being worked on
phase.textContent = t('lansync.phase.' + data.phase, data.label || '').trim()
renderProgressBar(bar, ...barValues(data))
if (data.total > 0) count.textContent = t('lansync.progressFiles', data.done, data.total)
else count.textContent = ''
stats.textContent = lanStatsLine(data.items, data.itemsDone, data.totals)
bytes.textContent = lanBytesLine(data.bytes, data.totalBytes)
})
@ -1427,7 +1427,9 @@ function onLanIncoming(info) {
modal.querySelector('#ls-incoming-title').textContent = t('lansync.incomingTitle', name)
modal.querySelector('#ls-incoming-text').textContent = t('lansync.incomingText', name)
modal.querySelector('#ls-incoming-what').textContent = parts.length ? parts.join(' · ') : t('lansync.incomingNothing')
modal.querySelector('#ls-incoming-warning').textContent = t('lansync.mirrorWarning')
// the SENDER is the source of truth: the warning is phrased from this
// (receiving) side's point of view, not the send modal's mirrorWarning
modal.querySelector('#ls-incoming-warning').textContent = t('lansync.incomingMirror')
modal.querySelector('#ls-incoming-decline').textContent = t('lansync.decline')
modal.querySelector('#ls-incoming-accept').textContent = t('lansync.accept')
const answer = accept => {
@ -1563,19 +1565,24 @@ function renderReceiving(info) {
}
// Data received from another device changed the local files: reload every
// list so the views show the merged library instead of stale state.
// list so the views show the merged library instead of stale state. Settings
// too - a sync with "Default settings" rewrote the default wine/prefix on
// disk, and the settings view would keep showing the values from before.
async function reloadLocalData() {
const [wines, prefixes, games] = await Promise.all([
const [wines, prefixes, games, settings] = await Promise.all([
window.plwl.winesList(),
window.plwl.prefixesList(),
window.plwl.gamesList()
window.plwl.gamesList(),
window.plwl.settingsGet()
])
state.wines = wines
state.prefixes = prefixes
state.games = games
state.settings = settings
if (state.currentView === 'library') renderLibrary()
else if (state.currentView === 'wines') renderWines()
else if (state.currentView === 'prefixes') renderPrefixes()
else if (state.currentView === 'settings') renderSettings()
}
function wireLanSync() {