@lethevimlet/sshift 0.9.4 → 0.9.6
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/example.config.json +3 -0
- package/package.json +8 -1
- package/src/server/endpoints/rest/config.js +21 -1
- package/src/server/endpoints/rest/system.js +36 -0
- package/src/server/endpoints/ws/ssh.js +6 -2
- package/src/server/index.js +39 -9
- package/src/server/services/ssh-manager.js +50 -29
- package/src/server/utils/config.js +35 -1
- package/src/webapp/css/style.css +87 -29
- package/src/webapp/index.html +187 -29
- package/src/webapp/js/app.js +624 -78
- package/src/webapp/js/mobile-terminal.js +6 -0
- package/src/webapp/js/terminal-worker.js +211 -0
- package/src/webapp/libs/xterm/xterm-addon-fit.js +2 -2
- package/src/webapp/libs/xterm/xterm-addon-image.js +3 -0
- package/src/webapp/libs/xterm/xterm-addon-search.js +2 -2
- package/src/webapp/libs/xterm/xterm-addon-serialize-worker.js +2 -0
- package/src/webapp/libs/xterm/xterm-addon-web-links.js +2 -2
- package/src/webapp/libs/xterm/xterm-addon-webgl.js +2 -0
- package/src/webapp/libs/xterm/xterm-headless-prefix.js +6 -0
- package/src/webapp/libs/xterm/xterm-headless.js +2 -0
- package/src/webapp/libs/xterm/xterm.css +81 -5
- package/src/webapp/libs/xterm/xterm.js +1 -1
- package/src/webapp/sw.js +11 -4
package/src/webapp/js/app.js
CHANGED
|
@@ -46,6 +46,8 @@ class SSHIFTClient {
|
|
|
46
46
|
|
|
47
47
|
// Mobile keys bar
|
|
48
48
|
this.mobileKeysBarEnabled = true; // Default to enabled
|
|
49
|
+
this.webglRenderer = true; // Default to enabled
|
|
50
|
+
this.imageAddonEnabled = true; // Default to enabled
|
|
49
51
|
this.ctrlPressed = false; // Track Ctrl key state
|
|
50
52
|
this.altPressed = false; // Track Alt key state
|
|
51
53
|
this.currentKeyboardHeight = 0; // Track actual keyboard height for positioning
|
|
@@ -90,6 +92,8 @@ class SSHIFTClient {
|
|
|
90
92
|
const localKeepaliveInterval = localStorage.getItem('sshKeepaliveInterval');
|
|
91
93
|
const localKeepaliveCountMax = localStorage.getItem('sshKeepaliveCountMax');
|
|
92
94
|
const localMobileKeysBar = localStorage.getItem('mobileKeysBarEnabled');
|
|
95
|
+
const localWebglRenderer = localStorage.getItem('webglRenderer');
|
|
96
|
+
const localImageAddonEnabled = localStorage.getItem('imageAddonEnabled');
|
|
93
97
|
|
|
94
98
|
// If we have localStorage values, use them
|
|
95
99
|
if (localSticky !== null) {
|
|
@@ -98,11 +102,15 @@ class SSHIFTClient {
|
|
|
98
102
|
this.sshKeepaliveInterval = localKeepaliveInterval !== null ? parseInt(localKeepaliveInterval) : 10000;
|
|
99
103
|
this.sshKeepaliveCountMax = localKeepaliveCountMax !== null ? parseInt(localKeepaliveCountMax) : 1000;
|
|
100
104
|
this.mobileKeysBarEnabled = localMobileKeysBar !== null ? JSON.parse(localMobileKeysBar) : true;
|
|
105
|
+
this.webglRenderer = localWebglRenderer !== null ? JSON.parse(localWebglRenderer) : true;
|
|
106
|
+
this.imageAddonEnabled = localImageAddonEnabled !== null ? JSON.parse(localImageAddonEnabled) : true;
|
|
101
107
|
console.log('[SSHIFT] Loaded from localStorage - Sticky:', this.sticky ? 'enabled' : 'disabled',
|
|
102
108
|
'Take Control Default:', this.takeControlDefault ? 'enabled' : 'disabled',
|
|
103
109
|
'Keepalive Interval:', this.sshKeepaliveInterval,
|
|
104
110
|
'Keepalive Count Max:', this.sshKeepaliveCountMax,
|
|
105
|
-
'Mobile Keys Bar:', this.mobileKeysBarEnabled ? 'enabled' : 'disabled'
|
|
111
|
+
'Mobile Keys Bar:', this.mobileKeysBarEnabled ? 'enabled' : 'disabled',
|
|
112
|
+
'WebGL Renderer:', this.webglRenderer ? 'enabled' : 'disabled',
|
|
113
|
+
'Image Addon:', this.imageAddonEnabled ? 'enabled' : 'disabled');
|
|
106
114
|
return;
|
|
107
115
|
}
|
|
108
116
|
|
|
@@ -119,12 +127,16 @@ class SSHIFTClient {
|
|
|
119
127
|
this.sshKeepaliveCountMax = config.sshKeepaliveCountMax || 1000;
|
|
120
128
|
// Load mobile keys bar setting
|
|
121
129
|
this.mobileKeysBarEnabled = config.mobileKeysBarEnabled !== undefined ? config.mobileKeysBarEnabled : true;
|
|
130
|
+
this.webglRenderer = config.webglRenderer !== undefined ? config.webglRenderer : true;
|
|
131
|
+
this.imageAddonEnabled = config.imageAddonEnabled !== undefined ? config.imageAddonEnabled : true;
|
|
122
132
|
this.passwordEnabled = config.passwordEnabled || false;
|
|
123
133
|
console.log('[SSHIFT] Loaded from server - Sticky:', this.sticky ? 'enabled' : 'disabled',
|
|
124
134
|
'Take Control Default:', this.takeControlDefault ? 'enabled' : 'disabled',
|
|
125
135
|
'Keepalive Interval:', this.sshKeepaliveInterval,
|
|
126
136
|
'Keepalive Count Max:', this.sshKeepaliveCountMax,
|
|
127
|
-
'Mobile Keys Bar:', this.mobileKeysBarEnabled ? 'enabled' : 'disabled'
|
|
137
|
+
'Mobile Keys Bar:', this.mobileKeysBarEnabled ? 'enabled' : 'disabled',
|
|
138
|
+
'WebGL Renderer:', this.webglRenderer ? 'enabled' : 'disabled',
|
|
139
|
+
'Image Addon:', this.imageAddonEnabled ? 'enabled' : 'disabled');
|
|
128
140
|
} catch (err) {
|
|
129
141
|
console.error('[SSHIFT] Failed to load config:', err);
|
|
130
142
|
this.sticky = true; // Default to true
|
|
@@ -132,6 +144,8 @@ class SSHIFTClient {
|
|
|
132
144
|
this.sshKeepaliveInterval = 10000;
|
|
133
145
|
this.sshKeepaliveCountMax = 1000;
|
|
134
146
|
this.mobileKeysBarEnabled = true; // Default to true
|
|
147
|
+
this.webglRenderer = true; // Default to true
|
|
148
|
+
this.imageAddonEnabled = true; // Default to true
|
|
135
149
|
}
|
|
136
150
|
}
|
|
137
151
|
|
|
@@ -397,6 +411,16 @@ class SSHIFTClient {
|
|
|
397
411
|
if (mobileKeysBarToggle) {
|
|
398
412
|
mobileKeysBarToggle.checked = this.mobileKeysBarEnabled;
|
|
399
413
|
}
|
|
414
|
+
|
|
415
|
+
const webglRendererToggle = document.getElementById('webglRendererToggle');
|
|
416
|
+
if (webglRendererToggle) {
|
|
417
|
+
webglRendererToggle.checked = this.webglRenderer;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const imageAddonToggle = document.getElementById('imageAddonToggle');
|
|
421
|
+
if (imageAddonToggle) {
|
|
422
|
+
imageAddonToggle.checked = this.imageAddonEnabled;
|
|
423
|
+
}
|
|
400
424
|
}
|
|
401
425
|
|
|
402
426
|
saveTabs() {
|
|
@@ -879,6 +903,23 @@ class SSHIFTClient {
|
|
|
879
903
|
return true;
|
|
880
904
|
}
|
|
881
905
|
|
|
906
|
+
forceResizeTerminal(sessionId) {
|
|
907
|
+
if (!sessionId) return;
|
|
908
|
+
const session = this.sessions.get(sessionId) || this.sftpSessions.get(sessionId);
|
|
909
|
+
if (!session || !session.terminal || !session.fitAddon) return;
|
|
910
|
+
|
|
911
|
+
const wrapper = document.getElementById(`terminal-wrapper-${sessionId}`);
|
|
912
|
+
const container = document.getElementById(`terminal-${sessionId}`);
|
|
913
|
+
if (!wrapper || !container) return;
|
|
914
|
+
|
|
915
|
+
if (!wrapper.classList.contains('active')) {
|
|
916
|
+
this.switchTab(sessionId);
|
|
917
|
+
setTimeout(() => this._fitTerminal(session), 50);
|
|
918
|
+
} else {
|
|
919
|
+
this._fitTerminal(session);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
|
|
882
923
|
// Set font size for a specific session
|
|
883
924
|
setSessionFontSize(sessionId, size) {
|
|
884
925
|
const session = this.sessions.get(sessionId);
|
|
@@ -967,6 +1008,37 @@ class SSHIFTClient {
|
|
|
967
1008
|
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
968
1009
|
}
|
|
969
1010
|
|
|
1011
|
+
getScrollbarColors(bgColor) {
|
|
1012
|
+
const hex = (bgColor || '#0d1117').replace('#', '');
|
|
1013
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
1014
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
1015
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
1016
|
+
const luminance = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
1017
|
+
|
|
1018
|
+
let trackR, trackG, trackB;
|
|
1019
|
+
let thumbR, thumbG, thumbB;
|
|
1020
|
+
if (luminance > 128) {
|
|
1021
|
+
trackR = Math.max(0, r - 8);
|
|
1022
|
+
trackG = Math.max(0, g - 8);
|
|
1023
|
+
trackB = Math.max(0, b - 8);
|
|
1024
|
+
thumbR = Math.max(0, r - 80);
|
|
1025
|
+
thumbG = Math.max(0, g - 80);
|
|
1026
|
+
thumbB = Math.max(0, b - 80);
|
|
1027
|
+
} else {
|
|
1028
|
+
trackR = Math.min(255, r + 8);
|
|
1029
|
+
trackG = Math.min(255, g + 8);
|
|
1030
|
+
trackB = Math.min(255, b + 8);
|
|
1031
|
+
thumbR = Math.min(255, r + 60);
|
|
1032
|
+
thumbG = Math.min(255, g + 60);
|
|
1033
|
+
thumbB = Math.min(255, b + 60);
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
const track = `rgb(${trackR}, ${trackG}, ${trackB})`;
|
|
1037
|
+
const thumb = `rgb(${thumbR}, ${thumbG}, ${thumbB})`;
|
|
1038
|
+
|
|
1039
|
+
return { track, thumb };
|
|
1040
|
+
}
|
|
1041
|
+
|
|
970
1042
|
getTerminalTheme(theme) {
|
|
971
1043
|
const isDark = theme === 'dark';
|
|
972
1044
|
|
|
@@ -1074,6 +1146,24 @@ class SSHIFTClient {
|
|
|
1074
1146
|
}, 250);
|
|
1075
1147
|
}
|
|
1076
1148
|
|
|
1149
|
+
applyScrollbarColors(wrapper, bgColor) {
|
|
1150
|
+
if (!wrapper) return;
|
|
1151
|
+
const colors = this.getScrollbarColors(bgColor);
|
|
1152
|
+
wrapper.style.setProperty('--terminal-scrollbar-track', colors.track);
|
|
1153
|
+
wrapper.style.setProperty('--terminal-scrollbar-thumb', colors.thumb);
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
updateViewportBackground(session) {
|
|
1157
|
+
if (!session || !session.terminal || !session.terminal.element) return;
|
|
1158
|
+
const bgColor = this.terminalColorOverride
|
|
1159
|
+
? (this.terminalBgColor || '#0d1117')
|
|
1160
|
+
: '#0d1117';
|
|
1161
|
+
const viewport = session.terminal.element.querySelector('.xterm-viewport');
|
|
1162
|
+
if (viewport) {
|
|
1163
|
+
viewport.style.backgroundColor = bgColor;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1077
1167
|
updateTerminalThemes(theme) {
|
|
1078
1168
|
console.log('[SSHIFT] updateTerminalThemes called with theme:', theme);
|
|
1079
1169
|
console.log('[SSHIFT] terminalColorOverride:', this.terminalColorOverride);
|
|
@@ -1091,9 +1181,13 @@ class SSHIFTClient {
|
|
|
1091
1181
|
const wrapper = document.getElementById(`terminal-wrapper-${session.id}`);
|
|
1092
1182
|
if (wrapper && this.terminalColorOverride) {
|
|
1093
1183
|
wrapper.style.backgroundColor = newTheme.background;
|
|
1184
|
+
this.applyScrollbarColors(wrapper, newTheme.background);
|
|
1094
1185
|
} else if (wrapper) {
|
|
1095
1186
|
wrapper.style.backgroundColor = '#0d1117';
|
|
1187
|
+
this.applyScrollbarColors(wrapper, '#0d1117');
|
|
1096
1188
|
}
|
|
1189
|
+
|
|
1190
|
+
this.updateViewportBackground(session);
|
|
1097
1191
|
}
|
|
1098
1192
|
});
|
|
1099
1193
|
|
|
@@ -1109,9 +1203,13 @@ class SSHIFTClient {
|
|
|
1109
1203
|
const wrapper = document.getElementById(`terminal-wrapper-${session.id}`);
|
|
1110
1204
|
if (wrapper && this.terminalColorOverride) {
|
|
1111
1205
|
wrapper.style.backgroundColor = newTheme.background;
|
|
1206
|
+
this.applyScrollbarColors(wrapper, newTheme.background);
|
|
1112
1207
|
} else if (wrapper) {
|
|
1113
1208
|
wrapper.style.backgroundColor = '#0d1117';
|
|
1209
|
+
this.applyScrollbarColors(wrapper, '#0d1117');
|
|
1114
1210
|
}
|
|
1211
|
+
|
|
1212
|
+
this.updateViewportBackground(session);
|
|
1115
1213
|
}
|
|
1116
1214
|
});
|
|
1117
1215
|
}
|
|
@@ -1879,6 +1977,13 @@ class SSHIFTClient {
|
|
|
1879
1977
|
`;
|
|
1880
1978
|
mobileDropdown.appendChild(mobileToggle);
|
|
1881
1979
|
|
|
1980
|
+
const forceResizeBtn = document.createElement('button');
|
|
1981
|
+
forceResizeBtn.className = 'mobile-force-resize-btn';
|
|
1982
|
+
forceResizeBtn.id = isSingle ? 'mobileForceResizeBtn' : `${panelId}-mobileForceResizeBtn`;
|
|
1983
|
+
forceResizeBtn.title = 'Force Resize';
|
|
1984
|
+
forceResizeBtn.innerHTML = '<i class="fas fa-expand-arrows-alt"></i>';
|
|
1985
|
+
mobileDropdown.appendChild(forceResizeBtn);
|
|
1986
|
+
|
|
1882
1987
|
const mobileMenu = document.createElement('div');
|
|
1883
1988
|
mobileMenu.className = 'mobile-tabs-menu';
|
|
1884
1989
|
mobileMenu.id = isSingle ? 'mobileTabsMenu' : `${panelId}-mobileTabsMenu`;
|
|
@@ -1962,6 +2067,17 @@ class SSHIFTClient {
|
|
|
1962
2067
|
// Special keys button
|
|
1963
2068
|
const specialKeysBtn = document.getElementById(isSingle ? 'specialKeysBtn' : `${panelId}-specialKeysBtn`);
|
|
1964
2069
|
if (specialKeysBtn) {
|
|
2070
|
+
specialKeysBtn.setAttribute('tabindex', '-1');
|
|
2071
|
+
specialKeysBtn.addEventListener('focus', () => {
|
|
2072
|
+
specialKeysBtn.blur();
|
|
2073
|
+
if (this.isMobile) this.focusTerminal();
|
|
2074
|
+
});
|
|
2075
|
+
specialKeysBtn.addEventListener('touchstart', (e) => {
|
|
2076
|
+
if (this.isMobile) e.preventDefault();
|
|
2077
|
+
}, { passive: false });
|
|
2078
|
+
specialKeysBtn.addEventListener('mousedown', (e) => {
|
|
2079
|
+
if (this.isMobile) e.preventDefault();
|
|
2080
|
+
});
|
|
1965
2081
|
specialKeysBtn.addEventListener('click', () => this.handleSpecialKeys(panelId));
|
|
1966
2082
|
}
|
|
1967
2083
|
|
|
@@ -2018,6 +2134,17 @@ class SSHIFTClient {
|
|
|
2018
2134
|
mobileMenu.classList.toggle('show');
|
|
2019
2135
|
});
|
|
2020
2136
|
}
|
|
2137
|
+
|
|
2138
|
+
// Force resize button
|
|
2139
|
+
const forceResizeBtn = document.getElementById(isSingle ? 'mobileForceResizeBtn' : `${panelId}-mobileForceResizeBtn`);
|
|
2140
|
+
if (forceResizeBtn) {
|
|
2141
|
+
forceResizeBtn.addEventListener('click', () => {
|
|
2142
|
+
const activeSessionId = this.activeSessionsByPanel.get(panelId) || this.activeSessionId;
|
|
2143
|
+
if (activeSessionId) {
|
|
2144
|
+
this.forceResizeTerminal(activeSessionId);
|
|
2145
|
+
}
|
|
2146
|
+
});
|
|
2147
|
+
}
|
|
2021
2148
|
}
|
|
2022
2149
|
|
|
2023
2150
|
// Panel-specific button handlers
|
|
@@ -2206,6 +2333,9 @@ class SSHIFTClient {
|
|
|
2206
2333
|
// Initialize mobile keys bar
|
|
2207
2334
|
this.initMobileKeysBar();
|
|
2208
2335
|
|
|
2336
|
+
// Initialize security info dialog
|
|
2337
|
+
this.initSecurityInfoDialog();
|
|
2338
|
+
|
|
2209
2339
|
// Initialize version check and update functionality
|
|
2210
2340
|
this.initVersionCheck();
|
|
2211
2341
|
|
|
@@ -2267,76 +2397,73 @@ class SSHIFTClient {
|
|
|
2267
2397
|
|
|
2268
2398
|
console.log('[SSHIFT] Setting up mobile scroll behavior for session:', sessionId);
|
|
2269
2399
|
|
|
2270
|
-
// Initialize scroll position tracking for this session
|
|
2271
2400
|
session.lastScrollTop = 0;
|
|
2272
2401
|
session.lastTouchY = 0;
|
|
2273
2402
|
session.isScrolling = false;
|
|
2274
|
-
session.isAtBottom = true;
|
|
2403
|
+
session.isAtBottom = true;
|
|
2404
|
+
session.touchAccumulator = 0;
|
|
2275
2405
|
|
|
2276
|
-
// Initialize pinch-to-zoom state
|
|
2277
2406
|
session.initialPinchDistance = 0;
|
|
2278
2407
|
session.lastPinchDistance = 0;
|
|
2279
2408
|
session.isPinching = false;
|
|
2280
2409
|
|
|
2281
|
-
// Use xterm.js onScroll event to track scroll position
|
|
2282
2410
|
terminal.onScroll(() => {
|
|
2283
|
-
console.log('[SSHIFT] xterm onScroll event fired');
|
|
2284
2411
|
this.handleMobileScroll(sessionId);
|
|
2285
2412
|
this.checkIfAtBottom(sessionId);
|
|
2286
2413
|
});
|
|
2287
2414
|
|
|
2288
|
-
// Also handle touch events on the terminal element for touch scrolling and pinch-to-zoom
|
|
2289
2415
|
const terminalElement = terminal.element;
|
|
2290
2416
|
if (terminalElement) {
|
|
2291
2417
|
console.log('[SSHIFT] Terminal element found, setting up touch handlers');
|
|
2292
2418
|
|
|
2293
|
-
|
|
2419
|
+
const scrollableElement = terminalElement.querySelector('.xterm-scrollable-element') || terminalElement;
|
|
2294
2420
|
const viewportElement = terminalElement.querySelector('.xterm-viewport');
|
|
2295
|
-
const xtermScreen = terminalElement.querySelector('.xterm-screen');
|
|
2296
2421
|
|
|
2297
|
-
const
|
|
2422
|
+
const setupTouchScrollHandlers = (element, elementName) => {
|
|
2298
2423
|
if (!element) {
|
|
2299
2424
|
console.log(`[SSHIFT] ${elementName} not found`);
|
|
2300
2425
|
return;
|
|
2301
2426
|
}
|
|
2302
2427
|
|
|
2303
|
-
console.log(`[SSHIFT] Setting up touch handlers on ${elementName}`);
|
|
2428
|
+
console.log(`[SSHIFT] Setting up touch scroll handlers on ${elementName}`);
|
|
2304
2429
|
|
|
2305
|
-
// Touch start - record initial position for both scroll and pinch
|
|
2306
2430
|
element.addEventListener('touchstart', (e) => {
|
|
2307
2431
|
if (e.touches.length === 1) {
|
|
2308
2432
|
session.lastTouchY = e.touches[0].clientY;
|
|
2309
2433
|
session.isScrolling = true;
|
|
2310
|
-
|
|
2434
|
+
session.touchAccumulator = 0;
|
|
2311
2435
|
} else if (e.touches.length === 2) {
|
|
2312
|
-
// Pinch gesture started
|
|
2313
2436
|
session.isPinching = true;
|
|
2314
2437
|
session.isScrolling = false;
|
|
2315
2438
|
session.initialPinchDistance = this.getPinchDistance(e.touches[0], e.touches[1]);
|
|
2316
2439
|
session.lastPinchDistance = session.initialPinchDistance;
|
|
2317
|
-
console.log(`[SSHIFT] ${elementName} pinch start, distance:`, session.initialPinchDistance);
|
|
2318
2440
|
}
|
|
2319
2441
|
}, { passive: true });
|
|
2320
2442
|
|
|
2321
|
-
// Touch move - track scrolling and pinch
|
|
2322
2443
|
element.addEventListener('touchmove', (e) => {
|
|
2323
|
-
// Handle single-finger scroll
|
|
2324
2444
|
if (e.touches.length === 1 && session.isScrolling) {
|
|
2445
|
+
e.preventDefault();
|
|
2446
|
+
|
|
2325
2447
|
const currentTouchY = e.touches[0].clientY;
|
|
2326
2448
|
const touchDiff = session.lastTouchY - currentTouchY;
|
|
2327
|
-
|
|
2328
|
-
// Update last touch position
|
|
2329
2449
|
session.lastTouchY = currentTouchY;
|
|
2450
|
+
session.touchAccumulator += touchDiff;
|
|
2451
|
+
|
|
2452
|
+
const lineHeight = terminal._core?._renderService?.dimensions?.css?.cell?.height || 20;
|
|
2453
|
+
const lineH = Math.max(lineHeight, 14);
|
|
2454
|
+
|
|
2455
|
+
const linesToScroll = Math.trunc(Math.abs(session.touchAccumulator) / lineH);
|
|
2456
|
+
if (linesToScroll > 0) {
|
|
2457
|
+
const direction = session.touchAccumulator > 0 ? 1 : -1;
|
|
2458
|
+
terminal.scrollLines(direction * linesToScroll);
|
|
2459
|
+
session.touchAccumulator -= direction * linesToScroll * lineH;
|
|
2460
|
+
}
|
|
2461
|
+
} else if (e.touches.length === 2 && session.isPinching) {
|
|
2462
|
+
e.preventDefault();
|
|
2330
2463
|
|
|
2331
|
-
console.log(`[SSHIFT] ${elementName} touchmove, diff:`, touchDiff);
|
|
2332
|
-
}
|
|
2333
|
-
// Handle two-finger pinch
|
|
2334
|
-
else if (e.touches.length === 2 && session.isPinching) {
|
|
2335
2464
|
const currentDistance = this.getPinchDistance(e.touches[0], e.touches[1]);
|
|
2336
2465
|
const distanceDiff = currentDistance - session.lastPinchDistance;
|
|
2337
2466
|
|
|
2338
|
-
// Calculate font size change based on pinch scale
|
|
2339
|
-
// Scale factor: 1 pixel distance change = 0.1 font size change
|
|
2340
2467
|
const fontSizeChange = distanceDiff * 0.1;
|
|
2341
2468
|
|
|
2342
2469
|
if (Math.abs(fontSizeChange) >= 0.5) {
|
|
@@ -2344,52 +2471,43 @@ class SSHIFTClient {
|
|
|
2344
2471
|
|
|
2345
2472
|
if (newFontSize !== this.terminalFontSize) {
|
|
2346
2473
|
this.setTerminalFontSize(newFontSize);
|
|
2347
|
-
console.log(`[SSHIFT] ${elementName} pinch zoom, font size:`, newFontSize);
|
|
2348
2474
|
}
|
|
2349
2475
|
}
|
|
2350
2476
|
|
|
2351
2477
|
session.lastPinchDistance = currentDistance;
|
|
2352
2478
|
}
|
|
2353
|
-
}, { passive:
|
|
2479
|
+
}, { passive: false });
|
|
2354
2480
|
|
|
2355
|
-
// Touch end - check if at bottom for auto-scroll and reset pinch state
|
|
2356
2481
|
element.addEventListener('touchend', (e) => {
|
|
2357
|
-
// Reset pinch state when all fingers are lifted
|
|
2358
2482
|
if (e.touches.length === 0) {
|
|
2359
2483
|
if (session.isPinching) {
|
|
2360
|
-
console.log(`[SSHIFT] ${elementName} pinch end, final font size:`, this.terminalFontSize);
|
|
2361
2484
|
session.isPinching = false;
|
|
2362
2485
|
}
|
|
2363
2486
|
session.isScrolling = false;
|
|
2364
2487
|
session.initialPinchDistance = 0;
|
|
2365
2488
|
session.lastPinchDistance = 0;
|
|
2489
|
+
session.touchAccumulator = 0;
|
|
2366
2490
|
|
|
2367
|
-
// Check scroll position after touch ends
|
|
2368
2491
|
setTimeout(() => {
|
|
2369
2492
|
this.checkIfAtBottom(sessionId);
|
|
2370
2493
|
}, 100);
|
|
2371
2494
|
} else if (e.touches.length === 1) {
|
|
2372
|
-
// Transitioned from pinch to single finger
|
|
2373
2495
|
session.isPinching = false;
|
|
2374
2496
|
session.initialPinchDistance = 0;
|
|
2375
2497
|
session.lastPinchDistance = 0;
|
|
2376
2498
|
session.lastTouchY = e.touches[0].clientY;
|
|
2377
2499
|
session.isScrolling = true;
|
|
2500
|
+
session.touchAccumulator = 0;
|
|
2378
2501
|
}
|
|
2379
2502
|
}, { passive: true });
|
|
2380
2503
|
};
|
|
2381
2504
|
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
// Also set up on the main terminal element as fallback
|
|
2387
|
-
setupTouchHandlers(terminalElement, 'terminal');
|
|
2505
|
+
setupTouchScrollHandlers(scrollableElement, 'scrollable');
|
|
2506
|
+
if (viewportElement && viewportElement !== scrollableElement) {
|
|
2507
|
+
setupTouchScrollHandlers(viewportElement, 'viewport');
|
|
2508
|
+
}
|
|
2388
2509
|
|
|
2389
|
-
|
|
2390
|
-
// the native Android/iOS selection handles and copy/paste menu.
|
|
2391
|
-
// No custom long-press context menu is needed on mobile.
|
|
2392
|
-
console.log('[SSHIFT] Mobile touch selection enabled - using native selection UI');
|
|
2510
|
+
console.log('[SSHIFT] Mobile touch scroll enabled with terminal.scrollLines()');
|
|
2393
2511
|
|
|
2394
2512
|
} else {
|
|
2395
2513
|
console.warn('[SSHIFT] Terminal element not found for touch handlers');
|
|
@@ -2403,6 +2521,58 @@ class SSHIFTClient {
|
|
|
2403
2521
|
return Math.sqrt(dx * dx + dy * dy);
|
|
2404
2522
|
}
|
|
2405
2523
|
|
|
2524
|
+
// Setup wheel scroll handler for desktop
|
|
2525
|
+
// xterm v6's ScrollableElement handles wheel events on the viewport,
|
|
2526
|
+
// but .xterm-screen (z-index: 1) sits above the viewport and intercepts
|
|
2527
|
+
// wheel events before they reach the scroll handler.
|
|
2528
|
+
// This method adds a wheel listener on the terminal element itself.
|
|
2529
|
+
setupWheelScroll(sessionId) {
|
|
2530
|
+
const session = this.sessions.get(sessionId);
|
|
2531
|
+
if (!session || !session.terminal) return;
|
|
2532
|
+
|
|
2533
|
+
const terminal = session.terminal;
|
|
2534
|
+
const terminalElement = terminal.element;
|
|
2535
|
+
if (!terminalElement) return;
|
|
2536
|
+
|
|
2537
|
+
const wheelHandler = (e) => {
|
|
2538
|
+
if (e.deltaY === 0) return;
|
|
2539
|
+
|
|
2540
|
+
// If the event target is inside the custom scrollbar,
|
|
2541
|
+
// let xterm's ScrollableElement handle it to avoid double-scroll
|
|
2542
|
+
const target = e.target;
|
|
2543
|
+
if (target && target.closest && target.closest('.xterm-scrollable-element')) {
|
|
2544
|
+
return;
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
e.preventDefault();
|
|
2548
|
+
|
|
2549
|
+
let lines = 1;
|
|
2550
|
+
if (e.deltaMode === 1) {
|
|
2551
|
+
lines = Math.abs(e.deltaY);
|
|
2552
|
+
} else if (e.deltaMode === 0) {
|
|
2553
|
+
const lineHeight = terminal._core?._renderService?.dimensions?.css?.cell?.height || 20;
|
|
2554
|
+
lines = Math.max(1, Math.round(Math.abs(e.deltaY) / Math.max(lineHeight, 14)));
|
|
2555
|
+
} else {
|
|
2556
|
+
lines = Math.abs(e.deltaY) * terminal.rows;
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
const fastScrollModifier = terminal.options.fastScrollModifier;
|
|
2560
|
+
if (fastScrollModifier === 'alt' && e.altKey ||
|
|
2561
|
+
fastScrollModifier === 'ctrl' && e.ctrlKey ||
|
|
2562
|
+
fastScrollModifier === 'shift' && e.shiftKey) {
|
|
2563
|
+
lines *= (terminal.options.fastScrollSensitivity || 5);
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2566
|
+
terminal.scrollLines((e.deltaY > 0 ? 1 : -1) * lines);
|
|
2567
|
+
};
|
|
2568
|
+
|
|
2569
|
+
terminalElement.addEventListener('wheel', wheelHandler, { passive: false });
|
|
2570
|
+
|
|
2571
|
+
// Store handler for cleanup
|
|
2572
|
+
session.wheelHandler = wheelHandler;
|
|
2573
|
+
session.wheelElement = terminalElement;
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2406
2576
|
// Check if terminal is scrolled to bottom
|
|
2407
2577
|
checkIfAtBottom(sessionId) {
|
|
2408
2578
|
if (!this.isMobile) return;
|
|
@@ -2836,37 +3006,75 @@ class SSHIFTClient {
|
|
|
2836
3006
|
// Get all key buttons
|
|
2837
3007
|
const keys = mobileKeysBar.querySelectorAll('.mobile-key');
|
|
2838
3008
|
|
|
3009
|
+
// Make all mobile key buttons unfocusable - they must never steal focus
|
|
3010
|
+
// from the terminal's hidden textarea (which would close the virtual keyboard)
|
|
3011
|
+
keys.forEach(key => key.setAttribute('tabindex', '-1'));
|
|
3012
|
+
|
|
2839
3013
|
keys.forEach(key => {
|
|
2840
3014
|
const keyName = key.dataset.key;
|
|
2841
3015
|
if (!keyName) return;
|
|
2842
3016
|
|
|
2843
|
-
//
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
3017
|
+
// If a button ever receives focus, immediately redirect it back
|
|
3018
|
+
// to the terminal. On mobile this prevents the virtual keyboard
|
|
3019
|
+
// from collapsing when a key bar button is tapped.
|
|
3020
|
+
key.addEventListener('focus', () => {
|
|
3021
|
+
key.blur();
|
|
3022
|
+
this.focusTerminal();
|
|
3023
|
+
});
|
|
3024
|
+
|
|
3025
|
+
let touchHandled = false;
|
|
3026
|
+
|
|
3027
|
+
key.addEventListener('touchstart', (e) => {
|
|
3028
|
+
e.preventDefault();
|
|
3029
|
+
touchHandled = true;
|
|
3030
|
+
}, { passive: false });
|
|
3031
|
+
|
|
3032
|
+
key.addEventListener('touchend', (e) => {
|
|
3033
|
+
e.preventDefault();
|
|
3034
|
+
e.stopPropagation();
|
|
3035
|
+
|
|
3036
|
+
if (key.classList.contains('mobile-key-modifier')) {
|
|
3037
|
+
if (keyName === 'ctrl') {
|
|
3038
|
+
this.ctrlPressed = !this.ctrlPressed;
|
|
3039
|
+
key.classList.toggle('active', this.ctrlPressed);
|
|
3040
|
+
} else if (keyName === 'alt') {
|
|
3041
|
+
this.altPressed = !this.altPressed;
|
|
3042
|
+
key.classList.toggle('active', this.altPressed);
|
|
3043
|
+
}
|
|
3044
|
+
} else {
|
|
3045
|
+
this.sendMobileKey(keyName);
|
|
3046
|
+
}
|
|
3047
|
+
}, { passive: false });
|
|
3048
|
+
|
|
3049
|
+
key.addEventListener('mousedown', (e) => {
|
|
3050
|
+
e.preventDefault();
|
|
3051
|
+
});
|
|
3052
|
+
|
|
3053
|
+
key.addEventListener('click', (e) => {
|
|
3054
|
+
e.preventDefault();
|
|
3055
|
+
e.stopPropagation();
|
|
3056
|
+
if (touchHandled) { touchHandled = false; return; }
|
|
3057
|
+
|
|
3058
|
+
if (key.classList.contains('mobile-key-modifier')) {
|
|
2849
3059
|
if (keyName === 'ctrl') {
|
|
2850
3060
|
this.ctrlPressed = !this.ctrlPressed;
|
|
2851
3061
|
key.classList.toggle('active', this.ctrlPressed);
|
|
2852
|
-
console.log('[SSHIFT] Ctrl', this.ctrlPressed ? 'pressed' : 'released');
|
|
2853
3062
|
} else if (keyName === 'alt') {
|
|
2854
3063
|
this.altPressed = !this.altPressed;
|
|
2855
3064
|
key.classList.toggle('active', this.altPressed);
|
|
2856
|
-
console.log('[SSHIFT] Alt', this.altPressed ? 'pressed' : 'released');
|
|
2857
3065
|
}
|
|
2858
|
-
|
|
2859
|
-
// Focus terminal after pressing modifier
|
|
2860
3066
|
this.focusTerminal();
|
|
2861
|
-
}
|
|
2862
|
-
} else {
|
|
2863
|
-
// Regular keys - send on click/tap
|
|
2864
|
-
key.addEventListener('click', (e) => {
|
|
2865
|
-
e.preventDefault();
|
|
2866
|
-
e.stopPropagation();
|
|
3067
|
+
} else {
|
|
2867
3068
|
this.sendMobileKey(keyName);
|
|
2868
|
-
}
|
|
2869
|
-
}
|
|
3069
|
+
}
|
|
3070
|
+
});
|
|
3071
|
+
});
|
|
3072
|
+
|
|
3073
|
+
// Safety net: if focus somehow lands inside the keys bar, redirect
|
|
3074
|
+
// it back to the terminal immediately
|
|
3075
|
+
mobileKeysBar.addEventListener('focusin', (e) => {
|
|
3076
|
+
if (e.target) e.target.blur();
|
|
3077
|
+
this.focusTerminal();
|
|
2870
3078
|
});
|
|
2871
3079
|
|
|
2872
3080
|
// Initial visibility update
|
|
@@ -3345,11 +3553,16 @@ class SSHIFTClient {
|
|
|
3345
3553
|
// Write the serialized terminal state
|
|
3346
3554
|
// This includes all escape sequences to reconstruct the screen
|
|
3347
3555
|
session.terminal.write(state, () => {
|
|
3348
|
-
console.log('[SSHIFT] Terminal state synchronized');
|
|
3556
|
+
console.log('[SSHIFT] Terminal state synchronized, partial:', data.partial);
|
|
3349
3557
|
|
|
3350
3558
|
// Clear syncing flag after sync is complete
|
|
3351
3559
|
session.syncing = false;
|
|
3352
3560
|
|
|
3561
|
+
// If full scrollback was restored, scroll to bottom to show latest output
|
|
3562
|
+
if (!data.partial) {
|
|
3563
|
+
session.terminal.scrollToBottom();
|
|
3564
|
+
}
|
|
3565
|
+
|
|
3353
3566
|
// Resize terminal to match the session's dimensions if provided
|
|
3354
3567
|
// Note: We do NOT call fit() here because:
|
|
3355
3568
|
// 1. This client is joining an existing session and is not the controller
|
|
@@ -4056,21 +4269,77 @@ class SSHIFTClient {
|
|
|
4056
4269
|
});
|
|
4057
4270
|
|
|
4058
4271
|
// Special keys modal
|
|
4059
|
-
document.getElementById('specialKeysBtn')
|
|
4060
|
-
|
|
4272
|
+
const specialKeysBtnEl = document.getElementById('specialKeysBtn');
|
|
4273
|
+
specialKeysBtnEl.setAttribute('tabindex', '-1');
|
|
4274
|
+
specialKeysBtnEl.addEventListener('focus', () => {
|
|
4275
|
+
specialKeysBtnEl.blur();
|
|
4276
|
+
if (this.isMobile) this.focusTerminal();
|
|
4277
|
+
});
|
|
4278
|
+
specialKeysBtnEl.addEventListener('touchstart', (e) => {
|
|
4279
|
+
if (this.isMobile) e.preventDefault();
|
|
4280
|
+
}, { passive: false });
|
|
4281
|
+
specialKeysBtnEl.addEventListener('mousedown', (e) => {
|
|
4282
|
+
if (this.isMobile) e.preventDefault();
|
|
4283
|
+
});
|
|
4284
|
+
specialKeysBtnEl.addEventListener('click', () => {
|
|
4061
4285
|
this.handleSpecialKeys('panel-0');
|
|
4062
4286
|
});
|
|
4063
4287
|
|
|
4064
|
-
document.getElementById('closeSpecialKeysModal')
|
|
4288
|
+
const closeSpecialKeysBtn = document.getElementById('closeSpecialKeysModal');
|
|
4289
|
+
closeSpecialKeysBtn.setAttribute('tabindex', '-1');
|
|
4290
|
+
closeSpecialKeysBtn.addEventListener('focus', () => {
|
|
4291
|
+
closeSpecialKeysBtn.blur();
|
|
4292
|
+
if (this.isMobile) this.focusTerminal();
|
|
4293
|
+
});
|
|
4294
|
+
closeSpecialKeysBtn.addEventListener('touchstart', (e) => {
|
|
4295
|
+
e.preventDefault();
|
|
4296
|
+
}, { passive: false });
|
|
4297
|
+
closeSpecialKeysBtn.addEventListener('touchend', (e) => {
|
|
4298
|
+
e.preventDefault();
|
|
4299
|
+
this.closeModal('specialKeysModal');
|
|
4300
|
+
this.focusTerminal();
|
|
4301
|
+
}, { passive: false });
|
|
4302
|
+
closeSpecialKeysBtn.addEventListener('mousedown', (e) => {
|
|
4303
|
+
e.preventDefault();
|
|
4304
|
+
});
|
|
4305
|
+
closeSpecialKeysBtn.addEventListener('click', () => {
|
|
4065
4306
|
this.closeModal('specialKeysModal');
|
|
4307
|
+
this.focusTerminal();
|
|
4066
4308
|
});
|
|
4067
4309
|
|
|
4068
4310
|
// Special key buttons
|
|
4311
|
+
const specialKeysModal = document.getElementById('specialKeysModal');
|
|
4069
4312
|
document.querySelectorAll('.key-btn').forEach(btn => {
|
|
4313
|
+
btn.setAttribute('tabindex', '-1');
|
|
4314
|
+
btn.addEventListener('focus', () => {
|
|
4315
|
+
btn.blur();
|
|
4316
|
+
if (this.isMobile) this.focusTerminal();
|
|
4317
|
+
});
|
|
4318
|
+
let btnTouchHandled = false;
|
|
4319
|
+
btn.addEventListener('touchstart', (e) => {
|
|
4320
|
+
e.preventDefault();
|
|
4321
|
+
btnTouchHandled = true;
|
|
4322
|
+
}, { passive: false });
|
|
4323
|
+
btn.addEventListener('touchend', (e) => {
|
|
4324
|
+
e.preventDefault();
|
|
4325
|
+
this.sendSpecialKey(btn.dataset.key);
|
|
4326
|
+
}, { passive: false });
|
|
4327
|
+
btn.addEventListener('mousedown', (e) => {
|
|
4328
|
+
e.preventDefault();
|
|
4329
|
+
});
|
|
4070
4330
|
btn.addEventListener('click', () => {
|
|
4331
|
+
if (btnTouchHandled) { btnTouchHandled = false; return; }
|
|
4071
4332
|
this.sendSpecialKey(btn.dataset.key);
|
|
4072
4333
|
});
|
|
4073
4334
|
});
|
|
4335
|
+
|
|
4336
|
+
// Safety net: refocus terminal if focus lands inside special keys modal
|
|
4337
|
+
if (specialKeysModal) {
|
|
4338
|
+
specialKeysModal.addEventListener('focusin', (e) => {
|
|
4339
|
+
if (e.target) e.target.blur();
|
|
4340
|
+
if (this.isMobile) this.focusTerminal();
|
|
4341
|
+
});
|
|
4342
|
+
}
|
|
4074
4343
|
|
|
4075
4344
|
// Font size buttons
|
|
4076
4345
|
document.getElementById('increaseFontBtn').addEventListener('click', () => {
|
|
@@ -4128,11 +4397,18 @@ class SSHIFTClient {
|
|
|
4128
4397
|
|
|
4129
4398
|
// Click outside modal to close
|
|
4130
4399
|
document.querySelectorAll('.modal').forEach(modal => {
|
|
4400
|
+
modal.addEventListener('mousedown', (e) => {
|
|
4401
|
+
if (e.target === modal && this.isMobile) e.preventDefault();
|
|
4402
|
+
});
|
|
4403
|
+
modal.addEventListener('touchstart', (e) => {
|
|
4404
|
+
if (e.target === modal) e.preventDefault();
|
|
4405
|
+
}, { passive: false });
|
|
4131
4406
|
modal.addEventListener('click', (e) => {
|
|
4132
4407
|
if (e.target === modal) {
|
|
4133
4408
|
e.preventDefault();
|
|
4134
4409
|
e.stopImmediatePropagation();
|
|
4135
4410
|
this.closeModal(modal.id);
|
|
4411
|
+
if (this.isMobile) this.focusTerminal();
|
|
4136
4412
|
}
|
|
4137
4413
|
});
|
|
4138
4414
|
});
|
|
@@ -4256,6 +4532,18 @@ class SSHIFTClient {
|
|
|
4256
4532
|
mobileKeysBarToggle.checked = this.mobileKeysBarEnabled;
|
|
4257
4533
|
}
|
|
4258
4534
|
|
|
4535
|
+
// Load current WebGL renderer setting
|
|
4536
|
+
const webglRendererToggle = document.getElementById('webglRendererToggle');
|
|
4537
|
+
if (webglRendererToggle) {
|
|
4538
|
+
webglRendererToggle.checked = this.webglRenderer;
|
|
4539
|
+
}
|
|
4540
|
+
|
|
4541
|
+
// Load current image addon setting
|
|
4542
|
+
const imageAddonToggle = document.getElementById('imageAddonToggle');
|
|
4543
|
+
if (imageAddonToggle) {
|
|
4544
|
+
imageAddonToggle.checked = this.imageAddonEnabled;
|
|
4545
|
+
}
|
|
4546
|
+
|
|
4259
4547
|
// Update password toggle button state
|
|
4260
4548
|
this.updatePasswordToggleUI();
|
|
4261
4549
|
|
|
@@ -4308,6 +4596,18 @@ class SSHIFTClient {
|
|
|
4308
4596
|
mobileKeysBarToggle.checked = this.mobileKeysBarEnabled;
|
|
4309
4597
|
}
|
|
4310
4598
|
|
|
4599
|
+
// Revert WebGL renderer setting
|
|
4600
|
+
const webglRendererToggle = document.getElementById('webglRendererToggle');
|
|
4601
|
+
if (webglRendererToggle) {
|
|
4602
|
+
webglRendererToggle.checked = this.webglRenderer;
|
|
4603
|
+
}
|
|
4604
|
+
|
|
4605
|
+
// Revert image addon setting
|
|
4606
|
+
const imageAddonToggle = document.getElementById('imageAddonToggle');
|
|
4607
|
+
if (imageAddonToggle) {
|
|
4608
|
+
imageAddonToggle.checked = this.imageAddonEnabled;
|
|
4609
|
+
}
|
|
4610
|
+
|
|
4311
4611
|
this.closeModal('settingsModal');
|
|
4312
4612
|
});
|
|
4313
4613
|
}
|
|
@@ -4347,13 +4647,26 @@ class SSHIFTClient {
|
|
|
4347
4647
|
this.updateMobileKeysBar();
|
|
4348
4648
|
}
|
|
4349
4649
|
|
|
4650
|
+
// Save WebGL renderer setting
|
|
4651
|
+
if (webglRendererToggle) {
|
|
4652
|
+
this.webglRenderer = webglRendererToggle.checked;
|
|
4653
|
+
}
|
|
4654
|
+
|
|
4655
|
+
// Save image addon setting
|
|
4656
|
+
const imageAddonToggle = document.getElementById('imageAddonToggle');
|
|
4657
|
+
if (imageAddonToggle) {
|
|
4658
|
+
this.imageAddonEnabled = imageAddonToggle.checked;
|
|
4659
|
+
}
|
|
4660
|
+
|
|
4350
4661
|
// Save all settings to config
|
|
4351
4662
|
this.saveStickyConfig();
|
|
4352
4663
|
console.log('[SSHIFT] Settings saved - sticky:', this.sticky,
|
|
4353
4664
|
'takeControlDefault:', this.takeControlDefault,
|
|
4354
4665
|
'keepaliveInterval:', this.sshKeepaliveInterval,
|
|
4355
4666
|
'keepaliveCountMax:', this.sshKeepaliveCountMax,
|
|
4356
|
-
'mobileKeysBarEnabled:', this.mobileKeysBarEnabled
|
|
4667
|
+
'mobileKeysBarEnabled:', this.mobileKeysBarEnabled,
|
|
4668
|
+
'webglRenderer:', this.webglRenderer,
|
|
4669
|
+
'imageAddonEnabled:', this.imageAddonEnabled);
|
|
4357
4670
|
|
|
4358
4671
|
// Show toast notification
|
|
4359
4672
|
this.showToast('Settings saved successfully', 'success');
|
|
@@ -4387,12 +4700,109 @@ class SSHIFTClient {
|
|
|
4387
4700
|
keepaliveCountMaxInput.value = this.sshKeepaliveCountMax;
|
|
4388
4701
|
}
|
|
4389
4702
|
|
|
4703
|
+
const webglRendererToggle = document.getElementById('webglRendererToggle');
|
|
4704
|
+
if (webglRendererToggle) {
|
|
4705
|
+
webglRendererToggle.checked = this.webglRenderer;
|
|
4706
|
+
}
|
|
4707
|
+
|
|
4708
|
+
const imageAddonToggle = document.getElementById('imageAddonToggle');
|
|
4709
|
+
if (imageAddonToggle) {
|
|
4710
|
+
imageAddonToggle.checked = this.imageAddonEnabled;
|
|
4711
|
+
}
|
|
4712
|
+
|
|
4390
4713
|
this.closeModal('settingsModal');
|
|
4391
4714
|
}
|
|
4392
4715
|
});
|
|
4393
4716
|
}
|
|
4394
4717
|
}
|
|
4395
4718
|
|
|
4719
|
+
initSecurityInfoDialog() {
|
|
4720
|
+
const showBtn = document.getElementById('showSecurityInfoBtn');
|
|
4721
|
+
if (showBtn) {
|
|
4722
|
+
showBtn.addEventListener('click', () => {
|
|
4723
|
+
this.closeModal('settingsModal');
|
|
4724
|
+
this.openSecurityInfoDialog();
|
|
4725
|
+
});
|
|
4726
|
+
}
|
|
4727
|
+
|
|
4728
|
+
const closeBtn = document.getElementById('closeSecurityInfoModal');
|
|
4729
|
+
if (closeBtn) {
|
|
4730
|
+
closeBtn.addEventListener('click', () => {
|
|
4731
|
+
this.closeModal('securityInfoModal');
|
|
4732
|
+
});
|
|
4733
|
+
}
|
|
4734
|
+
|
|
4735
|
+
const closeBtn2 = document.getElementById('closeSecurityInfoBtn');
|
|
4736
|
+
if (closeBtn2) {
|
|
4737
|
+
closeBtn2.addEventListener('click', () => {
|
|
4738
|
+
const dontShow = document.getElementById('dontShowSecurityInfo');
|
|
4739
|
+
if (dontShow && dontShow.checked) {
|
|
4740
|
+
localStorage.setItem('dontShowSecurityInfo', 'true');
|
|
4741
|
+
} else {
|
|
4742
|
+
localStorage.removeItem('dontShowSecurityInfo');
|
|
4743
|
+
}
|
|
4744
|
+
this.closeModal('securityInfoModal');
|
|
4745
|
+
});
|
|
4746
|
+
}
|
|
4747
|
+
|
|
4748
|
+
const downloadCertBtn = document.getElementById('downloadCertBtn');
|
|
4749
|
+
if (downloadCertBtn) {
|
|
4750
|
+
downloadCertBtn.addEventListener('click', () => {
|
|
4751
|
+
window.open('/api/cert', '_blank');
|
|
4752
|
+
});
|
|
4753
|
+
}
|
|
4754
|
+
|
|
4755
|
+
const modal = document.getElementById('securityInfoModal');
|
|
4756
|
+
if (modal) {
|
|
4757
|
+
modal.addEventListener('click', (e) => {
|
|
4758
|
+
if (e.target === modal) {
|
|
4759
|
+
this.closeModal('securityInfoModal');
|
|
4760
|
+
}
|
|
4761
|
+
});
|
|
4762
|
+
}
|
|
4763
|
+
|
|
4764
|
+
const dontShowCheckbox = document.getElementById('dontShowSecurityInfo');
|
|
4765
|
+
if (dontShowCheckbox) {
|
|
4766
|
+
const stored = localStorage.getItem('dontShowSecurityInfo');
|
|
4767
|
+
dontShowCheckbox.checked = stored === 'true';
|
|
4768
|
+
}
|
|
4769
|
+
|
|
4770
|
+
// Auto-show on startup if not dismissed
|
|
4771
|
+
const dontShow = localStorage.getItem('dontShowSecurityInfo');
|
|
4772
|
+
if (dontShow !== 'true') {
|
|
4773
|
+
setTimeout(() => this.openSecurityInfoDialog(), 1000);
|
|
4774
|
+
}
|
|
4775
|
+
}
|
|
4776
|
+
|
|
4777
|
+
openSecurityInfoDialog() {
|
|
4778
|
+
const swStatusText = document.getElementById('swStatusText');
|
|
4779
|
+
// Re-check actual SW state from navigator API
|
|
4780
|
+
let swStatus = window._swStatus;
|
|
4781
|
+
if (navigator.serviceWorker && navigator.serviceWorker.controller) {
|
|
4782
|
+
swStatus = 'active';
|
|
4783
|
+
window._swStatus = 'active';
|
|
4784
|
+
}
|
|
4785
|
+
|
|
4786
|
+
if (swStatusText) {
|
|
4787
|
+
if (swStatus === 'active') {
|
|
4788
|
+
swStatusText.innerHTML = '<i class="fas fa-check-circle" style="color: var(--accent-success, #4caf50);"></i> Service Worker is <strong>active</strong>. Offline caching is available.';
|
|
4789
|
+
} else if (swStatus === 'failed') {
|
|
4790
|
+
swStatusText.innerHTML = '<i class="fas fa-exclamation-triangle" style="color: var(--accent-danger, #f44336);"></i> Service Worker <strong>failed to register</strong>: ' + (window._swError || 'Unknown error') + '. This is usually caused by an untrusted HTTPS certificate. Download and install the certificate below to fix this, then reload the page.';
|
|
4791
|
+
} else if (swStatus === 'redundant') {
|
|
4792
|
+
swStatusText.innerHTML = '<i class="fas fa-exclamation-triangle" style="color: var(--accent-danger, #f44336);"></i> Service Worker became <strong>redundant</strong>. ' + (window._swError || 'The HTTPS certificate may not be trusted.') + ' Download and install the certificate below, then reload the page.';
|
|
4793
|
+
} else if (swStatus === 'unsupported') {
|
|
4794
|
+
swStatusText.innerHTML = '<i class="fas fa-info-circle" style="color: var(--accent-warning, #ff9800);"></i> Service Workers are <strong>not supported</strong> in this browser.';
|
|
4795
|
+
} else {
|
|
4796
|
+
// Still loading, retry
|
|
4797
|
+
swStatusText.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Checking...';
|
|
4798
|
+
setTimeout(() => this.openSecurityInfoDialog(), 500);
|
|
4799
|
+
return;
|
|
4800
|
+
}
|
|
4801
|
+
}
|
|
4802
|
+
|
|
4803
|
+
this.openModal('securityInfoModal');
|
|
4804
|
+
}
|
|
4805
|
+
|
|
4396
4806
|
// Sessions Modal
|
|
4397
4807
|
async openSessionsModal() {
|
|
4398
4808
|
this.openModal('manageSessionsModal');
|
|
@@ -4686,6 +5096,15 @@ class SSHIFTClient {
|
|
|
4686
5096
|
mobileTabsMenu.classList.toggle('show');
|
|
4687
5097
|
});
|
|
4688
5098
|
|
|
5099
|
+
// Force resize button (static dropdown)
|
|
5100
|
+
const forceResizeBtn = document.getElementById('mobileForceResizeBtn');
|
|
5101
|
+
if (forceResizeBtn) {
|
|
5102
|
+
forceResizeBtn.addEventListener('click', (e) => {
|
|
5103
|
+
e.stopPropagation();
|
|
5104
|
+
this.forceResizeTerminal(this.activeSessionId);
|
|
5105
|
+
});
|
|
5106
|
+
}
|
|
5107
|
+
|
|
4689
5108
|
// Close dropdown when clicking outside
|
|
4690
5109
|
document.addEventListener('click', (e) => {
|
|
4691
5110
|
if (mobileTabsMenu.classList.contains('show') && !e.target.closest('.mobile-tabs-dropdown')) {
|
|
@@ -4961,6 +5380,8 @@ class SSHIFTClient {
|
|
|
4961
5380
|
localStorage.setItem('sshKeepaliveInterval', this.sshKeepaliveInterval || 10000);
|
|
4962
5381
|
localStorage.setItem('sshKeepaliveCountMax', this.sshKeepaliveCountMax || 1000);
|
|
4963
5382
|
localStorage.setItem('mobileKeysBarEnabled', JSON.stringify(this.mobileKeysBarEnabled));
|
|
5383
|
+
localStorage.setItem('webglRenderer', JSON.stringify(this.webglRenderer));
|
|
5384
|
+
localStorage.setItem('imageAddonEnabled', JSON.stringify(this.imageAddonEnabled));
|
|
4964
5385
|
|
|
4965
5386
|
// Save to server config
|
|
4966
5387
|
const headers = { 'Content-Type': 'application/json' };
|
|
@@ -4973,7 +5394,9 @@ class SSHIFTClient {
|
|
|
4973
5394
|
takeControlDefault: this.takeControlDefault,
|
|
4974
5395
|
sshKeepaliveInterval: this.sshKeepaliveInterval || 10000,
|
|
4975
5396
|
sshKeepaliveCountMax: this.sshKeepaliveCountMax || 1000,
|
|
4976
|
-
mobileKeysBarEnabled: this.mobileKeysBarEnabled
|
|
5397
|
+
mobileKeysBarEnabled: this.mobileKeysBarEnabled,
|
|
5398
|
+
webglRenderer: this.webglRenderer,
|
|
5399
|
+
imageAddonEnabled: this.imageAddonEnabled
|
|
4977
5400
|
})
|
|
4978
5401
|
}).then(response => {
|
|
4979
5402
|
if (!response.ok) {
|
|
@@ -5114,6 +5537,15 @@ class SSHIFTClient {
|
|
|
5114
5537
|
if (session.terminal) {
|
|
5115
5538
|
const theme = this.getTerminalTheme();
|
|
5116
5539
|
session.terminal.options.theme = theme;
|
|
5540
|
+
const wrapper = document.getElementById(`terminal-wrapper-${sessionId}`);
|
|
5541
|
+
if (wrapper) {
|
|
5542
|
+
const bgColor = this.terminalColorOverride
|
|
5543
|
+
? (this.terminalBgColor || '#0d1117')
|
|
5544
|
+
: '#0d1117';
|
|
5545
|
+
wrapper.style.backgroundColor = bgColor;
|
|
5546
|
+
this.applyScrollbarColors(wrapper, bgColor);
|
|
5547
|
+
}
|
|
5548
|
+
this.updateViewportBackground(session);
|
|
5117
5549
|
}
|
|
5118
5550
|
});
|
|
5119
5551
|
}
|
|
@@ -5444,7 +5876,9 @@ class SSHIFTClient {
|
|
|
5444
5876
|
isController: false, // Default to observer - will be set to true for session creator or when taking control
|
|
5445
5877
|
syncing: false, // Flag to prevent data writes during screen sync
|
|
5446
5878
|
fontSize: this.terminalFontSize, // Initialize with default font size
|
|
5447
|
-
mobileHandler: null // Mobile terminal handler for touch interactions
|
|
5879
|
+
mobileHandler: null, // Mobile terminal handler for touch interactions
|
|
5880
|
+
writeBuffer: '', // Buffer for batching terminal writes
|
|
5881
|
+
writeRAF: null // requestAnimationFrame ID for write flush
|
|
5448
5882
|
});
|
|
5449
5883
|
|
|
5450
5884
|
// Switch to the new tab FIRST to make the container visible
|
|
@@ -5812,21 +6246,28 @@ class SSHIFTClient {
|
|
|
5812
6246
|
fontFamily: "'JetBrains Mono', 'Fira Code', 'Consolas', 'Courier New', monospace",
|
|
5813
6247
|
fontSize: this.terminalFontSize,
|
|
5814
6248
|
lineHeight: 1.0,
|
|
5815
|
-
cursorBlink:
|
|
6249
|
+
cursorBlink: false,
|
|
5816
6250
|
cursorStyle: 'block',
|
|
5817
|
-
scrollback:
|
|
6251
|
+
scrollback: 5000,
|
|
5818
6252
|
allowProposedApi: true,
|
|
5819
6253
|
convertEol: true,
|
|
5820
|
-
allowTransparency:
|
|
5821
|
-
disableStdin: false
|
|
6254
|
+
allowTransparency: false,
|
|
6255
|
+
disableStdin: false,
|
|
6256
|
+
logLevel: 'warn',
|
|
6257
|
+
fastScrollModifier: 'alt',
|
|
6258
|
+
fastScrollSensitivity: 5,
|
|
6259
|
+
smoothScrollDuration: 80,
|
|
6260
|
+
overviewRuler: { width: 14 }
|
|
5822
6261
|
});
|
|
5823
6262
|
|
|
5824
6263
|
// Set wrapper background color
|
|
5825
6264
|
if (wrapper) {
|
|
5826
6265
|
if (this.terminalColorOverride) {
|
|
5827
6266
|
wrapper.style.backgroundColor = this.terminalBgColor;
|
|
6267
|
+
this.applyScrollbarColors(wrapper, this.terminalBgColor);
|
|
5828
6268
|
} else {
|
|
5829
6269
|
wrapper.style.backgroundColor = '#0d1117';
|
|
6270
|
+
this.applyScrollbarColors(wrapper, '#0d1117');
|
|
5830
6271
|
}
|
|
5831
6272
|
}
|
|
5832
6273
|
|
|
@@ -5873,6 +6314,44 @@ class SSHIFTClient {
|
|
|
5873
6314
|
|
|
5874
6315
|
terminal.open(container);
|
|
5875
6316
|
|
|
6317
|
+
// Load WebGL renderer addon if enabled and available
|
|
6318
|
+
if (this.webglRenderer && typeof window.WebglAddon === 'function') {
|
|
6319
|
+
try {
|
|
6320
|
+
const webglAddon = new window.WebglAddon();
|
|
6321
|
+
webglAddon.onContextLoss(() => {
|
|
6322
|
+
console.warn('[SSHIFT] WebGL context lost, disposing addon');
|
|
6323
|
+
webglAddon.dispose();
|
|
6324
|
+
});
|
|
6325
|
+
terminal.loadAddon(webglAddon);
|
|
6326
|
+
console.log('[SSHIFT] WebglAddon loaded');
|
|
6327
|
+
} catch (e) {
|
|
6328
|
+
console.warn('[SSHIFT] Failed to load WebglAddon, falling back to canvas renderer:', e.message);
|
|
6329
|
+
}
|
|
6330
|
+
} else if (this.webglRenderer) {
|
|
6331
|
+
console.warn('[SSHIFT] WebglAddon not available (window.WebglAddon type:', typeof window.WebglAddon, '), using canvas renderer');
|
|
6332
|
+
} else {
|
|
6333
|
+
console.log('[SSHIFT] WebGL renderer disabled in settings, using canvas renderer');
|
|
6334
|
+
}
|
|
6335
|
+
|
|
6336
|
+
// Load image addon if enabled and available (Sixel/iTerm2/Kitty image protocols)
|
|
6337
|
+
if (this.imageAddonEnabled && typeof window.ImageAddon === 'function') {
|
|
6338
|
+
try {
|
|
6339
|
+
const imageAddon = new window.ImageAddon();
|
|
6340
|
+
terminal.loadAddon(imageAddon);
|
|
6341
|
+
console.log('[SSHIFT] ImageAddon loaded');
|
|
6342
|
+
} catch (e) {
|
|
6343
|
+
console.warn('[SSHIFT] Failed to load ImageAddon:', e.message);
|
|
6344
|
+
}
|
|
6345
|
+
} else if (this.imageAddonEnabled) {
|
|
6346
|
+
console.warn('[SSHIFT] ImageAddon not available (window.ImageAddon type:', typeof window.ImageAddon, ')');
|
|
6347
|
+
} else {
|
|
6348
|
+
console.log('[SSHIFT] Image addon disabled in settings');
|
|
6349
|
+
}
|
|
6350
|
+
|
|
6351
|
+
// Enable cursor blink after addons are loaded to avoid
|
|
6352
|
+
// repaint interference during initial render
|
|
6353
|
+
terminal.options.cursorBlink = true;
|
|
6354
|
+
|
|
5876
6355
|
console.log('[SSHIFT] Terminal opened, fitting...');
|
|
5877
6356
|
|
|
5878
6357
|
// Fit after a small delay to ensure container is visible and rendered
|
|
@@ -6189,6 +6668,18 @@ class SSHIFTClient {
|
|
|
6189
6668
|
session.terminal = terminal;
|
|
6190
6669
|
session.fitAddon = fitAddon;
|
|
6191
6670
|
|
|
6671
|
+
this.updateViewportBackground(session);
|
|
6672
|
+
|
|
6673
|
+
// Flush any data that was buffered before the terminal was ready
|
|
6674
|
+
if (session.writeBuffer) {
|
|
6675
|
+
terminal.write(session.writeBuffer);
|
|
6676
|
+
session.writeBuffer = '';
|
|
6677
|
+
if (session.writeRAF) {
|
|
6678
|
+
cancelAnimationFrame(session.writeRAF);
|
|
6679
|
+
session.writeRAF = null;
|
|
6680
|
+
}
|
|
6681
|
+
}
|
|
6682
|
+
|
|
6192
6683
|
// Initialize mobile terminal handler for touch interactions
|
|
6193
6684
|
if (this.isMobile && typeof window.MobileTerminalHandler === 'function') {
|
|
6194
6685
|
try {
|
|
@@ -6237,6 +6728,7 @@ class SSHIFTClient {
|
|
|
6237
6728
|
// Use requestAnimationFrame to ensure terminal.element is available
|
|
6238
6729
|
requestAnimationFrame(() => {
|
|
6239
6730
|
this.setupMobileScrollBehavior(sessionId);
|
|
6731
|
+
this.setupWheelScroll(sessionId);
|
|
6240
6732
|
});
|
|
6241
6733
|
|
|
6242
6734
|
console.log('[SSHIFT] Terminal initialized for session:', sessionId);
|
|
@@ -6306,20 +6798,27 @@ class SSHIFTClient {
|
|
|
6306
6798
|
const session = this.sessions.get(data.sessionId);
|
|
6307
6799
|
if (session && session.terminal) {
|
|
6308
6800
|
// Skip data if we're currently syncing the terminal state
|
|
6309
|
-
// This prevents duplicate data from being written during sync
|
|
6310
6801
|
if (session.syncing) {
|
|
6311
|
-
console.log('[SSHIFT] Skipping data during sync, size:', data.data?.length || 0);
|
|
6312
6802
|
return;
|
|
6313
6803
|
}
|
|
6314
6804
|
|
|
6315
6805
|
try {
|
|
6316
|
-
|
|
6806
|
+
// Buffer data and flush once per animation frame to prevent
|
|
6807
|
+
// render queue backup during high-throughput output (e.g. video)
|
|
6808
|
+
session.writeBuffer += data.data;
|
|
6809
|
+
|
|
6810
|
+
if (!session.writeRAF) {
|
|
6811
|
+
session.writeRAF = requestAnimationFrame(() => {
|
|
6812
|
+
if (session.terminal && session.writeBuffer) {
|
|
6813
|
+
session.terminal.write(session.writeBuffer);
|
|
6814
|
+
session.writeBuffer = '';
|
|
6815
|
+
}
|
|
6816
|
+
session.writeRAF = null;
|
|
6817
|
+
});
|
|
6818
|
+
}
|
|
6317
6819
|
|
|
6318
6820
|
// Auto-scroll to bottom on mobile when new data arrives
|
|
6319
|
-
// Rate-limited to prevent performance issues with multiple clients
|
|
6320
6821
|
if (this.isMobile) {
|
|
6321
|
-
// Use requestAnimationFrame to ensure scroll happens after render
|
|
6322
|
-
// and cancel any pending scroll to prevent scroll storms
|
|
6323
6822
|
if (session.scrollRAF) {
|
|
6324
6823
|
cancelAnimationFrame(session.scrollRAF);
|
|
6325
6824
|
}
|
|
@@ -6912,11 +7411,22 @@ class SSHIFTClient {
|
|
|
6912
7411
|
clearTimeout(session.resizeTimeout);
|
|
6913
7412
|
session.resizeTimeout = null;
|
|
6914
7413
|
}
|
|
7414
|
+
// Clean up write buffer RAF
|
|
7415
|
+
if (session.writeRAF) {
|
|
7416
|
+
cancelAnimationFrame(session.writeRAF);
|
|
7417
|
+
session.writeRAF = null;
|
|
7418
|
+
}
|
|
6915
7419
|
// Clean up mobile handler
|
|
6916
7420
|
if (session.mobileHandler) {
|
|
6917
7421
|
session.mobileHandler.destroy();
|
|
6918
7422
|
session.mobileHandler = null;
|
|
6919
7423
|
}
|
|
7424
|
+
// Clean up wheel handler
|
|
7425
|
+
if (session.wheelHandler && session.wheelElement) {
|
|
7426
|
+
session.wheelElement.removeEventListener('wheel', session.wheelHandler);
|
|
7427
|
+
session.wheelHandler = null;
|
|
7428
|
+
session.wheelElement = null;
|
|
7429
|
+
}
|
|
6920
7430
|
if (session.terminal) {
|
|
6921
7431
|
session.terminal.dispose();
|
|
6922
7432
|
}
|
|
@@ -7014,6 +7524,9 @@ class SSHIFTClient {
|
|
|
7014
7524
|
|
|
7015
7525
|
// Clean up the session locally (don't emit tab-close again)
|
|
7016
7526
|
if (session.type === 'ssh') {
|
|
7527
|
+
if (session.wheelHandler && session.wheelElement) {
|
|
7528
|
+
session.wheelElement.removeEventListener('wheel', session.wheelHandler);
|
|
7529
|
+
}
|
|
7017
7530
|
if (session.terminal) {
|
|
7018
7531
|
session.terminal.dispose();
|
|
7019
7532
|
}
|
|
@@ -7166,6 +7679,7 @@ async syncTabsFromServer(tabs) {
|
|
|
7166
7679
|
}
|
|
7167
7680
|
|
|
7168
7681
|
this.closeModal('specialKeysModal');
|
|
7682
|
+
this.focusTerminal();
|
|
7169
7683
|
}
|
|
7170
7684
|
|
|
7171
7685
|
// Bookmarks
|
|
@@ -7668,6 +8182,27 @@ async syncTabsFromServer(tabs) {
|
|
|
7668
8182
|
});
|
|
7669
8183
|
}
|
|
7670
8184
|
|
|
8185
|
+
_clampMenuToViewport(menu, margin = 5) {
|
|
8186
|
+
const rect = menu.getBoundingClientRect();
|
|
8187
|
+
const vw = window.innerWidth;
|
|
8188
|
+
const vh = window.innerHeight;
|
|
8189
|
+
let left = rect.left;
|
|
8190
|
+
let top = rect.top;
|
|
8191
|
+
|
|
8192
|
+
if (rect.right > vw) {
|
|
8193
|
+
left = vw - rect.width - margin;
|
|
8194
|
+
}
|
|
8195
|
+
if (rect.bottom > vh) {
|
|
8196
|
+
top = vh - rect.height - margin;
|
|
8197
|
+
}
|
|
8198
|
+
if (left < margin) left = margin;
|
|
8199
|
+
if (top < margin) top = margin;
|
|
8200
|
+
|
|
8201
|
+
menu.style.transform = '';
|
|
8202
|
+
menu.style.left = `${left}px`;
|
|
8203
|
+
menu.style.top = `${top}px`;
|
|
8204
|
+
}
|
|
8205
|
+
|
|
7671
8206
|
showBookmarkContextMenu(bookmark, event, fromMenuButton = false) {
|
|
7672
8207
|
// Remove any existing context menu
|
|
7673
8208
|
const existingMenu = document.querySelector('.bookmark-context-menu');
|
|
@@ -7784,6 +8319,7 @@ async syncTabsFromServer(tabs) {
|
|
|
7784
8319
|
});
|
|
7785
8320
|
|
|
7786
8321
|
document.body.appendChild(menu);
|
|
8322
|
+
this._clampMenuToViewport(menu);
|
|
7787
8323
|
|
|
7788
8324
|
// Close menu when clicking outside
|
|
7789
8325
|
const closeMenu = (e) => {
|
|
@@ -7860,6 +8396,7 @@ async syncTabsFromServer(tabs) {
|
|
|
7860
8396
|
});
|
|
7861
8397
|
|
|
7862
8398
|
document.body.appendChild(menu);
|
|
8399
|
+
this._clampMenuToViewport(menu);
|
|
7863
8400
|
|
|
7864
8401
|
// Close menu when clicking outside
|
|
7865
8402
|
const closeMenu = (e) => {
|
|
@@ -7963,6 +8500,7 @@ async syncTabsFromServer(tabs) {
|
|
|
7963
8500
|
});
|
|
7964
8501
|
|
|
7965
8502
|
document.body.appendChild(menu);
|
|
8503
|
+
this._clampMenuToViewport(menu);
|
|
7966
8504
|
|
|
7967
8505
|
// Close menu when clicking outside
|
|
7968
8506
|
const closeMenu = (e) => {
|
|
@@ -8142,6 +8680,7 @@ async syncTabsFromServer(tabs) {
|
|
|
8142
8680
|
});
|
|
8143
8681
|
|
|
8144
8682
|
document.body.appendChild(menu);
|
|
8683
|
+
this._clampMenuToViewport(menu);
|
|
8145
8684
|
|
|
8146
8685
|
// Close menu when clicking outside
|
|
8147
8686
|
const closeMenu = (e) => {
|
|
@@ -8276,6 +8815,10 @@ async syncTabsFromServer(tabs) {
|
|
|
8276
8815
|
<i class="fas fa-edit"></i>
|
|
8277
8816
|
<span>Rename Tab</span>
|
|
8278
8817
|
</div>
|
|
8818
|
+
<div class="tab-context-menu-item" data-action="force-resize">
|
|
8819
|
+
<i class="fas fa-expand-arrows-alt"></i>
|
|
8820
|
+
<span>Force Resize</span>
|
|
8821
|
+
</div>
|
|
8279
8822
|
`;
|
|
8280
8823
|
|
|
8281
8824
|
// Position the menu at cursor
|
|
@@ -8290,6 +8833,8 @@ async syncTabsFromServer(tabs) {
|
|
|
8290
8833
|
|
|
8291
8834
|
if (action === 'rename') {
|
|
8292
8835
|
this.startTabRename(sessionId);
|
|
8836
|
+
} else if (action === 'force-resize') {
|
|
8837
|
+
this.forceResizeTerminal(sessionId);
|
|
8293
8838
|
}
|
|
8294
8839
|
|
|
8295
8840
|
menu.remove();
|
|
@@ -8297,6 +8842,7 @@ async syncTabsFromServer(tabs) {
|
|
|
8297
8842
|
});
|
|
8298
8843
|
|
|
8299
8844
|
document.body.appendChild(menu);
|
|
8845
|
+
this._clampMenuToViewport(menu);
|
|
8300
8846
|
|
|
8301
8847
|
// Close menu when clicking outside
|
|
8302
8848
|
const closeMenu = (e) => {
|