@lethevimlet/sshift 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -5
- package/package.json +1 -1
- package/src/server/endpoints/rest/sessions.js +3 -0
- package/src/server/endpoints/rest/system.js +139 -17
- package/src/server/endpoints/ws/sftp.js +3 -1
- package/src/server/endpoints/ws/ssh.js +3 -2
- package/src/server/endpoints/ws/tabs.js +2 -0
- package/src/server/index.js +18 -3
- package/src/server/services/ssh-manager.js +22 -4
- package/src/webapp/css/style.css +146 -0
- package/src/webapp/index.html +144 -92
- package/src/webapp/js/app.js +386 -60
- package/src/webapp/js/mobile-terminal.js +166 -14
- package/src/webapp/sw.js +19 -2
- package/sshift +44 -2
- package/sshift-install.ps1 +1 -1
- package/sshift-install.sh +1 -1
package/README.md
CHANGED
|
@@ -24,24 +24,37 @@ A modern, responsive web-based SSH and SFTP terminal client built with Node.js,
|
|
|
24
24
|
|
|
25
25
|
- 🔐 **SSH Terminal** - Full xterm.js emulation with TUI support (vim, nano, htop, tmux)
|
|
26
26
|
- 📁 **SFTP Browser** - File manager interface with upload/download
|
|
27
|
+
- 🔗 **Persistent Sessions** - Background SSH sessions stay alive even while browsing
|
|
27
28
|
- 🤖 **AI Attention Alerts** - Tab flash notifications when AI tools (OpenCode, Claude) need your input
|
|
28
29
|
- 🗂️ **Tabbed Interface** - Multiple concurrent sessions
|
|
29
30
|
- 🔖 **Bookmarks** - Save connection details for quick access
|
|
30
31
|
- 🔒 **Password Protection** - Optional password lock for app access
|
|
31
32
|
- ⌨️ **Mobile-Friendly** - Special keys popup for mobile devices
|
|
32
|
-
- 🎨 **Modern UI** -
|
|
33
|
+
- 🎨 **Modern UI** - Configurable light/dark themes, accent colors, terminal color schemes, fully responsive
|
|
33
34
|
|
|
34
35
|
## 🚀 Quick Start
|
|
35
36
|
|
|
37
|
+
**Linux/macOS:**
|
|
36
38
|
```bash
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
curl -fsSL https://raw.githubusercontent.com/lethevimlet/sshift/main/sshift-install.sh | bash
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Windows (PowerShell):**
|
|
43
|
+
```powershell
|
|
44
|
+
Set-ExecutionPolicy Bypass -Scope Process
|
|
45
|
+
Invoke-Expression (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/lethevimlet/sshift/main/sshift-install.ps1" -UseBasicParsing).Content
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The installer handles Node.js, npm, autostart, and HTTPS config automatically. The application will be available at `https://localhost:8022`
|
|
39
49
|
|
|
40
|
-
|
|
50
|
+
Alternatively, install globally via npm:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install -g @lethevimlet/sshift
|
|
41
54
|
sshift
|
|
42
55
|
```
|
|
43
56
|
|
|
44
|
-
|
|
57
|
+
> **Note:** When installing via npm, you'll need to configure autostart yourself (e.g., systemd, launchd, or Task Scheduler).
|
|
45
58
|
|
|
46
59
|
## 📖 Documentation
|
|
47
60
|
|
package/package.json
CHANGED
|
@@ -76,6 +76,7 @@ function registerSessionsEndpoints(app, io) {
|
|
|
76
76
|
|
|
77
77
|
// Broadcast to all clients that the session was closed
|
|
78
78
|
io.emit('tab-closed', { sessionId });
|
|
79
|
+
io.emit('sessions-updated');
|
|
79
80
|
|
|
80
81
|
res.json({ success: true, sessionId });
|
|
81
82
|
});
|
|
@@ -106,6 +107,8 @@ function registerSessionsEndpoints(app, io) {
|
|
|
106
107
|
removeTab(sessionId);
|
|
107
108
|
}
|
|
108
109
|
|
|
110
|
+
io.emit('sessions-updated');
|
|
111
|
+
|
|
109
112
|
res.json({ success: true, closedCount: closedSessions.length });
|
|
110
113
|
});
|
|
111
114
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const path = require('path');
|
|
7
|
-
const { getDataDir } = require('../../utils/config');
|
|
7
|
+
const { getDataDir, getCertPath, getKeyPath, getConfigPath } = require('../../utils/config');
|
|
8
8
|
|
|
9
9
|
const SSL_CERT_FILE = 'ssl-cert.pem';
|
|
10
10
|
const SSL_KEY_FILE = 'ssl-key.pem';
|
|
@@ -21,6 +21,7 @@ function registerSystemEndpoints(app, io) {
|
|
|
21
21
|
const staleUpdateMarker = path.join(dataDir, UPDATE_MARKER_FILE);
|
|
22
22
|
const staleUpdateScript = path.join(dataDir, '.sshift-update.sh');
|
|
23
23
|
const stalePsScript = path.join(dataDir, '.sshift-update.ps1');
|
|
24
|
+
const staleUpdateLog = path.join(dataDir, '.sshift-update.log');
|
|
24
25
|
try {
|
|
25
26
|
if (fs.existsSync(staleUpdateMarker)) {
|
|
26
27
|
fs.unlinkSync(staleUpdateMarker);
|
|
@@ -32,6 +33,11 @@ function registerSystemEndpoints(app, io) {
|
|
|
32
33
|
if (fs.existsSync(stalePsScript)) {
|
|
33
34
|
fs.unlinkSync(stalePsScript);
|
|
34
35
|
}
|
|
36
|
+
if (fs.existsSync(staleUpdateLog)) {
|
|
37
|
+
const logContent = fs.readFileSync(staleUpdateLog, 'utf8');
|
|
38
|
+
console.log('[UPDATE] Previous update log:\n' + logContent);
|
|
39
|
+
fs.unlinkSync(staleUpdateLog);
|
|
40
|
+
}
|
|
35
41
|
} catch (e) {
|
|
36
42
|
console.error('[UPDATE] Failed to clean up marker file:', e.message);
|
|
37
43
|
}
|
|
@@ -133,6 +139,7 @@ function registerSystemEndpoints(app, io) {
|
|
|
133
139
|
app.get('/api/update-status', (req, res) => {
|
|
134
140
|
const dataDir = getDataDir();
|
|
135
141
|
const updateMarker = path.join(dataDir, UPDATE_MARKER_FILE);
|
|
142
|
+
const updateLogPath = path.join(dataDir, '.sshift-update.log');
|
|
136
143
|
|
|
137
144
|
// Read package.json for current version
|
|
138
145
|
let version = 'unknown';
|
|
@@ -146,11 +153,25 @@ function registerSystemEndpoints(app, io) {
|
|
|
146
153
|
|
|
147
154
|
// Check if we're in the middle of an update
|
|
148
155
|
const isUpdating = fs.existsSync(updateMarker);
|
|
156
|
+
|
|
157
|
+
// Check for update error log
|
|
158
|
+
let updateError = null;
|
|
159
|
+
if (!isUpdating && fs.existsSync(updateLogPath)) {
|
|
160
|
+
try {
|
|
161
|
+
const logContent = fs.readFileSync(updateLogPath, 'utf8');
|
|
162
|
+
if (logContent.includes('npm install failed')) {
|
|
163
|
+
updateError = 'Update failed: npm install exited with an error.';
|
|
164
|
+
}
|
|
165
|
+
} catch (e) {
|
|
166
|
+
// Ignore log read errors
|
|
167
|
+
}
|
|
168
|
+
}
|
|
149
169
|
|
|
150
170
|
res.json({
|
|
151
171
|
version,
|
|
152
172
|
updating: isUpdating,
|
|
153
|
-
ready: !isUpdating
|
|
173
|
+
ready: !isUpdating,
|
|
174
|
+
updateError
|
|
154
175
|
});
|
|
155
176
|
});
|
|
156
177
|
|
|
@@ -171,32 +192,54 @@ function registerSystemEndpoints(app, io) {
|
|
|
171
192
|
// API: Get security context info
|
|
172
193
|
app.get('/api/security-info', (req, res) => {
|
|
173
194
|
const dataDir = getDataDir();
|
|
174
|
-
const
|
|
175
|
-
const hasCert = fs.existsSync(
|
|
195
|
+
const selfSignedCertPath = path.join(dataDir, SSL_CERT_FILE);
|
|
196
|
+
const hasCert = fs.existsSync(selfSignedCertPath);
|
|
176
197
|
const protocol = req.protocol;
|
|
177
198
|
const isSecure = req.secure || protocol === 'https';
|
|
178
199
|
const isLocalhost = req.hostname === 'localhost' || req.hostname === '127.0.0.1' || req.hostname === '::1';
|
|
200
|
+
const usesCustomCert = !!(getCertPath() && getKeyPath());
|
|
179
201
|
|
|
180
202
|
res.json({
|
|
181
203
|
isSecure,
|
|
182
204
|
isLocalhost,
|
|
183
205
|
protocol,
|
|
184
206
|
certAvailable: hasCert,
|
|
207
|
+
usesCustomCert,
|
|
185
208
|
hostname: req.hostname
|
|
186
209
|
});
|
|
187
210
|
});
|
|
188
211
|
|
|
212
|
+
// API: Debug info (paths and config)
|
|
213
|
+
app.get('/api/debug-info', (req, res) => {
|
|
214
|
+
const dataDir = getDataDir();
|
|
215
|
+
const selfSignedCertPath = path.join(dataDir, SSL_CERT_FILE);
|
|
216
|
+
const selfSignedKeyPath = path.join(dataDir, SSL_KEY_FILE);
|
|
217
|
+
const customCertPath = getCertPath();
|
|
218
|
+
const customKeyPath = getKeyPath();
|
|
219
|
+
const usesCustomCert = !!(customCertPath && customKeyPath);
|
|
220
|
+
|
|
221
|
+
res.json({
|
|
222
|
+
configPath: getConfigPath(),
|
|
223
|
+
dataDir,
|
|
224
|
+
certPath: usesCustomCert ? customCertPath : selfSignedCertPath,
|
|
225
|
+
keyPath: usesCustomCert ? customKeyPath : selfSignedKeyPath,
|
|
226
|
+
usesCustomCert
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
|
|
189
230
|
// API: Trigger update
|
|
190
231
|
app.post('/api/update', async (req, res) => {
|
|
191
232
|
try {
|
|
192
|
-
const { spawn } = require('child_process');
|
|
233
|
+
const { spawn, execSync } = require('child_process');
|
|
193
234
|
const platform = process.platform;
|
|
194
235
|
const dataDir = getDataDir();
|
|
195
236
|
|
|
196
237
|
// Write update marker to indicate update in progress
|
|
197
238
|
const updateMarker = path.join(dataDir, UPDATE_MARKER_FILE);
|
|
239
|
+
let oldVersion = 'unknown';
|
|
198
240
|
try {
|
|
199
241
|
const pkg = require('../../../../package.json');
|
|
242
|
+
oldVersion = pkg.version;
|
|
200
243
|
fs.mkdirSync(dataDir, { recursive: true });
|
|
201
244
|
fs.writeFileSync(updateMarker, JSON.stringify({
|
|
202
245
|
startTime: Date.now(),
|
|
@@ -205,28 +248,105 @@ function registerSystemEndpoints(app, io) {
|
|
|
205
248
|
} catch (e) {
|
|
206
249
|
console.error('[UPDATE] Failed to write update marker:', e.message);
|
|
207
250
|
}
|
|
208
|
-
|
|
209
|
-
//
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
251
|
+
|
|
252
|
+
// Resolve the npm and sshift binary paths
|
|
253
|
+
let npmBinPath;
|
|
254
|
+
let sshiftBinPath;
|
|
255
|
+
try {
|
|
256
|
+
npmBinPath = execSync('command -v npm || which npm', { encoding: 'utf8' }).trim();
|
|
257
|
+
} catch (e) {
|
|
258
|
+
// Fallback: try common locations
|
|
259
|
+
const nodeDir = path.dirname(process.execPath);
|
|
260
|
+
npmBinPath = path.join(nodeDir, 'npm');
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
try {
|
|
264
|
+
sshiftBinPath = execSync('command -v sshift || which sshift', { encoding: 'utf8' }).trim();
|
|
265
|
+
} catch (e) {
|
|
266
|
+
sshiftBinPath = null;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// If sshift isn't in PATH, try to resolve it relative to npm's global bin dir
|
|
270
|
+
if (!sshiftBinPath) {
|
|
271
|
+
try {
|
|
272
|
+
const npmGlobalBinDir = execSync('npm bin -g', { encoding: 'utf8' }).trim();
|
|
273
|
+
sshiftBinPath = path.join(npmGlobalBinDir, 'sshift');
|
|
274
|
+
} catch (e) {
|
|
275
|
+
sshiftBinPath = null;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Fallback: derive from process.argv[1] if available
|
|
280
|
+
if (!sshiftBinPath && process.argv[1]) {
|
|
281
|
+
sshiftBinPath = process.argv[1];
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (!sshiftBinPath) {
|
|
285
|
+
console.error('[UPDATE] Cannot determine sshift binary path for restart');
|
|
286
|
+
try { fs.unlinkSync(updateMarker); } catch (e) { /* ignore */ }
|
|
287
|
+
return res.status(500).json({ error: 'Cannot determine sshift binary path for restart' });
|
|
288
|
+
}
|
|
289
|
+
|
|
213
290
|
const nodeExe = process.execPath;
|
|
214
|
-
const sshiftScript = process.argv[1];
|
|
215
291
|
const updateScriptPath = path.join(dataDir, '.sshift-update.sh');
|
|
292
|
+
const updateLogPath = path.join(dataDir, '.sshift-update.log');
|
|
293
|
+
|
|
294
|
+
// Send response immediately, then update in background
|
|
295
|
+
res.json({ message: 'Update started. Server will restart automatically.' });
|
|
216
296
|
|
|
217
297
|
if (platform === 'win32') {
|
|
218
|
-
const
|
|
219
|
-
|
|
298
|
+
const sshiftCmd = sshiftBinPath.includes(' ') ? `& '${sshiftBinPath}'` : `sshift`;
|
|
299
|
+
const psScript = `$ErrorActionPreference = 'Continue'
|
|
300
|
+
try {
|
|
301
|
+
& npm install -g @lethevimlet/sshift@latest 2>&1 | Out-File -FilePath '${updateLogPath}' -Append
|
|
302
|
+
if ($LASTEXITCODE -ne 0) {
|
|
303
|
+
Write-Output 'npm install failed with exit code ' + $LASTEXITCODE | Out-File -FilePath '${updateLogPath}' -Append
|
|
304
|
+
exit 1
|
|
305
|
+
}
|
|
306
|
+
} catch {
|
|
307
|
+
Write-Output $_.Exception.Message | Out-File -FilePath '${updateLogPath}' -Append
|
|
308
|
+
exit 1
|
|
309
|
+
}
|
|
310
|
+
Remove-Item -Path '${updateMarker}' -Force -ErrorAction SilentlyContinue
|
|
311
|
+
& '${nodeExe}' '${sshiftBinPath}'
|
|
312
|
+
`;
|
|
313
|
+
const psScriptPath = updateScriptPath.replace('.sh', '.ps1');
|
|
314
|
+
fs.writeFileSync(psScriptPath, psScript, 'utf8');
|
|
220
315
|
} else {
|
|
221
316
|
const updateScript = `#!/bin/sh
|
|
222
|
-
|
|
223
|
-
|
|
317
|
+
set -e
|
|
318
|
+
LOG="${updateLogPath}"
|
|
319
|
+
echo "$(date): Starting sshift update..." > "$LOG"
|
|
320
|
+
|
|
321
|
+
# Try npm install
|
|
322
|
+
NPM_BIN="${npmBinPath}"
|
|
323
|
+
echo "$(date): Using npm at: $NPM_BIN" >> "$LOG"
|
|
324
|
+
|
|
325
|
+
if ! "$NPM_BIN" install -g @lethevimlet/sshift@latest >> "$LOG" 2>&1; then
|
|
326
|
+
echo "$(date): npm install failed, removing update marker" >> "$LOG"
|
|
327
|
+
rm -f "${updateMarker}"
|
|
328
|
+
exit 1
|
|
329
|
+
fi
|
|
330
|
+
|
|
331
|
+
echo "$(date): npm install completed successfully" >> "$LOG"
|
|
332
|
+
|
|
333
|
+
# Remove the update marker before restart so the new instance sees a clean state
|
|
334
|
+
rm -f "${updateMarker}"
|
|
335
|
+
|
|
336
|
+
# Find the sshift binary — prefer PATH lookup since npm just updated it
|
|
337
|
+
SSHIFT_BIN="$(command -v sshift 2>/dev/null || which sshift 2>/dev/null || echo "${sshiftBinPath}")"
|
|
338
|
+
|
|
339
|
+
echo "$(date): Restarting sshift from: $SSHIFT_BIN" >> "$LOG"
|
|
340
|
+
exec "${nodeExe}" "$SSHIFT_BIN"
|
|
224
341
|
`;
|
|
225
342
|
fs.writeFileSync(updateScriptPath, updateScript, 'utf8');
|
|
226
343
|
fs.chmodSync(updateScriptPath, 0o755);
|
|
227
344
|
}
|
|
228
345
|
|
|
229
346
|
console.log('[UPDATE] Starting update process...');
|
|
347
|
+
console.log('[UPDATE] npm path:', npmBinPath);
|
|
348
|
+
console.log('[UPDATE] sshift restart path:', sshiftBinPath);
|
|
349
|
+
console.log('[UPDATE] Log file:', updateLogPath);
|
|
230
350
|
|
|
231
351
|
let spawnFailed = false;
|
|
232
352
|
let spawnCommand, spawnArgs;
|
|
@@ -248,12 +368,14 @@ exec "${nodeExe}" "${sshiftScript}"
|
|
|
248
368
|
updateProcess.on('error', (err) => {
|
|
249
369
|
console.error('[UPDATE] Failed to start update process:', err.message);
|
|
250
370
|
spawnFailed = true;
|
|
251
|
-
// Clean up marker since update failed
|
|
252
371
|
try { fs.unlinkSync(updateMarker); } catch (e) { /* ignore */ }
|
|
253
372
|
});
|
|
254
373
|
|
|
255
374
|
updateProcess.unref();
|
|
256
375
|
|
|
376
|
+
// Give the update script enough time to start before exiting.
|
|
377
|
+
// The script runs npm install (which can take time) in the background,
|
|
378
|
+
// but we need to wait long enough for the spawn to succeed.
|
|
257
379
|
setTimeout(() => {
|
|
258
380
|
if (spawnFailed) {
|
|
259
381
|
console.error('[UPDATE] Update process failed to start. Keeping server running.');
|
|
@@ -261,7 +383,7 @@ exec "${nodeExe}" "${sshiftScript}"
|
|
|
261
383
|
}
|
|
262
384
|
console.log('[UPDATE] Exiting for update...');
|
|
263
385
|
process.exit(0);
|
|
264
|
-
},
|
|
386
|
+
}, 2000);
|
|
265
387
|
} catch (err) {
|
|
266
388
|
console.error('Error triggering update:', err);
|
|
267
389
|
res.status(500).json({ error: 'Failed to trigger update' });
|
|
@@ -44,7 +44,6 @@ function registerSFTPHandlers(socket, io) {
|
|
|
44
44
|
sticky: sticky
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
// Broadcast to all clients that a new tab was opened
|
|
48
47
|
io.emit('tab-opened', {
|
|
49
48
|
sessionId,
|
|
50
49
|
name: data.name || 'SFTP',
|
|
@@ -52,6 +51,8 @@ function registerSFTPHandlers(socket, io) {
|
|
|
52
51
|
connectionData: data
|
|
53
52
|
});
|
|
54
53
|
|
|
54
|
+
io.emit('sessions-updated');
|
|
55
|
+
|
|
55
56
|
socket.emit('sftp-connected', { sessionId });
|
|
56
57
|
} catch (err) {
|
|
57
58
|
console.error('[SFTP] Error in sftp-connect:', err.message);
|
|
@@ -135,6 +136,7 @@ function registerSFTPHandlers(socket, io) {
|
|
|
135
136
|
|
|
136
137
|
// Broadcast to all clients that tab was closed
|
|
137
138
|
io.emit('tab-closed', { sessionId: data.sessionId });
|
|
139
|
+
io.emit('sessions-updated');
|
|
138
140
|
});
|
|
139
141
|
}
|
|
140
142
|
|
|
@@ -51,7 +51,6 @@ function registerSSHHandlers(socket, io) {
|
|
|
51
51
|
sticky: sticky
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
// Broadcast to all clients that a new tab was opened
|
|
55
54
|
io.emit('tab-opened', {
|
|
56
55
|
sessionId,
|
|
57
56
|
name: data.name || 'SSH',
|
|
@@ -59,6 +58,8 @@ function registerSSHHandlers(socket, io) {
|
|
|
59
58
|
connectionData: data
|
|
60
59
|
});
|
|
61
60
|
|
|
61
|
+
io.emit('sessions-updated');
|
|
62
|
+
|
|
62
63
|
socket.emit('ssh-connected', { sessionId });
|
|
63
64
|
} catch (err) {
|
|
64
65
|
console.error('[SSH] Connection failed:', err.message);
|
|
@@ -160,8 +161,8 @@ function registerSSHHandlers(socket, io) {
|
|
|
160
161
|
// Remove from open tabs and order
|
|
161
162
|
removeTab(data.sessionId);
|
|
162
163
|
|
|
163
|
-
// Broadcast to all clients that tab was closed
|
|
164
164
|
io.emit('tab-closed', { sessionId: data.sessionId });
|
|
165
|
+
io.emit('sessions-updated');
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
168
|
|
|
@@ -55,10 +55,12 @@ function registerTabHandlers(socket, io) {
|
|
|
55
55
|
|
|
56
56
|
// Broadcast to all clients that tab was closed
|
|
57
57
|
io.emit('tab-closed', { sessionId: data.sessionId });
|
|
58
|
+
io.emit('sessions-updated');
|
|
58
59
|
}
|
|
59
60
|
} else {
|
|
60
61
|
// Broadcast to all clients that tab was closed
|
|
61
62
|
io.emit('tab-closed', { sessionId: data.sessionId });
|
|
63
|
+
io.emit('sessions-updated');
|
|
62
64
|
}
|
|
63
65
|
});
|
|
64
66
|
|
package/src/server/index.js
CHANGED
|
@@ -304,16 +304,31 @@ async function initializeServer() {
|
|
|
304
304
|
app.use('/tests', express.static(path.join(webappPath, 'tests')));
|
|
305
305
|
|
|
306
306
|
// Service Worker script - must be served from root with proper headers
|
|
307
|
+
// Version placeholder is replaced dynamically so the cache busts on each update
|
|
307
308
|
app.get('/sw.js', (req, res) => {
|
|
308
309
|
res.setHeader('Content-Type', 'application/javascript');
|
|
309
310
|
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
|
|
310
311
|
res.setHeader('Service-Worker-Allowed', '/');
|
|
311
|
-
|
|
312
|
+
const swPath = path.join(webappPath, 'sw.js');
|
|
313
|
+
fs.readFile(swPath, 'utf8', (err, data) => {
|
|
314
|
+
if (err) return res.status(500).send('/* SW load error */');
|
|
315
|
+
const version = require(path.join(__dirname, '../../package.json')).version;
|
|
316
|
+
res.send(data.replace(/__VERSION__/g, version));
|
|
317
|
+
});
|
|
312
318
|
});
|
|
313
319
|
|
|
314
|
-
// Main route
|
|
320
|
+
// Main route - no-cache so browser always checks for updates
|
|
321
|
+
// Version placeholder is replaced dynamically for cache-busting
|
|
315
322
|
app.get('/', (req, res) => {
|
|
316
|
-
res.
|
|
323
|
+
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
|
|
324
|
+
res.setHeader('Pragma', 'no-cache');
|
|
325
|
+
res.setHeader('Expires', '0');
|
|
326
|
+
const htmlPath = path.join(webappPath, 'index.html');
|
|
327
|
+
fs.readFile(htmlPath, 'utf8', (err, data) => {
|
|
328
|
+
if (err) return res.status(500).send('Error loading page');
|
|
329
|
+
const version = require(path.join(__dirname, '../../package.json')).version;
|
|
330
|
+
res.send(data.replace(/__VERSION__/g, version));
|
|
331
|
+
});
|
|
317
332
|
});
|
|
318
333
|
|
|
319
334
|
// Register REST endpoints
|
|
@@ -166,10 +166,10 @@ class SSHManager {
|
|
|
166
166
|
|
|
167
167
|
stream.on('close', () => {
|
|
168
168
|
console.log(`[SSH] Stream closed: ${sessionId}`);
|
|
169
|
-
// Flush any remaining buffered data before disconnect
|
|
170
169
|
this.flushData(sessionId);
|
|
171
170
|
this.broadcastToSession(sessionId, 'ssh-disconnected', { sessionId });
|
|
172
171
|
this.disconnect(sessionId);
|
|
172
|
+
if (this.io) this.io.emit('sessions-updated');
|
|
173
173
|
});
|
|
174
174
|
|
|
175
175
|
stream.on('exit', (code, signal) => {
|
|
@@ -190,6 +190,7 @@ class SSHManager {
|
|
|
190
190
|
console.error(`[SSH] Connection error: ${err.message}`);
|
|
191
191
|
socket.emit('ssh-error', { sessionId, message: err.message });
|
|
192
192
|
this.sessions.delete(sessionId);
|
|
193
|
+
if (this.io) this.io.emit('sessions-updated');
|
|
193
194
|
reject(err);
|
|
194
195
|
});
|
|
195
196
|
|
|
@@ -197,6 +198,7 @@ class SSHManager {
|
|
|
197
198
|
console.log(`[SSH] Connection closed: ${sessionId}`);
|
|
198
199
|
this.broadcastToSession(sessionId, 'ssh-disconnected', { sessionId });
|
|
199
200
|
this.sessions.delete(sessionId);
|
|
201
|
+
if (this.io) this.io.emit('sessions-updated');
|
|
200
202
|
});
|
|
201
203
|
|
|
202
204
|
try {
|
|
@@ -357,11 +359,15 @@ class SSHManager {
|
|
|
357
359
|
socket.emit('ssh-joined', {
|
|
358
360
|
sessionId: sessionId,
|
|
359
361
|
noTerminalState: !hasTerminalState,
|
|
360
|
-
controllerSocket: session.controllerSocket,
|
|
361
|
-
isController: session.controllerSocket === socket.id,
|
|
362
|
-
socketCount: session.sockets.size
|
|
362
|
+
controllerSocket: session.controllerSocket,
|
|
363
|
+
isController: session.controllerSocket === socket.id,
|
|
364
|
+
socketCount: session.sockets.size
|
|
363
365
|
});
|
|
364
366
|
|
|
367
|
+
if (this.io) {
|
|
368
|
+
this.io.emit('sessions-updated');
|
|
369
|
+
}
|
|
370
|
+
|
|
365
371
|
return true;
|
|
366
372
|
}
|
|
367
373
|
|
|
@@ -398,6 +404,10 @@ class SSHManager {
|
|
|
398
404
|
session.controllerSocket = null;
|
|
399
405
|
}
|
|
400
406
|
}
|
|
407
|
+
|
|
408
|
+
if (this.io) {
|
|
409
|
+
this.io.emit('sessions-updated');
|
|
410
|
+
}
|
|
401
411
|
}
|
|
402
412
|
|
|
403
413
|
// Take control of a session
|
|
@@ -430,6 +440,10 @@ class SSHManager {
|
|
|
430
440
|
});
|
|
431
441
|
}
|
|
432
442
|
|
|
443
|
+
if (this.io) {
|
|
444
|
+
this.io.emit('sessions-updated');
|
|
445
|
+
}
|
|
446
|
+
|
|
433
447
|
return {
|
|
434
448
|
success: true,
|
|
435
449
|
cols: session.cols,
|
|
@@ -465,6 +479,10 @@ class SSHManager {
|
|
|
465
479
|
session.controllerSocket = null;
|
|
466
480
|
}
|
|
467
481
|
|
|
482
|
+
if (this.io) {
|
|
483
|
+
this.io.emit('sessions-updated');
|
|
484
|
+
}
|
|
485
|
+
|
|
468
486
|
return { success: true };
|
|
469
487
|
}
|
|
470
488
|
|
package/src/webapp/css/style.css
CHANGED
|
@@ -3482,6 +3482,120 @@ body.dragging-tabs .tabs-container {
|
|
|
3482
3482
|
pointer-events: none;
|
|
3483
3483
|
}
|
|
3484
3484
|
|
|
3485
|
+
/* Security Info Modal - Service Worker Status */
|
|
3486
|
+
.sw-status-card {
|
|
3487
|
+
flex-direction: column !important;
|
|
3488
|
+
align-items: center !important;
|
|
3489
|
+
text-align: center;
|
|
3490
|
+
padding: 24px 16px;
|
|
3491
|
+
}
|
|
3492
|
+
|
|
3493
|
+
.sw-status-icon {
|
|
3494
|
+
font-size: 48px;
|
|
3495
|
+
margin-bottom: 12px;
|
|
3496
|
+
line-height: 1;
|
|
3497
|
+
}
|
|
3498
|
+
|
|
3499
|
+
.sw-status-active .sw-status-icon {
|
|
3500
|
+
color: var(--accent-success);
|
|
3501
|
+
}
|
|
3502
|
+
|
|
3503
|
+
.sw-status-failed .sw-status-icon {
|
|
3504
|
+
color: var(--accent-danger);
|
|
3505
|
+
}
|
|
3506
|
+
|
|
3507
|
+
.sw-status-unsupported .sw-status-icon {
|
|
3508
|
+
color: var(--accent-warning);
|
|
3509
|
+
}
|
|
3510
|
+
|
|
3511
|
+
.sw-status-title {
|
|
3512
|
+
font-size: 18px;
|
|
3513
|
+
font-weight: 700;
|
|
3514
|
+
color: var(--text-primary);
|
|
3515
|
+
margin-bottom: 4px;
|
|
3516
|
+
}
|
|
3517
|
+
|
|
3518
|
+
.sw-status-active .sw-status-title {
|
|
3519
|
+
color: var(--accent-success);
|
|
3520
|
+
}
|
|
3521
|
+
|
|
3522
|
+
.sw-status-failed .sw-status-title {
|
|
3523
|
+
color: var(--accent-danger);
|
|
3524
|
+
}
|
|
3525
|
+
|
|
3526
|
+
.sw-status-unsupported .sw-status-title {
|
|
3527
|
+
color: var(--accent-warning);
|
|
3528
|
+
}
|
|
3529
|
+
|
|
3530
|
+
.sw-status-detail {
|
|
3531
|
+
max-width: 400px;
|
|
3532
|
+
}
|
|
3533
|
+
|
|
3534
|
+
.sw-feature-list {
|
|
3535
|
+
list-style: none;
|
|
3536
|
+
padding: 0;
|
|
3537
|
+
margin: 8px 0 0;
|
|
3538
|
+
text-align: left;
|
|
3539
|
+
display: inline-block;
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3542
|
+
.sw-feature-list li {
|
|
3543
|
+
padding: 3px 0;
|
|
3544
|
+
font-size: 13px;
|
|
3545
|
+
display: flex;
|
|
3546
|
+
align-items: center;
|
|
3547
|
+
gap: 8px;
|
|
3548
|
+
}
|
|
3549
|
+
|
|
3550
|
+
.sw-feature-list li i {
|
|
3551
|
+
width: 16px;
|
|
3552
|
+
text-align: center;
|
|
3553
|
+
}
|
|
3554
|
+
|
|
3555
|
+
.sw-status-active .sw-feature-list li i {
|
|
3556
|
+
color: var(--accent-success);
|
|
3557
|
+
}
|
|
3558
|
+
|
|
3559
|
+
.sw-status-failed .sw-feature-list li i,
|
|
3560
|
+
.sw-status-unsupported .sw-feature-list li i {
|
|
3561
|
+
color: var(--accent-danger);
|
|
3562
|
+
}
|
|
3563
|
+
|
|
3564
|
+
.sw-hint {
|
|
3565
|
+
margin: 8px 0 0;
|
|
3566
|
+
font-size: 12px;
|
|
3567
|
+
color: var(--text-secondary);
|
|
3568
|
+
font-style: italic;
|
|
3569
|
+
}
|
|
3570
|
+
|
|
3571
|
+
.sw-install-link {
|
|
3572
|
+
color: var(--accent-primary);
|
|
3573
|
+
text-decoration: underline !important;
|
|
3574
|
+
}
|
|
3575
|
+
|
|
3576
|
+
.sw-install-link:hover {
|
|
3577
|
+
color: var(--accent-secondary);
|
|
3578
|
+
text-decoration: underline !important;
|
|
3579
|
+
}
|
|
3580
|
+
|
|
3581
|
+
.sw-custom-cert-warning {
|
|
3582
|
+
display: flex;
|
|
3583
|
+
align-items: flex-start;
|
|
3584
|
+
gap: 8px;
|
|
3585
|
+
padding: 10px 12px;
|
|
3586
|
+
background: var(--bg-tertiary, rgba(255, 152, 0, 0.1));
|
|
3587
|
+
border: 1px solid var(--accent-warning, #d29922);
|
|
3588
|
+
border-radius: 6px;
|
|
3589
|
+
font-size: 13px;
|
|
3590
|
+
color: var(--accent-warning, #d29922);
|
|
3591
|
+
line-height: 1.4;
|
|
3592
|
+
}
|
|
3593
|
+
|
|
3594
|
+
.sw-custom-cert-warning i {
|
|
3595
|
+
margin-top: 2px;
|
|
3596
|
+
flex-shrink: 0;
|
|
3597
|
+
}
|
|
3598
|
+
|
|
3485
3599
|
/* Settings Modal Styles */
|
|
3486
3600
|
.setting-group {
|
|
3487
3601
|
margin-bottom: 20px;
|
|
@@ -3544,6 +3658,37 @@ body.dragging-tabs .tabs-container {
|
|
|
3544
3658
|
opacity: 1;
|
|
3545
3659
|
}
|
|
3546
3660
|
|
|
3661
|
+
.debug-info-list {
|
|
3662
|
+
display: flex;
|
|
3663
|
+
flex-direction: column;
|
|
3664
|
+
gap: 12px;
|
|
3665
|
+
}
|
|
3666
|
+
|
|
3667
|
+
.debug-info-item {
|
|
3668
|
+
display: flex;
|
|
3669
|
+
flex-direction: column;
|
|
3670
|
+
gap: 4px;
|
|
3671
|
+
}
|
|
3672
|
+
|
|
3673
|
+
.debug-info-label {
|
|
3674
|
+
font-size: 12px;
|
|
3675
|
+
font-weight: 600;
|
|
3676
|
+
color: var(--text-secondary);
|
|
3677
|
+
text-transform: uppercase;
|
|
3678
|
+
letter-spacing: 0.5px;
|
|
3679
|
+
}
|
|
3680
|
+
|
|
3681
|
+
.debug-info-value {
|
|
3682
|
+
font-size: 13px;
|
|
3683
|
+
color: var(--text-primary);
|
|
3684
|
+
font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
|
|
3685
|
+
background: var(--bg-tertiary);
|
|
3686
|
+
padding: 6px 10px;
|
|
3687
|
+
border-radius: 6px;
|
|
3688
|
+
word-break: break-all;
|
|
3689
|
+
border: 1px solid var(--border-color);
|
|
3690
|
+
}
|
|
3691
|
+
|
|
3547
3692
|
.toggle-switch {
|
|
3548
3693
|
position: relative;
|
|
3549
3694
|
display: inline-block;
|
|
@@ -4564,6 +4709,7 @@ body.dragging-tabs .tabs-container {
|
|
|
4564
4709
|
bottom: 0;
|
|
4565
4710
|
pointer-events: none;
|
|
4566
4711
|
z-index: 10;
|
|
4712
|
+
overflow: hidden;
|
|
4567
4713
|
}
|
|
4568
4714
|
|
|
4569
4715
|
.mobile-selection-rect {
|