diff options
Diffstat (limited to 'modules/core/module-system.js')
| -rw-r--r-- | modules/core/module-system.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/modules/core/module-system.js b/modules/core/module-system.js index 28a19f3..72735a7 100644 --- a/modules/core/module-system.js +++ b/modules/core/module-system.js @@ -17,7 +17,7 @@ 'bug-report': 'bug-report — Generate a markdown bug report to /tmp/ for debugging', 'preview': 'preview <file.html> — Render an HTML file from the VFS in a preview pane', 'factory-reset': 'factory-reset [--confirm] — Wipe all webx11_ data (VFS, config, AI profile, mindmaps, themes, all localStorage)', - 'reset-vfs': 'reset-vfs [--confirm] — Clear only the virtual filesystem (keeps settings, modules, AI profile)', + 'reset-vfs': 'reset-vfs [--confirm] — Clear virtual filesystem and auto-session backups (keeps settings, modules, AI profile)', 'logs': 'logs [n] [LEVEL] — Show last n log entries (optionally filtered by level: INFO/WARN/ERROR)', 'logrotate': 'logrotate — Rotate current.log to a dated archive (auto-cleans old)', 'health-check': 'health-check — Audit VFS size, modules, logs, trash, skills, tool failures', @@ -317,12 +317,16 @@ this.terminal.print('Type: factory-reset --confirm to proceed', 'error'); return; } + // v4.5.47: explicitly wipe VFS storage and session backups before clearing localStorage + try { + this.terminal.fs.deleteFile('_sessions/_auto.json'); + this.terminal.fs.deleteFile('_sessions/_auto-context.json'); + this.terminal.fs.reset(); + } catch (e) { console.warn('factory-reset FS cleanup:', e); } for (let i = localStorage.length - 1; i >= 0; i--) { const key = localStorage.key(i); if (key && key.startsWith('webx11_')) localStorage.removeItem(key); } - this.terminal.fs.root = { type: 'dir', content: {} }; - this.terminal.fs.currentPath = []; this.terminal.outputContainer.innerHTML = ''; this.terminal.print('✅ Factory reset complete. Reloading...', 'success'); setTimeout(() => location.reload(), 1000); @@ -338,6 +342,12 @@ } this.terminal.fs.root = { type: 'dir', content: {} }; this.terminal.fs.currentPath = []; + // v4.5.47: delete auto-session backups so they don't resurrect + try { + this.terminal.fs.deleteFile('_sessions/_auto.json'); + this.terminal.fs.deleteFile('_sessions/_auto-context.json'); + } catch (e) {} + localStorage.setItem('webx11_last_reset', Date.now().toString()); this.terminal.fs.saveToStorage(); this.terminal.print('✅ VFS reset complete. Reloading...', 'success'); setTimeout(() => location.reload(), 1000); |