@lethevimlet/sshift 1.8.2 → 1.8.3

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.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "Web-based SSH + SFTP terminal client with tabs and bookmarks",
5
5
  "main": "src/server/index.js",
6
6
  "bin": {
@@ -5377,6 +5377,7 @@ const wheelHandler = (e) => {
5377
5377
 
5378
5378
  this.socket.on('ssh-error', (data) => {
5379
5379
  console.error('[SSHIFT] SSH Error:', data.message, 'sessionId:', data.sessionId);
5380
+ this._dismissConnectingToasts();
5380
5381
 
5381
5382
  // If session not found and we're restoring, try to reconnect
5382
5383
  if (data.sessionId && data.message === 'Session not found') {
@@ -5470,6 +5471,7 @@ const wheelHandler = (e) => {
5470
5471
  });
5471
5472
 
5472
5473
  this.socket.on('sftp-connected', (data) => {
5474
+ this._dismissConnectingToasts();
5473
5475
  this.onSFTPConnected(data);
5474
5476
  });
5475
5477
 
@@ -5530,6 +5532,7 @@ const wheelHandler = (e) => {
5530
5532
  });
5531
5533
 
5532
5534
  this.socket.on('sftp-error', (data) => {
5535
+ this._dismissConnectingToasts();
5533
5536
  console.error('[SSHIFT] SFTP Error:', data.message, 'sessionId:', data?.sessionId);
5534
5537
 
5535
5538
  // If session not found and we're restoring, try to reconnect
@@ -8303,7 +8306,7 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
8303
8306
  }
8304
8307
 
8305
8308
  // Show connecting status
8306
- this.showToast(`Connecting to ${host}...`, 'info');
8309
+ this._noteConnectingToast(this.showToast(`Connecting to ${host}...`, 'info'));
8307
8310
 
8308
8311
  if (type === 'ssh') {
8309
8312
  console.log('[SSHIFT] Creating SSH tab...');
@@ -9527,6 +9530,7 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
9527
9530
  // Update control overlay (should be hidden since we're controller)
9528
9531
  this.updateControlOverlay(data.sessionId);
9529
9532
 
9533
+ this._dismissConnectingToasts();
9530
9534
  this.showToast('SSH connection established', 'success');
9531
9535
  console.log('[SSHIFT] Session marked as connected, terminal exists:', !!session.terminal);
9532
9536
 
@@ -13133,7 +13137,7 @@ async syncTabsFromServer(tabs, isInitialSync = false, activeTabsByPanel = null)
13133
13137
  }
13134
13138
 
13135
13139
  // Show connecting status
13136
- this.showToast(`Connecting to ${bookmark.name}...`, 'info');
13140
+ this._noteConnectingToast(this.showToast(`Connecting to ${bookmark.name}...`, 'info'));
13137
13141
 
13138
13142
  if (bookmark.type === 'ssh') {
13139
13143
  console.log('[SSHIFT] Creating SSH tab from bookmark...');
@@ -13630,10 +13634,31 @@ async syncTabsFromServer(tabs, isInitialSync = false, activeTabsByPanel = null)
13630
13634
 
13631
13635
  container.appendChild(toast);
13632
13636
 
13633
- setTimeout(() => {
13634
- toast.style.opacity = '0';
13635
- setTimeout(() => toast.remove(), 300);
13636
- }, 3000);
13637
+ toast._dismissTimer = setTimeout(() => this.dismissToast(toast), 3000);
13638
+ return toast;
13639
+ }
13640
+
13641
+ /** Fade out and remove a toast returned by showToast (safe to call twice). */
13642
+ dismissToast(toast) {
13643
+ if (!toast || toast._dismissed) return;
13644
+ toast._dismissed = true;
13645
+ if (toast._dismissTimer) clearTimeout(toast._dismissTimer);
13646
+ toast.style.opacity = '0';
13647
+ setTimeout(() => toast.remove(), 300);
13648
+ }
13649
+
13650
+ /** Remember a "Connecting to …" toast so the outcome can dismiss it early. */
13651
+ _noteConnectingToast(toast) {
13652
+ if (!toast) return;
13653
+ if (!this._connectingToasts) this._connectingToasts = [];
13654
+ this._connectingToasts.push(toast);
13655
+ }
13656
+
13657
+ /** The connection finished (success or error): drop the pending "Connecting to …" toasts. */
13658
+ _dismissConnectingToasts() {
13659
+ const list = this._connectingToasts || [];
13660
+ this._connectingToasts = [];
13661
+ list.forEach((t) => this.dismissToast(t));
13637
13662
  }
13638
13663
 
13639
13664
  // Utility Functions