From 6e25dd60b6ce3c369e41dc090a1493b3cd16bb0c Mon Sep 17 00:00:00 2001 From: ash-iir <254348575+ash-iir@users.noreply.github.com> Date: Sat, 28 Nov 2026 02:08:14 +0000 Subject: [PATCH 01/14] WebUI: optional New interface (opt-in, Classic stays default) Adds an opt-in second WebUI under module/webroot/next/ that reuses scripts.js, i18n and lang/ and keeps the same element ids, so every Classic control works the same in both interfaces. - Settings > Interface switches between Classic (default) and New. - Bottom tabs: Home, Backup, Restore, Schedule, More. - Restore shows local, Telegram, rclone, Google Drive, restic and mirror backups in one list with source/type/encrypted/pinned/tag filters and sort. - Compact progress bar; optional progress notification (off by default). - One dialog stack so a confirm always opens above its sheet. - helper.sh: bootstrap, restic-list; rclone-list mirrors flag; list-backups includes size. Existing verbs and outputs unchanged. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> --- docs/FILE-STRUCTURE.md | 2 + module/scripts/helper.sh | 42 +- module/scripts/worker.sh | 29 +- module/webroot/index.html | 13 + module/webroot/lang/ar.json | 50 +- module/webroot/lang/cs.json | 50 +- module/webroot/lang/de.json | 50 +- module/webroot/lang/en.js | 50 +- module/webroot/lang/en.json | 50 +- module/webroot/lang/es.json | 50 +- module/webroot/lang/fa.json | 50 +- module/webroot/lang/fr.json | 50 +- module/webroot/lang/hi.json | 50 +- module/webroot/lang/id.json | 50 +- module/webroot/lang/it.json | 50 +- module/webroot/lang/ja.json | 50 +- module/webroot/lang/ko.json | 50 +- module/webroot/lang/nl.json | 50 +- module/webroot/lang/pl.json | 50 +- module/webroot/lang/pt.json | 50 +- module/webroot/lang/ru.json | 50 +- module/webroot/lang/sv.json | 50 +- module/webroot/lang/th.json | 50 +- module/webroot/lang/tr.json | 50 +- module/webroot/lang/uk.json | 50 +- module/webroot/lang/vi.json | 50 +- module/webroot/lang/zh.json | 50 +- module/webroot/next/css/base.css | 107 +++ module/webroot/next/css/components.css | 377 ++++++++ module/webroot/next/css/screens.css | 199 ++++ module/webroot/next/css/tokens.css | 87 ++ module/webroot/next/index.html | 1166 ++++++++++++++++++++++++ module/webroot/next/js/boot.js | 102 +++ module/webroot/next/js/home.js | 149 +++ module/webroot/next/js/modals.js | 103 +++ module/webroot/next/js/restore.js | 272 ++++++ module/webroot/next/js/shell.js | 161 ++++ module/webroot/next/js/sources.js | 190 ++++ module/webroot/scripts.js | 5 + module/webroot/ui-switch.js | 86 ++ tools/screenshots/shoot_ui_next.py | 169 ++++ 41 files changed, 4382 insertions(+), 27 deletions(-) create mode 100644 module/webroot/next/css/base.css create mode 100644 module/webroot/next/css/components.css create mode 100644 module/webroot/next/css/screens.css create mode 100644 module/webroot/next/css/tokens.css create mode 100644 module/webroot/next/index.html create mode 100644 module/webroot/next/js/boot.js create mode 100644 module/webroot/next/js/home.js create mode 100644 module/webroot/next/js/modals.js create mode 100644 module/webroot/next/js/restore.js create mode 100644 module/webroot/next/js/shell.js create mode 100644 module/webroot/next/js/sources.js create mode 100644 module/webroot/ui-switch.js create mode 100644 tools/screenshots/shoot_ui_next.py diff --git a/docs/FILE-STRUCTURE.md b/docs/FILE-STRUCTURE.md index 5ce05f9e..aeae36b3 100644 --- a/docs/FILE-STRUCTURE.md +++ b/docs/FILE-STRUCTURE.md @@ -28,6 +28,8 @@ VD-Backup/ │ ├── i18n.js # translation engine (I18N.t / apply / init / set) │ ├── styles.css # dark theme │ ├── config.json # WebUI manifest (title, icon, strict CSP, no network) +│ ├── ui-switch.js # Interface switch: Classic (index.html, default) or New (next/) +│ ├── next/ # opt-in New interface: index.html + css/ + js/, shares scripts.js, i18n and lang/ │ ├── assets/ # logo-icon.svg, logo-wordmark.svg │ └── lang/ # en.js (fallback) + en.json + 20 more .json ├── README.md + README..md # English + the 21 standard languages diff --git a/module/scripts/helper.sh b/module/scripts/helper.sh index f70613c6..5b6c3785 100644 --- a/module/scripts/helper.sh +++ b/module/scripts/helper.sh @@ -141,7 +141,7 @@ backup_listing() { else "$JQ" -c '{package:.package.name, label:(.package.label // .package.name), icon:(.package.icon // ""), versionName:.package.versionName, versionCode:.package.versionCode, - created_at:.created_at, mode:.mode, types:[.items[].type], encrypted:false, locked:false}' "$_bl_m" 2>/dev/null + created_at:.created_at, mode:.mode, types:[.items[].type], size:([.items[].size // 0] | add // 0), encrypted:false, locked:false}' "$_bl_m" 2>/dev/null fi } @@ -676,9 +676,34 @@ case "$verb" in case "$_tsvc" in */*) continue ;; esac [ "$_first" = 1 ] || printf ','; _first=0 printf '{"dest":"%s","rref":"%s","package":"%s","tsvc":"%s"}' "$(jstr "$id")" "$(jstr "$_rref")" "$(jstr "$_pkg")" "$(jstr "$_tsvc")" - done; } + done + # mirrors:true also lists Mirror copies (//meta.json, one live copy per app, no ) + if [ "$(printf '%s' "$ARGS_B64" | base64 -d 2>/dev/null | "$JQ" -r '.mirrors // false' 2>/dev/null)" = true ]; then + "$_rc" --config "$SECRETS/rclone.conf" lsf -R --max-depth 2 --files-only --format tp --include meta.json "$rem:$pfx/" 2>/dev/null \ + | while IFS= read -r _l; do + _p="${_l#*;}"; _pkg="${_p%/meta.json}" + case "$_pkg" in ''|*/*) continue ;; esac + [ "$_first" = 1 ] || printf ','; _first=0 + printf '{"dest":"%s","rref":"%s","package":"%s","tsvc":"","mode":"mirror","mtime":"%s"}' "$(jstr "$id")" "$(jstr "$_pkg")" "$(jstr "$_pkg")" "$(jstr "${_l%%;*}")" + done + fi; } printf ']}\n' ;; + restic-list) + # list the Snapshot-mode snapshots of a restic destination (tagged vdbackup,), newest first. + # Restore takes one by id through restore {mode:"snapshot",dest,package,snapshot}. + JQ="$(command -v "$BIN/jq" 2>/dev/null || echo jq)" + id="$(printf '%s' "$ARGS_B64" | base64 -d 2>/dev/null | "$JQ" -r '.dest // empty' 2>/dev/null)" + f="$STATE/dests/$id.json" + { [ -n "$id" ] && [ -f "$f" ] && [ "$("$JQ" -r '.type // empty' "$f")" = restic ]; } || { err ERR_DEST_NONE "no such restic destination"; exit 0; } + repo="$("$JQ" -r '.repo // empty' "$f")" + _rs="$(command -v "$BIN/restic" 2>/dev/null || command -v "$STATE/bin/restic" 2>/dev/null || echo restic)" + _o="$(RCLONE_CONFIG="$SECRETS/rclone.conf" RESTIC_PASSWORD_FILE="$SECRETS/creds/$id.pass" "$_rs" -r "$repo" snapshots --json --tag vdbackup 2>/dev/null)" + [ -n "$_o" ] || { err ERR_RESTIC "could not list the restic snapshots"; exit 0; } + printf '%s' "$_o" | "$JQ" -c --arg d "$id" '{ok:true, dest:$d, backups:([.[]? | {dest:$d, id:.id, short_id:.short_id, time:.time, + package:(((.tags // []) | map(select(. != "vdbackup")))[0] // ""), size:(.summary.total_bytes_processed // 0)}] | sort_by(.time) | reverse)}' 2>/dev/null \ + || err ERR_RESTIC "could not list the restic snapshots" ;; + gdrive-list) # list Full backups stored on a Google Drive destination (via the companion, which walks the # vdbackup/// Drive folders). Same entry shape as rclone-list plus a Drive `folder` id @@ -1029,7 +1054,7 @@ case "$verb" in printf '%s' "$(backup_listing "$ref")" | "$JQ" -c --arg ref "$ref" --argjson hasapk "$_hasapk" --argjson nt "$_nt" --argjson pin "$_pin" \ '{ref:$ref, package:.package, label:.label, versionName:.versionName, versionCode:.versionCode, created_at:.created_at, mode:.mode, - note:$nt.note, tags:$nt.tags, pinned:$pin, encrypted:.encrypted, locked:.locked, + note:$nt.note, tags:$nt.tags, pinned:$pin, encrypted:.encrypted, locked:.locked, size:(.size // 0), items:((if $hasapk then ["apk"] else [] end) + .types)}' 2>/dev/null done done < "$PROG"; } + "$OPID" "$1" "$(jstr "$2")" "$(jstr "$3")" "$(jstr "$4")" "$(jstr "$5")" "$_pxn" "$_pxo" "$(jstr "$8")" > "$PROG" + prog_notify "$1" "${8:-$3}"; } +# Optional progress notification (config notify_progress, default off): text-only "42% - item", +# posted in the background on the op's own tag (the start/done notices reuse it), at most every +# 5 s and never while the previous post is still running. State file: "