@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/example.config.json
CHANGED
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
"devPort": 3000,
|
|
4
4
|
"bind": "0.0.0.0",
|
|
5
5
|
"enableHttps": true,
|
|
6
|
+
"httpRedirect": true,
|
|
6
7
|
"certPath": null,
|
|
7
8
|
"keyPath": null,
|
|
8
9
|
"sticky": true,
|
|
9
10
|
"sshKeepaliveInterval": 15000,
|
|
10
11
|
"sshKeepaliveCountMax": 500,
|
|
12
|
+
"webglRenderer": true,
|
|
13
|
+
"imageAddonEnabled": true,
|
|
11
14
|
"passwordHash": null,
|
|
12
15
|
"plugins": [
|
|
13
16
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lethevimlet/sshift",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "Web-based SSH + SFTP terminal client with tabs and bookmarks",
|
|
5
5
|
"main": "src/server/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -19,10 +19,17 @@
|
|
|
19
19
|
"prepublishOnly": "echo 'Publishing to npm...'"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"@xterm/addon-fit": "^0.11.0",
|
|
23
|
+
"@xterm/addon-image": "^0.9.0",
|
|
24
|
+
"@xterm/addon-search": "^0.16.0",
|
|
22
25
|
"@xterm/addon-serialize": "^0.14.0",
|
|
26
|
+
"@xterm/addon-web-links": "^0.12.0",
|
|
27
|
+
"@xterm/addon-webgl": "^0.19.0",
|
|
23
28
|
"@xterm/headless": "^6.0.0",
|
|
29
|
+
"@xterm/xterm": "^6.0.0",
|
|
24
30
|
"dotenv": "^17.4.0",
|
|
25
31
|
"express": "^4.18.2",
|
|
32
|
+
"httpolyglot": "^0.1.2",
|
|
26
33
|
"lucide": "^1.7.0",
|
|
27
34
|
"selfsigned": "^5.5.0",
|
|
28
35
|
"socket.io": "^4.7.2",
|
|
@@ -18,6 +18,8 @@ function registerConfigEndpoints(app, io) {
|
|
|
18
18
|
sshKeepaliveInterval: config.sshKeepaliveInterval || 10000,
|
|
19
19
|
sshKeepaliveCountMax: config.sshKeepaliveCountMax || 1000,
|
|
20
20
|
mobileKeysBarEnabled: config.mobileKeysBarEnabled !== false,
|
|
21
|
+
webglRenderer: config.webglRenderer !== false,
|
|
22
|
+
imageAddonEnabled: config.imageAddonEnabled !== false,
|
|
21
23
|
layouts: config.layouts || null,
|
|
22
24
|
passwordEnabled: !!config.passwordHash
|
|
23
25
|
});
|
|
@@ -46,6 +48,21 @@ function registerConfigEndpoints(app, io) {
|
|
|
46
48
|
config.sshKeepaliveCountMax = parseInt(req.body.sshKeepaliveCountMax) || 1000;
|
|
47
49
|
}
|
|
48
50
|
|
|
51
|
+
// Update mobile keys bar setting if provided
|
|
52
|
+
if (req.body.hasOwnProperty('mobileKeysBarEnabled')) {
|
|
53
|
+
config.mobileKeysBarEnabled = req.body.mobileKeysBarEnabled;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Update WebGL renderer setting if provided
|
|
57
|
+
if (req.body.hasOwnProperty('webglRenderer')) {
|
|
58
|
+
config.webglRenderer = req.body.webglRenderer;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Update image addon setting if provided
|
|
62
|
+
if (req.body.hasOwnProperty('imageAddonEnabled')) {
|
|
63
|
+
config.imageAddonEnabled = req.body.imageAddonEnabled;
|
|
64
|
+
}
|
|
65
|
+
|
|
49
66
|
// Save config
|
|
50
67
|
const saved = saveConfig(config);
|
|
51
68
|
if (saved) {
|
|
@@ -54,7 +71,10 @@ function registerConfigEndpoints(app, io) {
|
|
|
54
71
|
sticky: config.sticky !== false,
|
|
55
72
|
takeControlDefault: config.takeControlDefault !== false,
|
|
56
73
|
sshKeepaliveInterval: config.sshKeepaliveInterval || 10000,
|
|
57
|
-
sshKeepaliveCountMax: config.sshKeepaliveCountMax || 1000
|
|
74
|
+
sshKeepaliveCountMax: config.sshKeepaliveCountMax || 1000,
|
|
75
|
+
mobileKeysBarEnabled: config.mobileKeysBarEnabled !== false,
|
|
76
|
+
webglRenderer: config.webglRenderer !== false,
|
|
77
|
+
imageAddonEnabled: config.imageAddonEnabled !== false
|
|
58
78
|
});
|
|
59
79
|
} else {
|
|
60
80
|
res.status(500).json({ error: 'Failed to save config' });
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const path = require('path');
|
|
7
|
+
const { getDataDir } = require('../../utils/config');
|
|
8
|
+
|
|
9
|
+
const SSL_CERT_FILE = 'ssl-cert.pem';
|
|
10
|
+
const SSL_KEY_FILE = 'ssl-key.pem';
|
|
7
11
|
|
|
8
12
|
/**
|
|
9
13
|
* Register system endpoints
|
|
@@ -131,6 +135,38 @@ function registerSystemEndpoints(app, io) {
|
|
|
131
135
|
});
|
|
132
136
|
});
|
|
133
137
|
|
|
138
|
+
// API: Download SSL certificate
|
|
139
|
+
app.get('/api/cert', (req, res) => {
|
|
140
|
+
const dataDir = getDataDir();
|
|
141
|
+
const certPath = path.join(dataDir, SSL_CERT_FILE);
|
|
142
|
+
|
|
143
|
+
if (!fs.existsSync(certPath)) {
|
|
144
|
+
return res.status(404).json({ error: 'Certificate not found' });
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
res.setHeader('Content-Type', 'application/x-pem-file');
|
|
148
|
+
res.setHeader('Content-Disposition', 'attachment; filename="sshift-ca.crt"');
|
|
149
|
+
fs.createReadStream(certPath).pipe(res);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// API: Get security context info
|
|
153
|
+
app.get('/api/security-info', (req, res) => {
|
|
154
|
+
const dataDir = getDataDir();
|
|
155
|
+
const certPath = path.join(dataDir, SSL_CERT_FILE);
|
|
156
|
+
const hasCert = fs.existsSync(certPath);
|
|
157
|
+
const protocol = req.protocol;
|
|
158
|
+
const isSecure = req.secure || protocol === 'https';
|
|
159
|
+
const isLocalhost = req.hostname === 'localhost' || req.hostname === '127.0.0.1' || req.hostname === '::1';
|
|
160
|
+
|
|
161
|
+
res.json({
|
|
162
|
+
isSecure,
|
|
163
|
+
isLocalhost,
|
|
164
|
+
protocol,
|
|
165
|
+
certAvailable: hasCert,
|
|
166
|
+
hostname: req.hostname
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
|
|
134
170
|
// API: Trigger update
|
|
135
171
|
app.post('/api/update', async (req, res) => {
|
|
136
172
|
try {
|
|
@@ -84,11 +84,15 @@ function registerSSHHandlers(socket, io) {
|
|
|
84
84
|
console.log('[SSH] ssh-request-sync event received for session:', data.sessionId);
|
|
85
85
|
const state = sshManager.getTerminalState(data.sessionId);
|
|
86
86
|
if (state) {
|
|
87
|
+
// Base64 encode to avoid Socket.IO binary detection issues
|
|
88
|
+
const base64State = Buffer.from(state.state, 'utf-8').toString('base64');
|
|
87
89
|
socket.emit('ssh-screen-sync', {
|
|
88
90
|
sessionId: data.sessionId,
|
|
89
|
-
state:
|
|
91
|
+
state: base64State,
|
|
90
92
|
cols: state.cols,
|
|
91
|
-
rows: state.rows
|
|
93
|
+
rows: state.rows,
|
|
94
|
+
encoded: true,
|
|
95
|
+
partial: false
|
|
92
96
|
});
|
|
93
97
|
} else {
|
|
94
98
|
socket.emit('ssh-error', { message: 'Session not found', sessionId: data.sessionId });
|
package/src/server/index.js
CHANGED
|
@@ -16,9 +16,10 @@ const fs = require('fs');
|
|
|
16
16
|
const path = require('path');
|
|
17
17
|
const socketIO = require('socket.io');
|
|
18
18
|
const selfsigned = require('selfsigned');
|
|
19
|
+
const httpolyglot = require('httpolyglot');
|
|
19
20
|
|
|
20
21
|
// Import utilities
|
|
21
|
-
const { ensureConfig, loadConfig, getPort, getBindAddress, getEnableHttps, getCertPath, getKeyPath, getDataDir, isPasswordSet } = require('./utils/config');
|
|
22
|
+
const { ensureConfig, loadConfig, getPort, getBindAddress, getEnableHttps, getHttpRedirect, getCertPath, getKeyPath, getDataDir, isPasswordSet } = require('./utils/config');
|
|
22
23
|
|
|
23
24
|
// Import services
|
|
24
25
|
const { sshManager, sftpManager } = require('./services');
|
|
@@ -151,9 +152,11 @@ const app = express();
|
|
|
151
152
|
|
|
152
153
|
// Determine if HTTPS should be enabled
|
|
153
154
|
const enableHttps = getEnableHttps();
|
|
155
|
+
const enableHttpRedirect = enableHttps && getHttpRedirect();
|
|
154
156
|
let server;
|
|
155
|
-
let io;
|
|
157
|
+
let io;
|
|
156
158
|
let sslCredentials = null;
|
|
159
|
+
let actuallyHttps = false;
|
|
157
160
|
|
|
158
161
|
// Async initialization function
|
|
159
162
|
async function initializeServer() {
|
|
@@ -162,11 +165,30 @@ async function initializeServer() {
|
|
|
162
165
|
if (enableHttps) {
|
|
163
166
|
try {
|
|
164
167
|
sslCredentials = await getSSLCredentials();
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
|
|
169
|
+
if (enableHttpRedirect) {
|
|
170
|
+
server = httpolyglot.createServer({
|
|
171
|
+
key: sslCredentials.key,
|
|
172
|
+
cert: sslCredentials.cert
|
|
173
|
+
}, app);
|
|
174
|
+
server.on('request', (req, res) => {
|
|
175
|
+
if (!req.socket.encrypted) {
|
|
176
|
+
const host = req.headers.host ? req.headers.host.split(':')[0] : 'localhost';
|
|
177
|
+
const port = getPort();
|
|
178
|
+
res.writeHead(301, { Location: `https://${host}:${port}${req.url}` });
|
|
179
|
+
res.end();
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
actuallyHttps = true;
|
|
183
|
+
console.log('[HTTPS] HTTPS server created with HTTP redirect enabled (dual-protocol)');
|
|
184
|
+
} else {
|
|
185
|
+
server = https.createServer({
|
|
186
|
+
key: sslCredentials.key,
|
|
187
|
+
cert: sslCredentials.cert
|
|
188
|
+
}, app);
|
|
189
|
+
actuallyHttps = true;
|
|
190
|
+
console.log('[HTTPS] HTTPS server created with self-signed certificate');
|
|
191
|
+
}
|
|
170
192
|
} catch (err) {
|
|
171
193
|
console.error('[HTTPS] Failed to create HTTPS server, falling back to HTTP:', err.message);
|
|
172
194
|
server = http.createServer(app);
|
|
@@ -233,6 +255,14 @@ async function initializeServer() {
|
|
|
233
255
|
app.use('/libs', express.static(path.join(webappPath, 'libs')));
|
|
234
256
|
app.use('/tests', express.static(path.join(webappPath, 'tests')));
|
|
235
257
|
|
|
258
|
+
// Service Worker script - must be served from root with proper headers
|
|
259
|
+
app.get('/sw.js', (req, res) => {
|
|
260
|
+
res.setHeader('Content-Type', 'application/javascript');
|
|
261
|
+
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
|
|
262
|
+
res.setHeader('Service-Worker-Allowed', '/');
|
|
263
|
+
res.sendFile(path.join(webappPath, 'sw.js'));
|
|
264
|
+
});
|
|
265
|
+
|
|
236
266
|
// Main route
|
|
237
267
|
app.get('/', (req, res) => {
|
|
238
268
|
res.sendFile(path.join(webappPath, 'index.html'));
|
|
@@ -302,13 +332,13 @@ async function initializeServer() {
|
|
|
302
332
|
|
|
303
333
|
server.listen(PORT, BIND, () => {
|
|
304
334
|
const address = BIND === '0.0.0.0' || BIND === '::' ? 'localhost' : BIND;
|
|
305
|
-
const protocol =
|
|
335
|
+
const protocol = actuallyHttps ? 'https' : 'http';
|
|
306
336
|
console.log(`Web SSH/SFTP Client running at ${protocol}://${address}:${PORT}`);
|
|
307
337
|
// OSC 8 hyperlink: ESC ] 8 ; ; URL BEL text ESC ] 8 ; ; BEL
|
|
308
338
|
const ESC = '\x1b';
|
|
309
339
|
console.log(`${ESC}]8;;${protocol}://${address}:${PORT}${ESC}\\Open in browser${ESC}]8;;${ESC}\\`);
|
|
310
340
|
|
|
311
|
-
|
|
341
|
+
if (actuallyHttps) {
|
|
312
342
|
console.log('[HTTPS] Note: Using self-signed certificate. Your browser may show a security warning.');
|
|
313
343
|
console.log('[HTTPS] For mobile devices, you may need to accept the certificate warning to use native text selection.');
|
|
314
344
|
}
|
|
@@ -7,8 +7,8 @@ class SSHManager {
|
|
|
7
7
|
constructor() {
|
|
8
8
|
this.sessions = new Map();
|
|
9
9
|
// Data batching configuration
|
|
10
|
-
this.batchInterval =
|
|
11
|
-
this.batchMaxSize =
|
|
10
|
+
this.batchInterval = 4; // ~240fps - low latency for responsive rendering
|
|
11
|
+
this.batchMaxSize = 128 * 1024; // 128KB max batch size - send immediately if exceeded
|
|
12
12
|
// Socket.io instance (set via setIO method)
|
|
13
13
|
this.io = null;
|
|
14
14
|
}
|
|
@@ -29,10 +29,13 @@ class SSHManager {
|
|
|
29
29
|
const rows = options.rows || 24;
|
|
30
30
|
|
|
31
31
|
// Create a headless terminal to maintain state
|
|
32
|
+
// Use scrollback 5000 to preserve full history for screen sync on reload
|
|
32
33
|
const terminal = new Terminal({
|
|
33
34
|
cols: cols,
|
|
34
35
|
rows: rows,
|
|
35
|
-
|
|
36
|
+
scrollback: 5000,
|
|
37
|
+
allowProposedApi: true,
|
|
38
|
+
logLevel: 'off'
|
|
36
39
|
});
|
|
37
40
|
|
|
38
41
|
// Create serialize addon for terminal state
|
|
@@ -146,7 +149,7 @@ class SSHManager {
|
|
|
146
149
|
stream.on('data', (data) => {
|
|
147
150
|
const dataStr = data.toString('utf8');
|
|
148
151
|
|
|
149
|
-
// Write to headless terminal
|
|
152
|
+
// Write to headless terminal for state sync (join/resume)
|
|
150
153
|
session.terminal.write(dataStr);
|
|
151
154
|
|
|
152
155
|
// Buffer data for batched broadcast
|
|
@@ -156,7 +159,7 @@ class SSHManager {
|
|
|
156
159
|
stream.stderr.on('data', (data) => {
|
|
157
160
|
const dataStr = data.toString('utf8');
|
|
158
161
|
|
|
159
|
-
// Write to headless terminal
|
|
162
|
+
// Write to headless terminal for state sync
|
|
160
163
|
session.terminal.write(dataStr);
|
|
161
164
|
|
|
162
165
|
// Buffer data for batched broadcast
|
|
@@ -280,40 +283,54 @@ class SSHManager {
|
|
|
280
283
|
|
|
281
284
|
// Send current terminal state to the joining socket BEFORE joining the room
|
|
282
285
|
// This ensures the client gets the full state before receiving any new data
|
|
283
|
-
// This provides the complete screen state for TUIs
|
|
284
286
|
if (session.terminal && session.serializeAddon) {
|
|
285
287
|
try {
|
|
286
|
-
//
|
|
287
|
-
|
|
288
|
-
let serializedState = session.serializeAddon.serialize({
|
|
289
|
-
mode: 'normal' // Only current viewport, not full scrollback
|
|
290
|
-
});
|
|
288
|
+
// Try to serialize full scrollback buffer first (includes all history)
|
|
289
|
+
let serializedState = session.serializeAddon.serialize({ mode: 'all' });
|
|
291
290
|
|
|
292
|
-
//
|
|
291
|
+
// Validate it's a string
|
|
293
292
|
if (typeof serializedState !== 'string') {
|
|
294
293
|
serializedState = String(serializedState);
|
|
295
294
|
}
|
|
296
295
|
|
|
297
|
-
//
|
|
298
|
-
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
296
|
+
// If full state is too large, fall back to viewport-only
|
|
297
|
+
const fullMaxSize = 256 * 1024; // 256KB for full scrollback
|
|
298
|
+
const viewportMaxSize = 50 * 1024; // 50KB fallback for viewport only
|
|
299
|
+
|
|
300
|
+
if (serializedState.length > fullMaxSize) {
|
|
301
|
+
console.warn(`[SSH] Full terminal state too large (${serializedState.length} bytes), falling back to viewport-only`);
|
|
302
|
+
serializedState = session.serializeAddon.serialize({ mode: 'normal' });
|
|
303
|
+
if (typeof serializedState !== 'string') {
|
|
304
|
+
serializedState = String(serializedState);
|
|
305
|
+
}
|
|
304
306
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
+
if (serializedState.length > viewportMaxSize) {
|
|
308
|
+
console.warn(`[SSH] Viewport state also too large (${serializedState.length} bytes), skipping sync`);
|
|
309
|
+
} else {
|
|
310
|
+
// Send viewport-only state
|
|
311
|
+
const base64State = Buffer.from(serializedState, 'utf-8').toString('base64');
|
|
312
|
+
socket.emit('ssh-screen-sync', {
|
|
313
|
+
sessionId: sessionId,
|
|
314
|
+
state: base64State,
|
|
315
|
+
cols: session.cols,
|
|
316
|
+
rows: session.rows,
|
|
317
|
+
encoded: true,
|
|
318
|
+
partial: true
|
|
319
|
+
});
|
|
320
|
+
hasTerminalState = true;
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
// Send full state including scrollback
|
|
307
324
|
const base64State = Buffer.from(serializedState, 'utf-8').toString('base64');
|
|
325
|
+
console.log(`[SSH] Sending full serialized terminal state to socket ${socket.id}, size: ${serializedState.length}, base64: ${base64State.length}`);
|
|
308
326
|
|
|
309
|
-
// Send the serialized state to the joining client
|
|
310
|
-
// Use a plain object with primitive values only
|
|
311
327
|
socket.emit('ssh-screen-sync', {
|
|
312
328
|
sessionId: sessionId,
|
|
313
329
|
state: base64State,
|
|
314
330
|
cols: session.cols,
|
|
315
331
|
rows: session.rows,
|
|
316
|
-
encoded: true
|
|
332
|
+
encoded: true,
|
|
333
|
+
partial: false
|
|
317
334
|
});
|
|
318
335
|
|
|
319
336
|
hasTerminalState = true;
|
|
@@ -479,14 +496,18 @@ class SSHManager {
|
|
|
479
496
|
}
|
|
480
497
|
|
|
481
498
|
try {
|
|
482
|
-
//
|
|
483
|
-
|
|
499
|
+
// Serialize full scrollback buffer to preserve history on reload
|
|
500
|
+
let serializedState = session.serializeAddon.serialize({ mode: 'all' });
|
|
484
501
|
|
|
485
|
-
// Validate size
|
|
502
|
+
// Validate size - allow up to 1MB for manual sync requests
|
|
486
503
|
const maxSize = 1024 * 1024; // 1MB max
|
|
487
504
|
if (serializedState.length > maxSize) {
|
|
488
|
-
console.warn(`[SSH] Terminal state too large (${serializedState.length} bytes),
|
|
489
|
-
|
|
505
|
+
console.warn(`[SSH] Terminal state too large (${serializedState.length} bytes), falling back to viewport-only`);
|
|
506
|
+
serializedState = session.serializeAddon.serialize({ mode: 'normal' });
|
|
507
|
+
if (serializedState.length > maxSize) {
|
|
508
|
+
console.warn(`[SSH] Viewport state also too large (${serializedState.length} bytes), returning null`);
|
|
509
|
+
return null;
|
|
510
|
+
}
|
|
490
511
|
}
|
|
491
512
|
|
|
492
513
|
return {
|
|
@@ -29,6 +29,7 @@ const defaultConfig = {
|
|
|
29
29
|
devPort: 3000,
|
|
30
30
|
bind: '0.0.0.0',
|
|
31
31
|
enableHttps: true,
|
|
32
|
+
httpRedirect: true,
|
|
32
33
|
sticky: true,
|
|
33
34
|
sshKeepaliveInterval: 15000,
|
|
34
35
|
sshKeepaliveCountMax: 500,
|
|
@@ -37,7 +38,9 @@ const defaultConfig = {
|
|
|
37
38
|
plugins: [],
|
|
38
39
|
bookmarks: [],
|
|
39
40
|
folders: [],
|
|
40
|
-
passwordHash: null
|
|
41
|
+
passwordHash: null,
|
|
42
|
+
webglRenderer: true,
|
|
43
|
+
imageAddonEnabled: true
|
|
41
44
|
};
|
|
42
45
|
|
|
43
46
|
/**
|
|
@@ -200,6 +203,24 @@ function getMobileKeysBarEnabled() {
|
|
|
200
203
|
return config.mobileKeysBarEnabled !== false; // Default to true
|
|
201
204
|
}
|
|
202
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Get WebGL renderer setting from config
|
|
208
|
+
* @returns {boolean} WebGL renderer setting
|
|
209
|
+
*/
|
|
210
|
+
function getWebglRenderer() {
|
|
211
|
+
const config = loadConfig();
|
|
212
|
+
return config.webglRenderer !== false; // Default to true
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Get image addon setting from config
|
|
217
|
+
* @returns {boolean} Image addon setting
|
|
218
|
+
*/
|
|
219
|
+
function getImageAddonEnabled() {
|
|
220
|
+
const config = loadConfig();
|
|
221
|
+
return config.imageAddonEnabled !== false; // Default to true
|
|
222
|
+
}
|
|
223
|
+
|
|
203
224
|
/**
|
|
204
225
|
* Get layouts from config
|
|
205
226
|
* @returns {Object|null} Layouts object or null
|
|
@@ -218,6 +239,16 @@ function getEnableHttps() {
|
|
|
218
239
|
return config.enableHttps !== false; // Default to true
|
|
219
240
|
}
|
|
220
241
|
|
|
242
|
+
/**
|
|
243
|
+
* Get HTTP redirect setting from config
|
|
244
|
+
* Only meaningful when HTTPS is enabled - redirects HTTP requests to HTTPS
|
|
245
|
+
* @returns {boolean} Enable HTTP redirect setting
|
|
246
|
+
*/
|
|
247
|
+
function getHttpRedirect() {
|
|
248
|
+
const config = loadConfig();
|
|
249
|
+
return config.httpRedirect !== false; // Default to true
|
|
250
|
+
}
|
|
251
|
+
|
|
221
252
|
/**
|
|
222
253
|
* Get custom certificate path from config
|
|
223
254
|
* @returns {string|null} Path to custom certificate file, or null
|
|
@@ -292,8 +323,11 @@ module.exports = {
|
|
|
292
323
|
getStickySetting,
|
|
293
324
|
getTakeControlDefault,
|
|
294
325
|
getMobileKeysBarEnabled,
|
|
326
|
+
getWebglRenderer,
|
|
327
|
+
getImageAddonEnabled,
|
|
295
328
|
getLayouts,
|
|
296
329
|
getEnableHttps,
|
|
330
|
+
getHttpRedirect,
|
|
297
331
|
getCertPath,
|
|
298
332
|
getKeyPath,
|
|
299
333
|
getDataDir,
|
package/src/webapp/css/style.css
CHANGED
|
@@ -465,6 +465,30 @@ body {
|
|
|
465
465
|
display: none;
|
|
466
466
|
flex: 1;
|
|
467
467
|
position: relative;
|
|
468
|
+
gap: 4px;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.mobile-force-resize-btn {
|
|
472
|
+
display: none;
|
|
473
|
+
align-items: center;
|
|
474
|
+
justify-content: center;
|
|
475
|
+
min-width: 32px;
|
|
476
|
+
min-height: 32px;
|
|
477
|
+
padding: 4px 10px;
|
|
478
|
+
background: var(--bg-tertiary);
|
|
479
|
+
border: 1px solid var(--border-color);
|
|
480
|
+
border-radius: var(--radius-md);
|
|
481
|
+
color: var(--text-secondary);
|
|
482
|
+
font-size: 12px;
|
|
483
|
+
cursor: pointer;
|
|
484
|
+
transition: var(--transition-fast);
|
|
485
|
+
flex-shrink: 0;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.mobile-force-resize-btn:hover {
|
|
489
|
+
background: var(--bg-hover);
|
|
490
|
+
color: var(--accent-primary);
|
|
491
|
+
border-color: var(--border-light);
|
|
468
492
|
}
|
|
469
493
|
|
|
470
494
|
.mobile-tabs-toggle {
|
|
@@ -2306,6 +2330,7 @@ body.dragging-tabs .tabs-container {
|
|
|
2306
2330
|
|
|
2307
2331
|
.terminal-container .xterm-viewport {
|
|
2308
2332
|
height: 100% !important;
|
|
2333
|
+
background-color: #0d1117;
|
|
2309
2334
|
}
|
|
2310
2335
|
|
|
2311
2336
|
.terminal-container .xterm-screen {
|
|
@@ -2323,22 +2348,44 @@ body.dragging-tabs .tabs-container {
|
|
|
2323
2348
|
opacity: 0;
|
|
2324
2349
|
}
|
|
2325
2350
|
|
|
2326
|
-
/*
|
|
2327
|
-
.terminal-container .xterm-
|
|
2328
|
-
|
|
2351
|
+
/* xterm v6 custom scrollbar: always visible */
|
|
2352
|
+
.terminal-container .xterm-scrollable-element > .scrollbar {
|
|
2353
|
+
opacity: 1 !important;
|
|
2354
|
+
pointer-events: auto !important;
|
|
2355
|
+
transition: none !important;
|
|
2356
|
+
background-color: var(--terminal-scrollbar-track, #151b23) !important;
|
|
2329
2357
|
}
|
|
2330
2358
|
|
|
2331
|
-
.terminal-container .xterm-
|
|
2332
|
-
|
|
2359
|
+
.terminal-container .xterm-scrollable-element > .scrollbar.invisible {
|
|
2360
|
+
opacity: 1 !important;
|
|
2361
|
+
pointer-events: auto !important;
|
|
2362
|
+
transition: none !important;
|
|
2363
|
+
background-color: var(--terminal-scrollbar-track, #151b23) !important;
|
|
2333
2364
|
}
|
|
2334
2365
|
|
|
2335
|
-
.terminal-container .xterm-
|
|
2336
|
-
|
|
2337
|
-
|
|
2366
|
+
.terminal-container .xterm-scrollable-element > .scrollbar.invisible.fade {
|
|
2367
|
+
opacity: 1 !important;
|
|
2368
|
+
transition: none !important;
|
|
2369
|
+
background-color: var(--terminal-scrollbar-track, #151b23) !important;
|
|
2338
2370
|
}
|
|
2339
2371
|
|
|
2340
|
-
.terminal-container .xterm-
|
|
2341
|
-
|
|
2372
|
+
.terminal-container .xterm-scrollable-element > .scrollbar > .slider {
|
|
2373
|
+
border-radius: 3px;
|
|
2374
|
+
background-color: var(--terminal-scrollbar-thumb, #3d444d) !important;
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
.terminal-container .xterm-scrollable-element > .shadow {
|
|
2378
|
+
display: none !important;
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
/* Hide native viewport scrollbar (xterm v6 uses custom scrollbar) */
|
|
2382
|
+
.terminal-container .xterm-viewport::-webkit-scrollbar {
|
|
2383
|
+
width: 0;
|
|
2384
|
+
height: 0;
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
.terminal-container .xterm-viewport {
|
|
2388
|
+
scrollbar-width: none;
|
|
2342
2389
|
}
|
|
2343
2390
|
|
|
2344
2391
|
/* Ensure terminal screen is properly positioned */
|
|
@@ -3174,6 +3221,14 @@ body.dragging-tabs .tabs-container {
|
|
|
3174
3221
|
margin-left: 4px;
|
|
3175
3222
|
}
|
|
3176
3223
|
|
|
3224
|
+
.mobile-force-resize-btn {
|
|
3225
|
+
display: flex;
|
|
3226
|
+
min-width: 28px;
|
|
3227
|
+
min-height: 28px;
|
|
3228
|
+
padding: 4px 6px;
|
|
3229
|
+
font-size: 12px;
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3177
3232
|
.mobile-tabs-toggle {
|
|
3178
3233
|
min-height: 28px;
|
|
3179
3234
|
padding: 4px 6px;
|
|
@@ -3895,38 +3950,38 @@ body.dragging-tabs .tabs-container {
|
|
|
3895
3950
|
}
|
|
3896
3951
|
|
|
3897
3952
|
.terminal-container .xterm-viewport {
|
|
3898
|
-
overflow-y:
|
|
3953
|
+
overflow-y: hidden !important;
|
|
3899
3954
|
overflow-x: hidden !important;
|
|
3900
3955
|
overscroll-behavior: contain;
|
|
3901
|
-
-
|
|
3902
|
-
touch-action: pan-y;
|
|
3903
|
-
/* Fill available space */
|
|
3956
|
+
touch-action: none;
|
|
3904
3957
|
flex: 1;
|
|
3905
3958
|
min-height: 0;
|
|
3906
|
-
/* Override the height: 100% !important from general styles */
|
|
3907
3959
|
height: auto !important;
|
|
3908
|
-
|
|
3909
|
-
scrollbar-width: thin;
|
|
3910
|
-
scrollbar-color: var(--bg-hover) var(--bg-primary);
|
|
3960
|
+
scrollbar-width: none;
|
|
3911
3961
|
}
|
|
3912
3962
|
|
|
3913
|
-
/* Ensure scrollbars are visible on mobile */
|
|
3914
3963
|
.terminal-container .xterm-viewport::-webkit-scrollbar {
|
|
3915
|
-
width:
|
|
3916
|
-
height:
|
|
3964
|
+
width: 0;
|
|
3965
|
+
height: 0;
|
|
3917
3966
|
}
|
|
3918
3967
|
|
|
3919
|
-
.terminal-container .xterm-
|
|
3920
|
-
|
|
3968
|
+
.terminal-container .xterm-scrollable-element > .scrollbar {
|
|
3969
|
+
opacity: 1 !important;
|
|
3970
|
+
pointer-events: auto !important;
|
|
3971
|
+
transition: none !important;
|
|
3972
|
+
background-color: var(--terminal-scrollbar-track, #151b23) !important;
|
|
3921
3973
|
}
|
|
3922
3974
|
|
|
3923
|
-
.terminal-container .xterm-
|
|
3924
|
-
|
|
3925
|
-
|
|
3975
|
+
.terminal-container .xterm-scrollable-element > .scrollbar.invisible {
|
|
3976
|
+
opacity: 1 !important;
|
|
3977
|
+
pointer-events: auto !important;
|
|
3978
|
+
transition: none !important;
|
|
3979
|
+
background-color: var(--terminal-scrollbar-track, #151b23) !important;
|
|
3926
3980
|
}
|
|
3927
3981
|
|
|
3928
|
-
.terminal-container .xterm-
|
|
3929
|
-
|
|
3982
|
+
.terminal-container .xterm-scrollable-element > .scrollbar > .slider {
|
|
3983
|
+
min-height: 30px !important;
|
|
3984
|
+
background-color: var(--terminal-scrollbar-thumb, #3d444d) !important;
|
|
3930
3985
|
}
|
|
3931
3986
|
|
|
3932
3987
|
.terminal-container .xterm-screen {
|
|
@@ -4317,7 +4372,6 @@ body.dragging-tabs .tabs-container {
|
|
|
4317
4372
|
/* Enable native touch selection on mobile for terminal */
|
|
4318
4373
|
.terminal-container .xterm,
|
|
4319
4374
|
.terminal-container .xterm-screen,
|
|
4320
|
-
.terminal-container .xterm-viewport,
|
|
4321
4375
|
.terminal-container .xterm-rows,
|
|
4322
4376
|
.terminal-container .xterm-helpers {
|
|
4323
4377
|
-webkit-touch-callout: default !important;
|
|
@@ -4328,6 +4382,10 @@ body.dragging-tabs .tabs-container {
|
|
|
4328
4382
|
touch-action: manipulation !important;
|
|
4329
4383
|
}
|
|
4330
4384
|
|
|
4385
|
+
.terminal-container .xterm-viewport {
|
|
4386
|
+
touch-action: none !important;
|
|
4387
|
+
}
|
|
4388
|
+
|
|
4331
4389
|
/* Allow text selection in terminal on mobile */
|
|
4332
4390
|
.terminal-container {
|
|
4333
4391
|
-webkit-touch-callout: default !important;
|