@@ -769,10 +769,14 @@
- Backups are encrypted with a password derived from your
- master password (so restore needs the master at the
- time of backup). Filename pattern: vault-autobackup-YYYYMMDD-HHmmss.json.
+ Backups are encrypted with a password you choose
+ (independent of your master password — you'll need it
+ to restore). Filename pattern: vault-autobackup-YYYYMMDD-HHmmss.json.
+
+ Set backup password
+
+
Backup now
diff --git a/js/app.backup.js b/js/app.backup.js
index ee65f42..2a82851 100644
--- a/js/app.backup.js
+++ b/js/app.backup.js
@@ -59,6 +59,18 @@ function refreshAutoBackupUI(cfg) {
$('#autoBackupLast').textContent = cfg.last
? 'Last run: ' + cfg.last.replace('T', ' ').slice(0, 16)
: 'Never run yet';
+ $('#autoBackupSetPwdBtn').textContent = cfg.hasPwd
+ ? 'Change backup password' : 'Set backup password';
+ const pwdStatus = $('#autoBackupPwdStatus');
+ if (cfg.hasPwd) {
+ pwdStatus.innerHTML = '';
+ pwdStatus.style.color = 'var(--text-faint)';
+ pwdStatus.textContent = 'Set.';
+ } else {
+ pwdStatus.style.color = 'var(--warning, #e0a800)';
+ pwdStatus.innerHTML = ' ' +
+ 'Not set — backups won\'t run ';
+ }
}
async function pickAutoBackupFolder() {
@@ -100,27 +112,32 @@ async function promptAndStoreBackupPwd() {
async function onToggleAutoBackup(ev) {
const enabled = ev.target.checked;
if (enabled) {
- const cfg = await loadAutoBackupConfig();
- if (!cfg.hasPwd && !(await promptAndStoreBackupPwd())) {
- ev.target.checked = false;
- return;
- }
Bridge.setPref(ABK.enabled, '1');
$('#autoBackupConfig').style.display = '';
- toast('Auto-backup enabled');
- // Refresh the dir/last display in case we came from cold state.
- const fresh = await loadAutoBackupConfig();
- refreshAutoBackupUI(fresh);
+ // No pwd prompt here — the dedicated "Set backup password" button
+ // owns it (like sync). Backups no-op until it's set.
+ const cfg = await loadAutoBackupConfig();
+ refreshAutoBackupUI(cfg);
+ toast(cfg.hasPwd ? 'Auto-backup enabled'
+ : 'Auto-backup enabled — set a backup password to start');
} else {
Bridge.setPref(ABK.enabled, '');
- // Forget the stored backup pwd so re-enabling prompts fresh —
- // gives the user a way to change it without extra UI.
- Bridge.setPref(ABK.pwd, '');
+ // Keep the stored pwd — re-enabling reuses it silently. Change it
+ // anytime via the dedicated "Change backup password" button.
$('#autoBackupConfig').style.display = 'none';
toast('Auto-backup disabled');
}
}
+// Dedicated pwd button (mirrors sync's syncSetEncPwdFlow) so the user can
+// change the backup password without the disable/re-enable dance.
+async function changeBackupPwd() {
+ if (await promptAndStoreBackupPwd()) {
+ refreshAutoBackupUI(await loadAutoBackupConfig());
+ toast('Backup password saved');
+ }
+}
+
async function runAutoBackupNow(silent) {
const cfg = await loadAutoBackupConfig();
if (!cfg) return silent || toast('Bridge not available', 'error');
diff --git a/js/app.js b/js/app.js
index 645659e..7ad20a9 100644
--- a/js/app.js
+++ b/js/app.js
@@ -8994,6 +8994,7 @@ async function init() {
e.target.value = n;
Bridge.setPref(ABK.keep, String(n));
});
+ $('#autoBackupSetPwdBtn').addEventListener('click', changeBackupPwd);
$('#autoBackupNowBtn').addEventListener('click', () => runAutoBackupNow());
$('#settingFavicons').addEventListener('change', e => {