aboutsummaryrefslogtreecommitdiff
path: root/modules/core/terminal.js
diff options
context:
space:
mode:
authorAgando <roduccomm@gmail.com>2026-05-26 06:00:26 +0200
committerAgando <roduccomm@gmail.com>2026-05-26 06:00:26 +0200
commitf4d934d341056142da1212c845eeeb170fd452c2 (patch)
tree55dd11c70d1342857537f4b0aeee6ea63d21545e /modules/core/terminal.js
parent4baa484b84c5184286cac2743575251454a5ee2b (diff)
auto: 2026-05-26_06:00 changes
Diffstat (limited to 'modules/core/terminal.js')
-rw-r--r--modules/core/terminal.js25
1 files changed, 18 insertions, 7 deletions
diff --git a/modules/core/terminal.js b/modules/core/terminal.js
index 0a9538f..ee1afa4 100644
--- a/modules/core/terminal.js
+++ b/modules/core/terminal.js
@@ -20,6 +20,7 @@
this._pipeBufferSize = 5000;
this._historyBuffer = [];
this._historyMaxLines = 50;
+ this._historySavePending = false;
this.MAX_OUTPUT_LINES = 200;
this._aiBusy = false;
this._dirty = false;
@@ -325,12 +326,17 @@
}
}
_saveHistory() {
- try {
- const slice = this._historyBuffer.slice(-30);
- localStorage.setItem('webx11_terminal_output', JSON.stringify(slice));
- } catch (e) {
- // Silently ignore storage errors (e.g. quota exceeded)
- }
+ if (this._historySavePending) return;
+ this._historySavePending = true;
+ setTimeout(() => {
+ this._historySavePending = false;
+ try {
+ const slice = this._historyBuffer.slice(-30);
+ localStorage.setItem('webx11_terminal_output', JSON.stringify(slice));
+ } catch (e) {
+ // Silently ignore storage errors (e.g. quota exceeded)
+ }
+ }, 3000);
}
_saveCommandHistory() {
try {
@@ -369,10 +375,15 @@
_autoSaveSession() {
try {
this.fs.mkdirRecursive('_sessions');
+ // Clone fsRoot and strip _sessions to prevent recursive nesting
+ var rootClone = JSON.parse(JSON.stringify(this.fs.root));
+ if (rootClone && rootClone.content && rootClone.content['_sessions']) {
+ delete rootClone.content['_sessions'];
+ }
const snapshot = {
type: 'session',
savedAt: new Date().toISOString(),
- fsRoot: this.fs.root,
+ fsRoot: rootClone,
currentPath: this.fs.currentPath,
version: 1,
terminalLines: this._historyBuffer.slice(-50)