From 39f727610535df859c6dbee98d972349ca4b4da6 Mon Sep 17 00:00:00 2001 From: ash-iir <254348575+ash-iir@users.noreply.github.com> Date: Thu, 19 Nov 2026 12:29:18 +0000 Subject: [PATCH 1/5] webroot: batch and lazy-load backup-list icons The backup list started one backup-icon helper call per row on every render (search keystroke, select toggle), and any failed call cached "no icon" for that backup for good. - New backup-icons helper verb: {refs:[...]} -> {ok, icons:{ref: b64 or ""}}, one process per batch. - Backup icons load through iconObserver like app icons, in batches of ICON_BATCH, with one in-flight request per ref. - Only an answered ref is cached; "" caches as no icon, a failed call is retried on a later render. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit d3fcf12a7fbadfa4db6dba5c299731e1497e5653) --- docs/AI-AGENTS.md | 1 + module/scripts/helper.sh | 11 +++++++++++ module/webroot/scripts.js | 41 +++++++++++++++++++++++++++++++-------- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/docs/AI-AGENTS.md b/docs/AI-AGENTS.md index 7868955..ddbc2be 100644 --- a/docs/AI-AGENTS.md +++ b/docs/AI-AGENTS.md @@ -67,6 +67,7 @@ destinations (`rclone`/`restic`/ssh) talk to the network. | `provenance` | `{}` | the bundled-binary audit manifest (`PROVENANCE.json`). | | `backup-info` | `{ref}` | `{ok,...}` one backup's full details (version, install source, state, date, mode, size, items, permission counts, device) | | `backup-icon` | `{ref}` | `{ok,icon}` base64 PNG from the manifest (works when the app is uninstalled) | +| `backup-icons` | `{refs:[...]}` | `{ok,icons:{:}}` batched `backup-icon`; `""` = no icon, unknown refs left out | | `delete-backup` | `{ref}` | `{ok,deleted}` (ref must be under the backups dir) | | `prune` | `{package,user?,keep}` | `{ok,pruned:[...]}` keep newest N of a package | | `log-read` | `{limit?}` | `{ok,entries:[...]}` audit log, newest first | diff --git a/module/scripts/helper.sh b/module/scripts/helper.sh index ec3518e..5719406 100644 --- a/module/scripts/helper.sh +++ b/module/scripts/helper.sh @@ -1018,6 +1018,17 @@ EOF ic="$("$JQ" -r '.package.icon // empty' "$m" 2>/dev/null)" if [ -n "$ic" ]; then ok "\"icon\":\"$ic\""; else err ERR_ICON "no icon in manifest"; fi ;; + backup-icons) + # batched backup-icon: {refs:[...]} -> {ok:true,icons:{:}}, "" = the backup + # has no icon. Invalid refs and refs without a manifest are left out of the map. + JQ="$(command -v "$BIN/jq" 2>/dev/null || echo jq)" + printf '%s' "$ARGS_B64" | base64 -d 2>/dev/null | "$JQ" -r '.refs[]? | strings' 2>/dev/null \ + | while IFS= read -r ref; do + [ -n "$(ref_root "$ref")" ] || continue + [ -f "$ref/manifest.json" ] || continue + "$JQ" -c --arg r "$ref" '{($r): (.package.icon // "")}' "$ref/manifest.json" 2>/dev/null + done | "$JQ" -s -c '{ok:true, icons:(add // {})}' ;; + delete-backup) ref="$(printf '%s' "$ARGS_B64" | base64 -d 2>/dev/null | \ "$(command -v "$BIN/jq" 2>/dev/null || echo jq)" -r '.ref // empty' 2>/dev/null)" diff --git a/module/webroot/scripts.js b/module/webroot/scripts.js index 9532a0a..c9555c2 100644 --- a/module/webroot/scripts.js +++ b/module/webroot/scripts.js @@ -272,7 +272,8 @@ function cacheIcon(pkg, vc, b64) { // instead of one process per icon. Cache hits are instant. var _iconQ = [], _iconTimer = null, ICON_BATCH = 40; function loadIcon(ic) { - var pkg = ic.dataset.pkg; if (!pkg) return; + var pkg = ic.dataset.pkg; + if (!pkg) { if (ic.dataset.bref) loadBackupIcon(ic, ic.dataset.bref); return; } var vc = ic.dataset.vc || "0", cached = null; try { cached = localStorage.getItem(iconKey(pkg, vc)); } catch (e) {} if (cached) { setIcon(ic, cached); return; } @@ -391,8 +392,11 @@ function bkMatch(b, q) { || ((b.package || "").toLowerCase().indexOf(q) >= 0) || ((b.tags || []).some(function (t) { return (t || "").toLowerCase().indexOf(q) >= 0; })); } +var _bkIcons = []; function renderBackups(list) { var ul = $("#backuplist"); ul.innerHTML = ""; + if (iconObserver) _bkIcons.forEach(function (ic) { iconObserver.unobserve(ic); }); + _bkIcons = []; BACKUPS = list || []; var q = (bkQuery || "").toLowerCase().trim(); var shown = q ? BACKUPS.filter(function (b) { return bkMatch(b, q); }) : BACKUPS; @@ -421,7 +425,9 @@ function renderBackups(list) { li.onclick = function () { openBackupInfo(b); }; } ul.appendChild(li); - loadBackupIcon(ic, b.ref); // icon comes from the manifest, not the live app + // icon comes from the manifest, not the live app; loaded lazily on scroll, like app icons + ic.dataset.bref = b.ref || ""; _bkIcons.push(ic); + if (iconObserver) iconObserver.observe(ic); else loadBackupIcon(ic, b.ref); }); } function toggleBkSel(b, on) { @@ -457,15 +463,34 @@ function startBatchRestore() { } // Backup-list icon: read the icon stored in the manifest, so it shows even when // the app is uninstalled. Cached per backup ref; "0" marks a backup with no icon. +// Batched like app icons (one helper call per ICON_BATCH refs), and a ref already +// being fetched is not asked for again: re-renders just add their icon to the wait list. +var _bicQ = [], _bicTimer = null, _bicPending = {}; function loadBackupIcon(ic, ref) { if (!ref) return; - var key = "vdb_bic:" + ref, cached = null; - try { cached = localStorage.getItem(key); } catch (e) {} + var cached = null; + try { cached = localStorage.getItem("vdb_bic:" + ref); } catch (e) {} if (cached) { if (cached !== "0") setIcon(ic, cached); return; } - helper("backup-icon", { ref: ref }).then(function (r) { - if (r && r.ok && r.icon) { try { localStorage.setItem(key, r.icon); } catch (e) {} setIcon(ic, r.icon); } - else { try { localStorage.setItem(key, "0"); } catch (e) {} } - }); + if (_bicPending[ref]) { _bicPending[ref].push(ic); return; } + _bicPending[ref] = [ic]; _bicQ.push(ref); + if (_bicQ.length >= ICON_BATCH) flushBackupIcons(); + else if (!_bicTimer) _bicTimer = setTimeout(flushBackupIcons, 120); +} +function flushBackupIcons() { + if (_bicTimer) { clearTimeout(_bicTimer); _bicTimer = null; } + if (!_bicQ.length) return; + var refs = _bicQ.splice(0, ICON_BATCH); + var done = function (map) { + refs.forEach(function (ref) { + var ics = _bicPending[ref] || []; delete _bicPending[ref]; + // only an answered ref is cached ("" = no icon); a failed call is retried on a later render + if (!map || !Object.prototype.hasOwnProperty.call(map, ref)) return; + try { localStorage.setItem("vdb_bic:" + ref, map[ref] || "0"); } catch (e) {} + if (map[ref]) ics.forEach(function (ic) { setIcon(ic, map[ref]); }); + }); + }; + helper("backup-icons", { refs: refs }).then(function (r) { done(r && r.ok && r.icons); }, function () { done(null); }); + if (_bicQ.length) _bicTimer = setTimeout(flushBackupIcons, 0); // drain remaining } // backup details (tap a backup entry) function openBackupInfo(b) { From 5d5a628ac75aad18bcde5f969db75749167c4796 Mon Sep 17 00:00:00 2001 From: ash-iir <254348575+ash-iir@users.noreply.github.com> Date: Thu, 19 Nov 2026 12:42:07 +0000 Subject: [PATCH 2/5] webroot: drop backdrop-filter from the sticky bars and the modal scrim A blur behind the sticky top bar and the fixed bottom tabs makes the compositor re-blur what scrolls under them on every frame, which is the main source of scroll stutter. Use the opaque page background instead (the bars were already 86-90% opaque, so the look barely changes) and a slightly darker scrim for modals. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit 99a9b48423678928adb27783634003379ca81efc) --- module/webroot/styles.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/module/webroot/styles.css b/module/webroot/styles.css index d02dda6..46e76ce 100644 --- a/module/webroot/styles.css +++ b/module/webroot/styles.css @@ -98,8 +98,9 @@ body { display: flex; align-items: center; gap: 12px; padding: 14px 16px calc(14px) 16px; padding-top: calc(14px + env(safe-area-inset-top)); - background: color-mix(in srgb, var(--bg) 86%, transparent); - backdrop-filter: saturate(140%) blur(10px); + /* opaque, no backdrop-filter: a blur under a sticky bar re-composites everything that + scrolls beneath it every frame, which is what made scrolling stutter in the WebView */ + background: var(--bg); border-bottom: 1px solid var(--line); } .topbar .logo { width: 38px; height: 38px; border-radius: 10px; flex: none; } @@ -253,8 +254,7 @@ button { cursor: pointer; font-family: inherit; } position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; gap: 2px; padding: 6px 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: calc(6px + env(safe-area-inset-bottom)); - background: color-mix(in srgb, var(--bg) 90%, transparent); - backdrop-filter: saturate(140%) blur(12px); + background: var(--bg); /* opaque, no backdrop-filter (see .topbar) */ border-top: 1px solid var(--line); } .tabs::-webkit-scrollbar { display: none; } @@ -312,7 +312,7 @@ button { cursor: pointer; font-family: inherit; } /* ---- modal (floating, centered) ---- */ .modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; - justify-content: center; background: rgba(2,6,16,.66); backdrop-filter: blur(2px); + justify-content: center; background: rgba(2,6,16,.72); padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom)); } .modal[hidden] { display: none; } /* the generic confirm/alert always opens on top of another modal (e.g. delete from From d6c6335363f13f3afc2f7af8b0d4f7629ff35391 Mon Sep 17 00:00:00 2001 From: ash-iir <254348575+ash-iir@users.noreply.github.com> Date: Thu, 19 Nov 2026 12:45:53 +0000 Subject: [PATCH 3/5] webroot: build the Settings app pickers only while Settings is shown loadApps rebuilt the Excluded apps and Per-app items pickers on every app list load, so the full list was rendered three times on boot (and on every refresh or user switch) while the Settings tab was hidden. loadSettings already rebuilds both pickers when the tab opens; skip the build while it is not shown. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit 9f8134e7ecd91e9f04fa886944ca5a16df5c30ad) --- module/webroot/scripts.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/module/webroot/scripts.js b/module/webroot/scripts.js index c9555c2..67f1f2d 100644 --- a/module/webroot/scripts.js +++ b/module/webroot/scripts.js @@ -2048,8 +2048,12 @@ function setBlock(pkg, on) { // persist CFG; surface a failure instead of letting the in-memory toggle silently diverge from disk function saveCfg() { helper("config-set", CFG).then(function (r) { if (r && r.ok === false) modalAlert(errMsg(r)); }).catch(function () { modalAlert(errMsg()); }); } function persistBlocklist() { saveCfg(); } +// The Settings pickers each hold a row per app. They are built only while the Settings tab is +// shown (loadSettings rebuilds both whenever the tab opens), so loading the app list on the Apps +// tab no longer renders every app three times. +function settingsShown() { var p = $("#settings"); return !!(p && p.classList.contains("active")); } function buildBlockPicker() { - var ul = $("#block-applist"); if (!ul) return; + var ul = $("#block-applist"); if (!ul || !settingsShown()) return; if (iconObserver) _blockIcons.forEach(function (ic) { iconObserver.unobserve(ic); }); _blockIcons = []; ul.innerHTML = ""; visibleApps("", true).forEach(function (a) { @@ -2129,7 +2133,7 @@ function openAppItemsModal(pkg, label) { } function closeAppItemsModal() { $("#appitems-modal").hidden = true; _aiPkg = null; } function buildAppItemsPicker() { - var ul = $("#ai-applist"); if (!ul) return; + var ul = $("#ai-applist"); if (!ul || !settingsShown()) return; if (iconObserver) _aiIcons.forEach(function (ic) { iconObserver.unobserve(ic); }); _aiIcons = []; ul.innerHTML = ""; visibleApps("", true).forEach(function (a) { From b2b2519e3e32a8daf0b675268a4130d5d6bf803d Mon Sep 17 00:00:00 2001 From: ash-iir <254348575+ash-iir@users.noreply.github.com> Date: Thu, 19 Nov 2026 12:47:35 +0000 Subject: [PATCH 4/5] webroot: request the app list first on boot The manager bridge runs one exec at a time, so call order is load order. Boot queued sanitize, dests-list, remote-list, pass-status, overview and list-ops ahead of list-apps, so the first screen waited behind calls only other tabs need. loadUsers/loadApps now return their promise; the other boot calls are queued once the app list request has settled. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit 09bbbd16480cff2b977b0e0fd68293f01d7a18a9) --- module/webroot/scripts.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/module/webroot/scripts.js b/module/webroot/scripts.js index 67f1f2d..8ff010b 100644 --- a/module/webroot/scripts.js +++ b/module/webroot/scripts.js @@ -226,8 +226,8 @@ function setupBackNav() { // --- users -------------------------------------------------------------- var USERS = []; var activeUser = 0; -function loadUsers() { - helper("list-users").then(function (r) { +function loadUsers() { // returns a promise that settles once the app list request has + return helper("list-users").then(function (r) { USERS = (r && r.users) ? r.users : []; var sel = $("#user-sel"), field = $("#user-field"); if (sel) { @@ -242,7 +242,7 @@ function loadUsers() { sel.value = activeUser; if (field) field.hidden = USERS.length <= 1; } - loadApps(); + return loadApps(); }); } @@ -370,7 +370,7 @@ function setSelectMode(on) { } function loadApps() { $("#applist").innerHTML = "
  • " + I18N.t("apps_loading") + "
  • "; - helper("list-apps", { user: activeUser }).then(function (r) { + return helper("list-apps", { user: activeUser }).then(function (r) { APPS = (r && r.apps) ? r.apps : []; buildTagChips(); renderApps($("#search").value); @@ -2992,13 +2992,20 @@ function boot() { initVdlu(); // VDLU: evaluate reboot banner + auto_on_webui_open on load (panel mounts on tab open) helper("config-get").then(function (c) { CFG = c || {}; activeUser = (CFG.user != null) ? (CFG.user | 0) : 0; return I18N.init(CFG.language || "auto"); }) - .then(function () { I18N.apply(); loadDests(); loadSettings(); loadUsers(); loadOverview(); reattachOps(); recoverPendingAuth(); deferredUpdateCheck(); }); + .then(function () { + I18N.apply(); + // The bridge runs one exec at a time, so call order is load order. The app list is the + // first screen: ask for it first, and queue what the other tabs need only behind it. + var rest = function () { + loadOverview(); reattachOps(); loadDests(); loadSettings(); recoverPendingAuth(); deferredUpdateCheck(); + helper("sanitize").catch(function () {}); // self-heal backup-folder perms, fire-and-forget + }; + loadUsers().then(rest, rest); + }); helper("ping").then(function (r) { if (r && r.version) { $("#ver").textContent = r.version; if ($("#about-ver")) $("#about-ver").textContent = r.version + " - " + (r.abi || ""); } }); - // self-heal backup-folder perms once per load (fire-and-forget, never blocks the UI). - helper("sanitize").catch(function () {}); } document.addEventListener("DOMContentLoaded", boot); From 12146381f74b57a210779a9e7704aa10a39e0c4c Mon Sep 17 00:00:00 2001 From: ash-iir <254348575+ash-iir@users.noreply.github.com> Date: Thu, 19 Nov 2026 12:48:23 +0000 Subject: [PATCH 5/5] webroot: no text selection or callout on long-press of controls A long press on a tab, button or tappable row started a text selection and the WebView callout menu, which is what makes the UI feel like a web page. Turn off user-select and the touch callout on controls and row labels, and set touch-action: manipulation on tappable elements. Text in notices, dialogs and the log stays selectable. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit c7d66872632130aeaced8aa9186469c78ff8a61f) --- module/webroot/styles.css | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/module/webroot/styles.css b/module/webroot/styles.css index 46e76ce..162fa4e 100644 --- a/module/webroot/styles.css +++ b/module/webroot/styles.css @@ -80,6 +80,13 @@ html[data-theme="light"] { } * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; } +/* Controls behave like app controls: a long press on a tab, button or tappable row no longer + starts a text selection or the link/callout menu, and taps skip the double-tap-zoom wait. + Text in rows, notices and dialogs stays selectable. */ +.tabs, .tab, .btn, .icon-btn, .segment, .row.tappable .name, .row.tappable .pkg, summary.section-head { + -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; +} +button, .tab, .row.tappable, summary, input[type="checkbox"] { touch-action: manipulation; } html, body { margin: 0; } body { background: var(--bg); color: var(--text);