@lethevimlet/sshift 0.5.0 → 0.6.0

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": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Web-based SSH + SFTP terminal client with tabs and bookmarks",
5
5
  "main": "src/server/index.js",
6
6
  "bin": {
@@ -2243,10 +2243,8 @@ class SSHIFTClient {
2243
2243
  }
2244
2244
 
2245
2245
  // Update mobile detection on resize and re-apply layout if needed
2246
- let previousIsMobile = this.isMobile;
2247
2246
  window.addEventListener('resize', () => {
2248
- const wasMobile = previousIsMobile;
2249
- previousIsMobile = this.isMobile;
2247
+ const wasMobile = this.isMobile;
2250
2248
  this.isMobile = window.innerWidth <= 768;
2251
2249
 
2252
2250
  // If we switched between mobile and desktop, re-apply the layout
@@ -3450,6 +3448,21 @@ class SSHIFTClient {
3450
3448
  rows: session.terminal.rows
3451
3449
  });
3452
3450
  console.log('[SSHIFT] Resized terminal after becoming controller:', session.terminal.cols, 'x', session.terminal.rows);
3451
+
3452
+ // Delayed refit to handle viewport transitions (e.g. mobile -> desktop)
3453
+ setTimeout(() => {
3454
+ if (session.terminal && session.fitAddon && session.isController) {
3455
+ session.isResyncing = true;
3456
+ this._fitTerminal(session);
3457
+ session.isResyncing = false;
3458
+ this.socket.emit('ssh-resize', {
3459
+ sessionId: data.sessionId,
3460
+ cols: session.terminal.cols,
3461
+ rows: session.terminal.rows
3462
+ });
3463
+ console.log('[SSHIFT] Delayed refit after becoming controller:', session.terminal.cols, 'x', session.terminal.rows);
3464
+ }
3465
+ }, 300);
3453
3466
  }
3454
3467
  this.showToast('You are now in control (previous controller left)', 'info');
3455
3468
  } else if (!session.isController) {
@@ -3508,6 +3521,22 @@ class SSHIFTClient {
3508
3521
  });
3509
3522
 
3510
3523
  console.log('[SSHIFT] Resized SSH terminal after taking control:', session.terminal.cols, 'x', session.terminal.rows);
3524
+
3525
+ // Delayed refit to handle viewport transitions (e.g. mobile -> desktop)
3526
+ // The container dimensions may not be final when fit first runs
3527
+ setTimeout(() => {
3528
+ if (session.terminal && session.fitAddon && session.isController) {
3529
+ session.isResyncing = true;
3530
+ this._fitTerminal(session);
3531
+ session.isResyncing = false;
3532
+ this.socket.emit('ssh-resize', {
3533
+ sessionId: data.sessionId,
3534
+ cols: session.terminal.cols,
3535
+ rows: session.terminal.rows
3536
+ });
3537
+ console.log('[SSHIFT] Delayed refit after take control:', session.terminal.cols, 'x', session.terminal.rows);
3538
+ }
3539
+ }, 300);
3511
3540
  } catch (e) {
3512
3541
  console.warn('[SSHIFT] Error resizing terminal after taking control:', e.message);
3513
3542
  session.isResyncing = false;
@@ -4608,8 +4637,9 @@ class SSHIFTClient {
4608
4637
  updateMobileTabsDropdown(panelId = null) {
4609
4638
  // On mobile, we always show a single dropdown that combines all tabs from all panels
4610
4639
  // On desktop with multi-panel, we show separate dropdowns per panel
4640
+ const isMobileView = window.innerWidth <= 768;
4611
4641
 
4612
- if (this.isMobile) {
4642
+ if (isMobileView || this.isMobile) {
4613
4643
  // Mobile: Single dropdown with all tabs from all panels
4614
4644
  const mobileTabsLabel = document.getElementById('mobileTabsLabel');
4615
4645
  const mobileTabsMenu = document.getElementById('mobileTabsMenu');