@lethevimlet/sshift 1.1.4 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lethevimlet/sshift",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Web-based SSH + SFTP terminal client with tabs and bookmarks",
5
5
  "main": "src/server/index.js",
6
6
  "bin": {
@@ -3195,6 +3195,9 @@ body.dragging-tabs .tabs-container {
3195
3195
  display: flex;
3196
3196
  flex-direction: column;
3197
3197
  gap: 8px;
3198
+ max-height: calc(100vh - 40px);
3199
+ overflow-y: auto;
3200
+ pointer-events: none;
3198
3201
  }
3199
3202
 
3200
3203
  .toast {
@@ -3358,14 +3358,17 @@ const wheelHandler = (e) => {
3358
3358
  setupSocketListeners() {
3359
3359
  this.socket.on('connect', () => {
3360
3360
  console.log('[SSHIFT] Connected to server, socket ID:', this.socket.id);
3361
- this.showToast('Connected to server', 'success');
3362
- // Reload bookmarks to sync any changes that happened while disconnected
3361
+ if (!this.isUpdating) {
3362
+ this.showToast('Connected to server', 'success');
3363
+ }
3363
3364
  this.loadBookmarks();
3364
3365
  });
3365
3366
 
3366
3367
  this.socket.on('disconnect', (reason) => {
3367
3368
  console.log('[SSHIFT] Disconnected from server:', reason);
3368
- this.showToast('Disconnected from server: ' + reason, 'error');
3369
+ if (!this.isUpdating) {
3370
+ this.showToast('Disconnected from server: ' + reason, 'error');
3371
+ }
3369
3372
  });
3370
3373
 
3371
3374
  this.socket.on('connect_error', (error) => {
@@ -3374,7 +3377,7 @@ const wheelHandler = (e) => {
3374
3377
  this.authToken = null;
3375
3378
  localStorage.removeItem('sshift_auth_token');
3376
3379
  this.showLockScreen();
3377
- } else {
3380
+ } else if (!this.isUpdating) {
3378
3381
  this.showToast('Connection error: ' + error.message, 'error');
3379
3382
  }
3380
3383
  });
@@ -6763,14 +6766,6 @@ const wheelHandler = (e) => {
6763
6766
  }
6764
6767
  });
6765
6768
 
6766
- // Handle binary input (control characters, etc.) that onData may not capture
6767
- terminal.onBinary((data) => {
6768
- const sess = this.sessions.get(sessionId);
6769
- if (sess && sess.connected && sess.isController) {
6770
- this.socket.emit('ssh-data', { sessionId, data: data });
6771
- }
6772
- });
6773
-
6774
6769
  // Handle resize
6775
6770
  terminal.onResize(({ cols, rows }) => {
6776
6771
  const sess = this.sessions.get(sessionId);
@@ -10401,7 +10396,20 @@ async syncTabsFromServer(tabs) {
10401
10396
 
10402
10397
  // Toast Notifications
10403
10398
  showToast(message, type = 'info') {
10399
+ const MAX_TOASTS = 5;
10400
+ const DEDUP_INTERVAL = 3000;
10404
10401
  const container = document.getElementById('toastContainer');
10402
+
10403
+ if (!this._toastDedup) this._toastDedup = new Map();
10404
+ const dedupKey = `${type}:${message}`;
10405
+ const lastShown = this._toastDedup.get(dedupKey);
10406
+ if (lastShown && Date.now() - lastShown < DEDUP_INTERVAL) return;
10407
+ this._toastDedup.set(dedupKey, Date.now());
10408
+
10409
+ while (container.children.length >= MAX_TOASTS) {
10410
+ container.firstChild.remove();
10411
+ }
10412
+
10405
10413
  const toast = document.createElement('div');
10406
10414
  toast.className = `toast ${type}`;
10407
10415
 
@@ -10564,6 +10572,7 @@ async syncTabsFromServer(tabs) {
10564
10572
  }
10565
10573
 
10566
10574
  async executeUpdate() {
10575
+ this.isUpdating = true;
10567
10576
  const updateBtn = document.getElementById('updateBtn');
10568
10577
  const updateOverlay = document.getElementById('updateOverlay');
10569
10578
  const updateMessage = document.getElementById('updateMessage');
@@ -10624,6 +10633,7 @@ async syncTabsFromServer(tabs) {
10624
10633
  }
10625
10634
  } catch (error) {
10626
10635
  console.error('Failed to execute update:', error);
10636
+ this.isUpdating = false;
10627
10637
 
10628
10638
  // Hide overlay on error
10629
10639
  if (updateOverlay) {
@@ -10765,6 +10775,7 @@ async syncTabsFromServer(tabs) {
10765
10775
  }
10766
10776
 
10767
10777
  handleUpdateError(message) {
10778
+ this.isUpdating = false;
10768
10779
  const updateOverlay = document.getElementById('updateOverlay');
10769
10780
  const updateBtn = document.getElementById('updateBtn');
10770
10781
 
@@ -57,6 +57,8 @@ class MobileTerminalHandler {
57
57
  this._isComposing = false;
58
58
  this._compositionText = '';
59
59
  this._compositionEndTs = 0;
60
+ this._lastSentInput = '';
61
+ this._lastSentInputTs = 0;
60
62
  this.contextMenuUserPositioned = false; // Track if user has manually positioned the menu
61
63
 
62
64
  // Configuration
@@ -468,7 +470,21 @@ class MobileTerminalHandler {
468
470
  return;
469
471
  }
470
472
 
473
+ // Skip composition-related input events - they are handled by compositionend.
474
+ // e.isComposing is true when the event is part of an active composition.
475
+ // e.inputType checks catch 'insertCompositionText' and 'insertReplacementText'
476
+ // which some browsers fire instead of or alongside composition events.
477
+ if (e.isComposing) {
478
+ return;
479
+ }
480
+
471
481
  if (this._isComposing) {
482
+ this.hiddenTextarea.value = '';
483
+ return;
484
+ }
485
+
486
+ if (e.inputType === 'insertCompositionText' || e.inputType === 'insertReplacementText') {
487
+ this.hiddenTextarea.value = '';
472
488
  return;
473
489
  }
474
490
 
@@ -483,6 +499,8 @@ class MobileTerminalHandler {
483
499
 
484
500
  if (e.data && !this.touchState.isDragging) {
485
501
  this._sendToTerminal(e.data);
502
+ this._lastSentInput = e.data;
503
+ this._lastSentInputTs = Date.now();
486
504
  this.hiddenTextarea.value = '';
487
505
  }
488
506
  });
@@ -537,11 +555,28 @@ class MobileTerminalHandler {
537
555
  this.hiddenTextarea.addEventListener('compositionend', (e) => {
538
556
  this._isComposing = false;
539
557
  this._compositionEndTs = Date.now();
540
- const composed = e.data || this.hiddenTextarea.value;
558
+ const composed = e.data || this._compositionText;
541
559
  if (composed && !this.touchState.isDragging) {
542
- this._sendToTerminal(composed);
560
+ // Avoid re-sending text that was already sent via an input event
561
+ // that fired before compositionstart (Gboard timing quirk).
562
+ if (this._lastSentInput && (Date.now() - this._lastSentInputTs) < 500) {
563
+ if (composed === this._lastSentInput) {
564
+ this._lastSentInput = '';
565
+ this._lastSentInputTs = 0;
566
+ } else if (composed.startsWith(this._lastSentInput)) {
567
+ this._sendToTerminal(composed.substring(this._lastSentInput.length));
568
+ this._lastSentInput = '';
569
+ this._lastSentInputTs = 0;
570
+ } else {
571
+ this._sendToTerminal(composed);
572
+ }
573
+ } else {
574
+ this._sendToTerminal(composed);
575
+ }
543
576
  }
544
577
  this._compositionText = '';
578
+ this._lastSentInput = '';
579
+ this._lastSentInputTs = 0;
545
580
  this.hiddenTextarea.value = '';
546
581
  });
547
582
  }