@lethevimlet/sshift 0.9.2 → 0.9.4
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 +6 -8
- package/package.json +1 -1
- package/src/server/endpoints/rest/index.js +3 -0
- package/src/server/endpoints/rest/plugins.js +91 -0
- package/src/server/endpoints/rest/system.js +2 -2
- package/src/server/plugins/plugin-manager.js +75 -0
- package/src/server/utils/config.js +5 -12
- package/src/server/utils/env-loader.js +6 -17
- package/src/webapp/css/style.css +67 -0
- package/src/webapp/index.html +8 -0
- package/src/webapp/js/app.js +108 -30
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
1
3
|
# SSHIFT - Web-based SSH/SFTP Terminal Client for the AI Stack
|
|
2
4
|
|
|
3
5
|
[](https://lethevimlet.github.io/sshift/)
|
|
@@ -7,8 +9,6 @@
|
|
|
7
9
|
|
|
8
10
|
A modern, responsive web-based SSH and SFTP terminal client built with Node.js, Express, and xterm.js. Designed for the AI coding workflow — featuring tab flash notifications that alert you when AI tools like OpenCode or Claude are waiting for your input, so you never miss a prompt while multitasking. Also features excellent TUI support, tabbed sessions, bookmarks, and mobile-friendly design.
|
|
9
11
|
|
|
10
|
-

|
|
11
|
-
|
|
12
12
|
## 📸 Screenshots
|
|
13
13
|
|
|
14
14
|
<div align="center">
|
|
@@ -119,12 +119,10 @@ SSHIFT uses a priority-based configuration system. Config files are searched in
|
|
|
119
119
|
|
|
120
120
|
| Priority | Path | Notes |
|
|
121
121
|
|----------|------|-------|
|
|
122
|
-
| 1 |
|
|
123
|
-
| 2 |
|
|
124
|
-
| 3 | `~/.local/share/sshift/config.json` | User install
|
|
125
|
-
| 4 | `~/.local/share/
|
|
126
|
-
| 5 | `<PACKAGE_DIR>/.env/config.json` | NPM package directory |
|
|
127
|
-
| 6 | `<PACKAGE_DIR>/config.json` | NPM package root (fallback) |
|
|
122
|
+
| 1 | `<PACKAGE_DIR>/.env/config.json` | NPM package directory |
|
|
123
|
+
| 2 | `<PACKAGE_DIR>/config.json` | NPM package root (fallback) |
|
|
124
|
+
| 3 | `~/.local/share/sshift/.env/config.json` | User install location |
|
|
125
|
+
| 4 | `~/.local/share/sshift/config.json` | User install (no `.env` subdir) |
|
|
128
126
|
|
|
129
127
|
### Port Priority
|
|
130
128
|
|
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
const { registerBookmarkEndpoints } = require('./bookmarks');
|
|
7
7
|
const { registerConfigEndpoints } = require('./config');
|
|
8
8
|
const { registerFolderEndpoints } = require('./folders');
|
|
9
|
+
const { registerPluginEndpoints } = require('./plugins');
|
|
9
10
|
const { registerSessionsEndpoints } = require('./sessions');
|
|
10
11
|
const { registerSystemEndpoints } = require('./system');
|
|
11
12
|
const { registerUtilsEndpoints } = require('./utils');
|
|
@@ -16,6 +17,7 @@ function registerAllRestEndpoints(app, io) {
|
|
|
16
17
|
registerBookmarkEndpoints(app, io);
|
|
17
18
|
registerConfigEndpoints(app, io);
|
|
18
19
|
registerFolderEndpoints(app, io);
|
|
20
|
+
registerPluginEndpoints(app, io);
|
|
19
21
|
registerSessionsEndpoints(app, io);
|
|
20
22
|
registerSystemEndpoints(app, io);
|
|
21
23
|
registerUtilsEndpoints(app, io);
|
|
@@ -25,6 +27,7 @@ module.exports = {
|
|
|
25
27
|
registerBookmarkEndpoints,
|
|
26
28
|
registerConfigEndpoints,
|
|
27
29
|
registerFolderEndpoints,
|
|
30
|
+
registerPluginEndpoints,
|
|
28
31
|
registerSessionsEndpoints,
|
|
29
32
|
registerSystemEndpoints,
|
|
30
33
|
registerUtilsEndpoints,
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin REST endpoints
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const { loadConfig, saveConfig } = require('../../utils/config');
|
|
8
|
+
const pluginManager = require('../../plugins/plugin-manager');
|
|
9
|
+
|
|
10
|
+
function registerPluginEndpoints(app, io) {
|
|
11
|
+
app.get('/api/plugins', (req, res) => {
|
|
12
|
+
try {
|
|
13
|
+
const discovered = pluginManager.discoverPlugins();
|
|
14
|
+
const config = loadConfig();
|
|
15
|
+
const configuredPlugins = config.plugins || [];
|
|
16
|
+
|
|
17
|
+
const plugins = discovered.map(plugin => {
|
|
18
|
+
const existing = configuredPlugins.find(p => p.name === plugin.name);
|
|
19
|
+
return {
|
|
20
|
+
name: plugin.name,
|
|
21
|
+
description: plugin.description,
|
|
22
|
+
enabled: existing ? existing.enabled !== false : true,
|
|
23
|
+
config: existing ? (existing.config || {}) : {},
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const configuredNames = new Set(configuredPlugins.map(p => p.name));
|
|
28
|
+
const extraPlugins = configuredPlugins
|
|
29
|
+
.filter(p => !discovered.find(d => d.name === p.name))
|
|
30
|
+
.map(p => ({
|
|
31
|
+
name: p.name,
|
|
32
|
+
description: 'Plugin not found in plugins directory',
|
|
33
|
+
enabled: p.enabled !== false,
|
|
34
|
+
config: p.config || {},
|
|
35
|
+
missing: true,
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
res.json([...plugins, ...extraPlugins]);
|
|
39
|
+
} catch (err) {
|
|
40
|
+
console.error('[PLUGINS] Error listing plugins:', err);
|
|
41
|
+
res.status(500).json({ error: 'Failed to list plugins' });
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
app.post('/api/plugins', (req, res) => {
|
|
46
|
+
try {
|
|
47
|
+
const { name, enabled } = req.body;
|
|
48
|
+
|
|
49
|
+
if (!name) {
|
|
50
|
+
return res.status(400).json({ error: 'Plugin name is required' });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const discovered = pluginManager.discoverPlugins();
|
|
54
|
+
const pluginExists = discovered.some(p => p.name === name);
|
|
55
|
+
if (!pluginExists) {
|
|
56
|
+
return res.status(404).json({ error: 'Plugin not found' });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const config = loadConfig();
|
|
60
|
+
if (!config.plugins) {
|
|
61
|
+
config.plugins = [];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const existingIndex = config.plugins.findIndex(p => p.name === name);
|
|
65
|
+
if (existingIndex >= 0) {
|
|
66
|
+
config.plugins[existingIndex].enabled = enabled;
|
|
67
|
+
} else {
|
|
68
|
+
config.plugins.push({ name, enabled, config: {} });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const saved = saveConfig(config);
|
|
72
|
+
if (!saved) {
|
|
73
|
+
return res.status(500).json({ error: 'Failed to save config' });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const reloadedConfig = loadConfig();
|
|
77
|
+
pluginManager.reload(reloadedConfig);
|
|
78
|
+
|
|
79
|
+
res.json({
|
|
80
|
+
success: true,
|
|
81
|
+
name,
|
|
82
|
+
enabled,
|
|
83
|
+
});
|
|
84
|
+
} catch (err) {
|
|
85
|
+
console.error('[PLUGINS] Error updating plugin:', err);
|
|
86
|
+
res.status(500).json({ error: 'Failed to update plugin' });
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
module.exports = { registerPluginEndpoints };
|
|
@@ -140,9 +140,9 @@ function registerSystemEndpoints(app, io) {
|
|
|
140
140
|
// Determine the install script based on platform
|
|
141
141
|
let installScript;
|
|
142
142
|
if (platform === 'win32') {
|
|
143
|
-
installScript = path.join(__dirname, '../../../../install.ps1');
|
|
143
|
+
installScript = path.join(__dirname, '../../../../sshift-install.ps1');
|
|
144
144
|
} else {
|
|
145
|
-
installScript = path.join(__dirname, '../../../../install.sh');
|
|
145
|
+
installScript = path.join(__dirname, '../../../../sshift-install.sh');
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
// Check if install script exists
|
|
@@ -41,6 +41,73 @@ class PluginManager {
|
|
|
41
41
|
this.flashingSessions = new Map(); // sessionId -> options
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
discoverPlugins() {
|
|
45
|
+
const builtinDir = path.join(__dirname, '..', '..', '..', 'plugins');
|
|
46
|
+
const discovered = [];
|
|
47
|
+
|
|
48
|
+
if (fs.existsSync(builtinDir)) {
|
|
49
|
+
const entries = fs.readdirSync(builtinDir, { withFileTypes: true });
|
|
50
|
+
for (const entry of entries) {
|
|
51
|
+
if (!entry.isDirectory()) continue;
|
|
52
|
+
const pluginDir = path.join(builtinDir, entry.name);
|
|
53
|
+
const indexFile = path.join(pluginDir, 'index.js');
|
|
54
|
+
const pkgFile = path.join(pluginDir, 'package.json');
|
|
55
|
+
|
|
56
|
+
if (!fs.existsSync(indexFile)) continue;
|
|
57
|
+
|
|
58
|
+
let description = '';
|
|
59
|
+
if (fs.existsSync(pkgFile)) {
|
|
60
|
+
try {
|
|
61
|
+
const pkg = JSON.parse(fs.readFileSync(pkgFile, 'utf8'));
|
|
62
|
+
description = pkg.description || '';
|
|
63
|
+
} catch (e) { /* ignore */ }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
discovered.push({
|
|
67
|
+
name: entry.name,
|
|
68
|
+
description,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return discovered;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
reload(config) {
|
|
77
|
+
this.config = config;
|
|
78
|
+
|
|
79
|
+
for (const hookFns of Object.values(this.hooks)) {
|
|
80
|
+
hookFns.length = 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
for (const [name, pluginEntry] of this.plugins.entries()) {
|
|
84
|
+
const instance = pluginEntry.instance;
|
|
85
|
+
if (instance && typeof instance.onSessionDisconnect === 'function') {
|
|
86
|
+
for (const sessionId of this._lineBuffers.keys()) {
|
|
87
|
+
try { instance.onSessionDisconnect(sessionId); } catch (e) { /* ignore */ }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
this.plugins.clear();
|
|
93
|
+
this._lineBuffers.clear();
|
|
94
|
+
this.flashingSessions.clear();
|
|
95
|
+
|
|
96
|
+
this._loadPlugins();
|
|
97
|
+
|
|
98
|
+
if (this.io) {
|
|
99
|
+
for (const [, socket] of this.io.sockets.sockets) {
|
|
100
|
+
this.syncFlashState(socket);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (this.sshManager) {
|
|
105
|
+
for (const sessionId of this.sshManager.sessions.keys()) {
|
|
106
|
+
this.emit('onSessionConnect', sessionId, {});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
44
111
|
init({ io, sshManager, tabManager, config }) {
|
|
45
112
|
this.io = io;
|
|
46
113
|
this.sshManager = sshManager;
|
|
@@ -61,6 +128,14 @@ class PluginManager {
|
|
|
61
128
|
}
|
|
62
129
|
}
|
|
63
130
|
|
|
131
|
+
getPluginDir(name) {
|
|
132
|
+
const localDir = path.join(__dirname, name);
|
|
133
|
+
const builtinDir = path.join(__dirname, '..', '..', '..', 'plugins', name);
|
|
134
|
+
if (fs.existsSync(path.join(localDir, 'index.js'))) return localDir;
|
|
135
|
+
if (fs.existsSync(path.join(builtinDir, 'index.js'))) return builtinDir;
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
|
|
64
139
|
_loadPlugin(pluginConfig) {
|
|
65
140
|
const { name } = pluginConfig;
|
|
66
141
|
|
|
@@ -11,23 +11,16 @@ const crypto = require('crypto');
|
|
|
11
11
|
// Get user's home directory
|
|
12
12
|
const HOME_DIR = os.homedir();
|
|
13
13
|
|
|
14
|
-
//
|
|
15
|
-
const
|
|
16
|
-
// Linux/macOS
|
|
17
|
-
path.join(HOME_DIR, '.local', 'share', 'sshift'),
|
|
18
|
-
// Windows
|
|
19
|
-
path.join(HOME_DIR, '.local', 'share', 'sshift'),
|
|
20
|
-
// Alternative locations
|
|
21
|
-
path.join(HOME_DIR, '.local', 'share', 'bin'),
|
|
22
|
-
];
|
|
14
|
+
// User install directory for config
|
|
15
|
+
const USER_INSTALL_DIR = path.join(HOME_DIR, '.local', 'share', 'sshift');
|
|
23
16
|
|
|
24
|
-
// Config paths - prioritize
|
|
17
|
+
// Config paths - prioritize package directory, then user install directory
|
|
25
18
|
const PACKAGE_DIR = path.join(__dirname, '..', '..', '..');
|
|
26
19
|
const ENV_CONFIG_PATHS = [
|
|
27
|
-
...DEFAULT_INSTALL_DIRS.map(dir => path.join(dir, '.env', 'config.json')),
|
|
28
|
-
...DEFAULT_INSTALL_DIRS.map(dir => path.join(dir, 'config.json')),
|
|
29
20
|
path.join(PACKAGE_DIR, '.env', 'config.json'),
|
|
30
21
|
path.join(PACKAGE_DIR, 'config.json'),
|
|
22
|
+
path.join(USER_INSTALL_DIR, '.env', 'config.json'),
|
|
23
|
+
path.join(USER_INSTALL_DIR, 'config.json'),
|
|
31
24
|
];
|
|
32
25
|
|
|
33
26
|
// Default config structure
|
|
@@ -15,29 +15,18 @@ function loadEnvFiles() {
|
|
|
15
15
|
// Get user's home directory
|
|
16
16
|
const HOME_DIR = os.homedir();
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
const DEFAULT_INSTALL_DIRS = [
|
|
20
|
-
// Linux/macOS
|
|
21
|
-
path.join(HOME_DIR, '.local', 'share', 'sshift'),
|
|
22
|
-
// Windows
|
|
23
|
-
path.join(HOME_DIR, '.local', 'share', 'sshift'),
|
|
24
|
-
// Alternative locations
|
|
25
|
-
path.join(HOME_DIR, '.local', 'share', 'bin'),
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
// Package directory (for development)
|
|
18
|
+
const USER_INSTALL_DIR = path.join(HOME_DIR, '.local', 'share', 'sshift');
|
|
29
19
|
const PACKAGE_DIR = path.join(__dirname, '..', '..', '..');
|
|
30
20
|
|
|
31
|
-
// Build env paths - prioritize user install directory, then package directory
|
|
32
21
|
const envPaths = [
|
|
33
|
-
...DEFAULT_INSTALL_DIRS.map(dir => path.join(dir, '.env', '.env.local')),
|
|
34
|
-
...DEFAULT_INSTALL_DIRS.map(dir => path.join(dir, '.env.local')),
|
|
35
|
-
...DEFAULT_INSTALL_DIRS.map(dir => path.join(dir, '.env', '.env')),
|
|
36
|
-
...DEFAULT_INSTALL_DIRS.map(dir => path.join(dir, '.env')),
|
|
37
22
|
path.join(PACKAGE_DIR, '.env', '.env.local'),
|
|
38
23
|
path.join(PACKAGE_DIR, '.env.local'),
|
|
39
24
|
path.join(PACKAGE_DIR, '.env', '.env'),
|
|
40
|
-
path.join(PACKAGE_DIR, '.env')
|
|
25
|
+
path.join(PACKAGE_DIR, '.env'),
|
|
26
|
+
path.join(USER_INSTALL_DIR, '.env', '.env.local'),
|
|
27
|
+
path.join(USER_INSTALL_DIR, '.env.local'),
|
|
28
|
+
path.join(USER_INSTALL_DIR, '.env', '.env'),
|
|
29
|
+
path.join(USER_INSTALL_DIR, '.env')
|
|
41
30
|
];
|
|
42
31
|
|
|
43
32
|
envPaths.forEach(envPath => {
|
package/src/webapp/css/style.css
CHANGED
|
@@ -3529,6 +3529,73 @@ body.dragging-tabs .tabs-container {
|
|
|
3529
3529
|
transform: translateX(20px);
|
|
3530
3530
|
}
|
|
3531
3531
|
|
|
3532
|
+
.setting-group-title {
|
|
3533
|
+
display: flex;
|
|
3534
|
+
align-items: center;
|
|
3535
|
+
gap: 8px;
|
|
3536
|
+
font-size: 14px;
|
|
3537
|
+
font-weight: 600;
|
|
3538
|
+
color: var(--text-primary);
|
|
3539
|
+
margin-bottom: 12px;
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3542
|
+
.setting-group-title i {
|
|
3543
|
+
color: var(--accent-primary);
|
|
3544
|
+
}
|
|
3545
|
+
|
|
3546
|
+
.plugins-list {
|
|
3547
|
+
display: flex;
|
|
3548
|
+
flex-direction: column;
|
|
3549
|
+
gap: 10px;
|
|
3550
|
+
}
|
|
3551
|
+
|
|
3552
|
+
.plugins-loading {
|
|
3553
|
+
color: var(--text-secondary);
|
|
3554
|
+
font-size: 13px;
|
|
3555
|
+
padding: 8px 0;
|
|
3556
|
+
}
|
|
3557
|
+
|
|
3558
|
+
.plugin-card {
|
|
3559
|
+
display: flex;
|
|
3560
|
+
align-items: center;
|
|
3561
|
+
justify-content: space-between;
|
|
3562
|
+
padding: 12px 16px;
|
|
3563
|
+
background: var(--bg-secondary);
|
|
3564
|
+
border: 1px solid var(--border-color);
|
|
3565
|
+
border-radius: 8px;
|
|
3566
|
+
gap: 12px;
|
|
3567
|
+
}
|
|
3568
|
+
|
|
3569
|
+
.plugin-card.missing {
|
|
3570
|
+
opacity: 0.55;
|
|
3571
|
+
}
|
|
3572
|
+
|
|
3573
|
+
.plugin-card-info {
|
|
3574
|
+
display: flex;
|
|
3575
|
+
flex-direction: column;
|
|
3576
|
+
gap: 2px;
|
|
3577
|
+
min-width: 0;
|
|
3578
|
+
flex: 1;
|
|
3579
|
+
}
|
|
3580
|
+
|
|
3581
|
+
.plugin-card-name {
|
|
3582
|
+
font-weight: 600;
|
|
3583
|
+
font-size: 14px;
|
|
3584
|
+
color: var(--text-primary);
|
|
3585
|
+
}
|
|
3586
|
+
|
|
3587
|
+
.plugin-card-description {
|
|
3588
|
+
font-size: 12px;
|
|
3589
|
+
color: var(--text-secondary);
|
|
3590
|
+
line-height: 1.4;
|
|
3591
|
+
}
|
|
3592
|
+
|
|
3593
|
+
.plugin-card-missing {
|
|
3594
|
+
font-size: 11px;
|
|
3595
|
+
color: var(--accent-danger, #f85149);
|
|
3596
|
+
margin-top: 2px;
|
|
3597
|
+
}
|
|
3598
|
+
|
|
3532
3599
|
/* Mobile Keys Bar */
|
|
3533
3600
|
.mobile-keys-bar {
|
|
3534
3601
|
display: none;
|
package/src/webapp/index.html
CHANGED
|
@@ -854,6 +854,14 @@
|
|
|
854
854
|
</div>
|
|
855
855
|
</div>
|
|
856
856
|
</div>
|
|
857
|
+
|
|
858
|
+
<!-- Plugins -->
|
|
859
|
+
<div class="setting-group">
|
|
860
|
+
<h3 class="setting-group-title"><i class="fas fa-puzzle-piece"></i> Plugins</h3>
|
|
861
|
+
<div id="pluginsList" class="plugins-list">
|
|
862
|
+
<div class="plugins-loading">Loading plugins...</div>
|
|
863
|
+
</div>
|
|
864
|
+
</div>
|
|
857
865
|
</div>
|
|
858
866
|
<div class="modal-footer" style="justify-content: space-between;">
|
|
859
867
|
<button class="btn btn-danger" id="logoutBtn" style="display: none;">
|
package/src/webapp/js/app.js
CHANGED
|
@@ -4259,6 +4259,9 @@ class SSHIFTClient {
|
|
|
4259
4259
|
// Update password toggle button state
|
|
4260
4260
|
this.updatePasswordToggleUI();
|
|
4261
4261
|
|
|
4262
|
+
// Load plugins
|
|
4263
|
+
this.loadPlugins();
|
|
4264
|
+
|
|
4262
4265
|
this.openModal('settingsModal');
|
|
4263
4266
|
}
|
|
4264
4267
|
|
|
@@ -4981,6 +4984,88 @@ class SSHIFTClient {
|
|
|
4981
4984
|
});
|
|
4982
4985
|
}
|
|
4983
4986
|
|
|
4987
|
+
async loadPlugins() {
|
|
4988
|
+
const pluginsList = document.getElementById('pluginsList');
|
|
4989
|
+
if (!pluginsList) return;
|
|
4990
|
+
|
|
4991
|
+
pluginsList.innerHTML = '<div class="plugins-loading">Loading plugins...</div>';
|
|
4992
|
+
|
|
4993
|
+
try {
|
|
4994
|
+
const headers = { 'Content-Type': 'application/json' };
|
|
4995
|
+
if (this.authToken) headers['Authorization'] = `Bearer ${this.authToken}`;
|
|
4996
|
+
const response = await fetch('/api/plugins', { headers });
|
|
4997
|
+
|
|
4998
|
+
if (!response.ok) {
|
|
4999
|
+
pluginsList.innerHTML = '<div class="plugins-loading">Failed to load plugins</div>';
|
|
5000
|
+
return;
|
|
5001
|
+
}
|
|
5002
|
+
|
|
5003
|
+
const plugins = await response.json();
|
|
5004
|
+
|
|
5005
|
+
if (plugins.length === 0) {
|
|
5006
|
+
pluginsList.innerHTML = '<div class="plugins-loading">No plugins available</div>';
|
|
5007
|
+
return;
|
|
5008
|
+
}
|
|
5009
|
+
|
|
5010
|
+
pluginsList.innerHTML = plugins.map(plugin => {
|
|
5011
|
+
const name = this.escapeHtml(plugin.name);
|
|
5012
|
+
const description = this.escapeHtml(plugin.description || '');
|
|
5013
|
+
const isMissing = plugin.missing === true;
|
|
5014
|
+
const missingClass = isMissing ? ' missing' : '';
|
|
5015
|
+
const missingHtml = isMissing ? '<div class="plugin-card-missing"><i class="fas fa-exclamation-triangle"></i> Plugin directory not found</div>' : '';
|
|
5016
|
+
|
|
5017
|
+
return `
|
|
5018
|
+
<div class="plugin-card${missingClass}" data-plugin="${name}">
|
|
5019
|
+
<div class="plugin-card-info">
|
|
5020
|
+
<div class="plugin-card-name">${name}</div>
|
|
5021
|
+
${description ? `<div class="plugin-card-description">${description}</div>` : ''}
|
|
5022
|
+
${missingHtml}
|
|
5023
|
+
</div>
|
|
5024
|
+
<label class="toggle-switch">
|
|
5025
|
+
<input type="checkbox" class="plugin-toggle" data-plugin="${name}" ${plugin.enabled ? 'checked' : ''} ${isMissing ? 'disabled' : ''}>
|
|
5026
|
+
<span class="toggle-slider"></span>
|
|
5027
|
+
</label>
|
|
5028
|
+
</div>
|
|
5029
|
+
`;
|
|
5030
|
+
}).join('');
|
|
5031
|
+
|
|
5032
|
+
pluginsList.querySelectorAll('.plugin-toggle').forEach(toggle => {
|
|
5033
|
+
toggle.addEventListener('change', (e) => {
|
|
5034
|
+
const pluginName = e.target.dataset.plugin;
|
|
5035
|
+
const enabled = e.target.checked;
|
|
5036
|
+
this.togglePlugin(pluginName, enabled, e.target);
|
|
5037
|
+
});
|
|
5038
|
+
});
|
|
5039
|
+
} catch (err) {
|
|
5040
|
+
console.error('[SSHIFT] Error loading plugins:', err);
|
|
5041
|
+
pluginsList.innerHTML = '<div class="plugins-loading">Failed to load plugins</div>';
|
|
5042
|
+
}
|
|
5043
|
+
}
|
|
5044
|
+
|
|
5045
|
+
async togglePlugin(name, enabled, toggleEl) {
|
|
5046
|
+
try {
|
|
5047
|
+
const headers = { 'Content-Type': 'application/json' };
|
|
5048
|
+
if (this.authToken) headers['Authorization'] = `Bearer ${this.authToken}`;
|
|
5049
|
+
const response = await fetch('/api/plugins', {
|
|
5050
|
+
method: 'POST',
|
|
5051
|
+
headers,
|
|
5052
|
+
body: JSON.stringify({ name, enabled })
|
|
5053
|
+
});
|
|
5054
|
+
|
|
5055
|
+
if (!response.ok) {
|
|
5056
|
+
toggleEl.checked = !enabled;
|
|
5057
|
+
this.showToast('Failed to update plugin', 'error');
|
|
5058
|
+
return;
|
|
5059
|
+
}
|
|
5060
|
+
|
|
5061
|
+
this.showToast(`Plugin "${name}" ${enabled ? 'enabled' : 'disabled'}`, 'success');
|
|
5062
|
+
} catch (err) {
|
|
5063
|
+
console.error('[SSHIFT] Error toggling plugin:', err);
|
|
5064
|
+
toggleEl.checked = !enabled;
|
|
5065
|
+
this.showToast('Failed to update plugin', 'error');
|
|
5066
|
+
}
|
|
5067
|
+
}
|
|
5068
|
+
|
|
4984
5069
|
saveTerminalColorSettings() {
|
|
4985
5070
|
// Save settings for current theme
|
|
4986
5071
|
const themeKey = this.theme; // 'dark' or 'light'
|
|
@@ -6617,20 +6702,17 @@ class SSHIFTClient {
|
|
|
6617
6702
|
const flashingSessions = this._flashingSessions || (this._flashingSessions = new Set());
|
|
6618
6703
|
flashingSessions.add(sessionId);
|
|
6619
6704
|
|
|
6620
|
-
|
|
6621
|
-
if (tab) {
|
|
6705
|
+
document.querySelectorAll(`.tab[data-session-id="${sessionId}"]`).forEach(tab => {
|
|
6622
6706
|
tab.classList.add('flashing');
|
|
6623
|
-
}
|
|
6707
|
+
});
|
|
6624
6708
|
|
|
6625
|
-
|
|
6626
|
-
if (mobileOption) {
|
|
6709
|
+
document.querySelectorAll(`.mobile-tab-option[data-session-id="${sessionId}"]`).forEach(mobileOption => {
|
|
6627
6710
|
mobileOption.classList.add('flashing');
|
|
6628
|
-
}
|
|
6711
|
+
});
|
|
6629
6712
|
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
}
|
|
6713
|
+
document.querySelectorAll('.mobile-tabs-toggle').forEach(toggle => {
|
|
6714
|
+
toggle.classList.add('flashing');
|
|
6715
|
+
});
|
|
6634
6716
|
|
|
6635
6717
|
if (!this._tabFlashTimers) this._tabFlashTimers = new Map();
|
|
6636
6718
|
if (options.duration) {
|
|
@@ -6654,20 +6736,19 @@ class SSHIFTClient {
|
|
|
6654
6736
|
flashingSessions.delete(sessionId);
|
|
6655
6737
|
}
|
|
6656
6738
|
|
|
6657
|
-
|
|
6658
|
-
if (tab) {
|
|
6739
|
+
document.querySelectorAll(`.tab[data-session-id="${sessionId}"]`).forEach(tab => {
|
|
6659
6740
|
tab.classList.remove('flashing');
|
|
6660
|
-
}
|
|
6741
|
+
});
|
|
6661
6742
|
|
|
6662
|
-
|
|
6663
|
-
if (mobileOption) {
|
|
6743
|
+
document.querySelectorAll(`.mobile-tab-option[data-session-id="${sessionId}"]`).forEach(mobileOption => {
|
|
6664
6744
|
mobileOption.classList.remove('flashing');
|
|
6665
|
-
}
|
|
6745
|
+
});
|
|
6666
6746
|
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6747
|
+
document.querySelectorAll('.mobile-tabs-toggle').forEach(toggle => {
|
|
6748
|
+
if (!flashingSessions || flashingSessions.size === 0) {
|
|
6749
|
+
toggle.classList.remove('flashing');
|
|
6750
|
+
}
|
|
6751
|
+
});
|
|
6671
6752
|
|
|
6672
6753
|
if (this._tabFlashTimers) {
|
|
6673
6754
|
const timer = this._tabFlashTimers.get(sessionId);
|
|
@@ -6683,21 +6764,18 @@ class SSHIFTClient {
|
|
|
6683
6764
|
if (!flashingSessions || flashingSessions.size === 0) return;
|
|
6684
6765
|
|
|
6685
6766
|
for (const sessionId of flashingSessions) {
|
|
6686
|
-
|
|
6687
|
-
if (tab) {
|
|
6767
|
+
document.querySelectorAll(`.tab[data-session-id="${sessionId}"]`).forEach(tab => {
|
|
6688
6768
|
tab.classList.add('flashing');
|
|
6689
|
-
}
|
|
6769
|
+
});
|
|
6690
6770
|
|
|
6691
|
-
|
|
6692
|
-
if (mobileOption) {
|
|
6771
|
+
document.querySelectorAll(`.mobile-tab-option[data-session-id="${sessionId}"]`).forEach(mobileOption => {
|
|
6693
6772
|
mobileOption.classList.add('flashing');
|
|
6694
|
-
}
|
|
6773
|
+
});
|
|
6695
6774
|
}
|
|
6696
6775
|
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
}
|
|
6776
|
+
document.querySelectorAll('.mobile-tabs-toggle').forEach(toggle => {
|
|
6777
|
+
toggle.classList.add('flashing');
|
|
6778
|
+
});
|
|
6701
6779
|
}
|
|
6702
6780
|
|
|
6703
6781
|
switchTab(sessionId, panelId = null) {
|