Unify backup/restore into single v2.0 file with full state capture

Server export now includes encryption key, themes, and all config files.
Client export bundles all DashCaddy localStorage keys (19 named + dynamic
widget keys) as browserState. Restore handles both server and browser
state in one operation. Legacy v1.0 import format still supported.
Removed redundant Export/Import toolbar buttons — Backup modal is now
the single entry point.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 21:06:56 -07:00
parent 6d098fd96f
commit 75e2d7853e
5 changed files with 375 additions and 287 deletions

View File

@@ -315,6 +315,14 @@ function decryptWithKey(encryptedData, key) {
// Initialize key on module load
loadOrCreateKey();
/**
* Clear the cached encryption key so it reloads from file on next use.
* Called after restoring an encryption key from backup.
*/
function clearCachedKey() {
encryptionKey = null;
}
module.exports = {
encrypt,
decrypt,
@@ -327,5 +335,6 @@ module.exports = {
loadOrCreateKey,
deriveKey,
rotateKey,
decryptWithKey
decryptWithKey,
clearCachedKey
};