@lethevimlet/sshift 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -1061
- package/example.config.json +1 -0
- package/package.json +3 -1
- package/src/server/index.js +182 -87
- package/src/server/utils/config.js +83 -17
- package/src/server/utils/env-loader.js +26 -5
- package/src/webapp/css/style.css +665 -42
- package/src/webapp/index.html +4 -1
- package/src/webapp/js/app.js +555 -78
- package/src/webapp/js/mobile-terminal.js +1370 -0
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# SSHIFT - Web-based SSH & SFTP Terminal Client
|
|
2
2
|
|
|
3
|
-
[](https://lethevimlet.github.io/sshift/)
|
|
4
|
+
[](https://www.npmjs.com/package/@lethevimlet/sshift)
|
|
5
|
+
[](https://github.com/lethevimlet/sshift/pkgs/container/sshift)
|
|
4
6
|
[](https://opensource.org/licenses/MIT)
|
|
5
7
|
|
|
6
8
|
A modern, responsive web-based SSH and SFTP terminal client built with Node.js, Express, and xterm.js. Features excellent TUI support, tabbed sessions, bookmarks, and mobile-friendly design.
|
|
@@ -16,1119 +18,114 @@ A modern, responsive web-based SSH and SFTP terminal client built with Node.js,
|
|
|
16
18
|
|
|
17
19
|
## ✨ Features
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- **
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
- Alternate buffer support (for TUI applications)
|
|
21
|
+
- 🔐 **SSH Terminal** - Full xterm.js emulation with TUI support (vim, nano, htop, tmux)
|
|
22
|
+
- 📁 **SFTP Browser** - File manager interface with upload/download
|
|
23
|
+
- 🗂️ **Tabbed Interface** - Multiple concurrent sessions
|
|
24
|
+
- 🔖 **Bookmarks** - Save connection details for quick access
|
|
25
|
+
- ⌨️ **Mobile-Friendly** - Special keys popup for mobile devices
|
|
26
|
+
- 🎨 **Modern UI** - GitHub-inspired dark theme, fully responsive
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
- Browse remote directories with a file manager interface
|
|
29
|
-
- **Download files** (click to download)
|
|
30
|
-
- **Upload files** (drag & drop or file picker)
|
|
31
|
-
- Create directories
|
|
32
|
-
- Delete files and directories
|
|
33
|
-
- File size and permissions display
|
|
34
|
-
|
|
35
|
-
### 🗂️ Tabbed Interface
|
|
36
|
-
- Multiple concurrent SSH and SFTP sessions
|
|
37
|
-
- Switch between sessions with tabs
|
|
38
|
-
- Visual session indicators
|
|
39
|
-
- Easy tab management (close, reorder)
|
|
40
|
-
- Session persistence
|
|
41
|
-
|
|
42
|
-
### 🔖 Bookmarks
|
|
43
|
-
- Save connection details for quick access
|
|
44
|
-
- Edit and delete bookmarks
|
|
45
|
-
- Persistent storage in configuration file
|
|
46
|
-
- Quick connect from sidebar
|
|
47
|
-
|
|
48
|
-
### ⌨️ Special Keys Popup
|
|
49
|
-
- **Mobile-friendly** special keys input
|
|
50
|
-
- Ctrl+C, Ctrl+D, Ctrl+Z, etc.
|
|
51
|
-
- Function keys F1-F12
|
|
52
|
-
- Arrow keys and navigation keys
|
|
53
|
-
- Triggered by clicking on tabs (mobile)
|
|
54
|
-
|
|
55
|
-
### 🎨 Modern UI
|
|
56
|
-
- **GitHub-inspired dark theme**
|
|
57
|
-
- Easy on the eyes
|
|
58
|
-
- High contrast for readability
|
|
59
|
-
- Fully responsive design
|
|
60
|
-
- Works on desktop, tablet, and mobile
|
|
61
|
-
|
|
62
|
-
## 📦 Installation
|
|
63
|
-
|
|
64
|
-
### Prerequisites
|
|
65
|
-
- **Node.js** >= 20.0.0 (installed automatically by the installer if not present)
|
|
66
|
-
- **npm** or **yarn**
|
|
67
|
-
|
|
68
|
-
### Quick Install via npm (Recommended)
|
|
69
|
-
|
|
70
|
-
The easiest way to install sshift is via npm:
|
|
28
|
+
## 🚀 Quick Start
|
|
71
29
|
|
|
72
30
|
```bash
|
|
73
31
|
# Install globally
|
|
74
|
-
npm install -g sshift
|
|
32
|
+
npm install -g @lethevimlet/sshift
|
|
75
33
|
|
|
76
34
|
# Start the server
|
|
77
35
|
sshift
|
|
78
36
|
```
|
|
79
37
|
|
|
80
|
-
|
|
38
|
+
The application will be available at `http://localhost:8022`
|
|
81
39
|
|
|
82
|
-
|
|
40
|
+
## 📖 Documentation
|
|
83
41
|
|
|
84
|
-
|
|
42
|
+
Full documentation is available at [GitHub Pages](https://lethevimlet.github.io/sshift/).
|
|
85
43
|
|
|
86
|
-
|
|
44
|
+
- **[Installation](docs/installation.md)** - Detailed installation options
|
|
45
|
+
- **[Docker](docs/docker.md)** - Docker deployment and usage
|
|
46
|
+
- **[Configuration](docs/configuration.md)** - Configuration files and options
|
|
47
|
+
- **[API Reference](docs/api-reference.md)** - Socket.IO events and API
|
|
48
|
+
- **[Testing](docs/testing.md)** - Running and writing tests
|
|
49
|
+
- **[Contributing](docs/contributing.md)** - How to contribute
|
|
87
50
|
|
|
88
|
-
|
|
89
|
-
curl -fsSL https://raw.githubusercontent.com/lethevimlet/sshift/main/install.sh | bash
|
|
90
|
-
```
|
|
51
|
+
## 📦 Installation
|
|
91
52
|
|
|
92
|
-
|
|
53
|
+
### One-Liner Installation (Recommended)
|
|
93
54
|
|
|
55
|
+
The recommended way to install sshift - automatically handles updates and autostart configuration:
|
|
56
|
+
|
|
57
|
+
**Linux/macOS:**
|
|
94
58
|
```bash
|
|
95
|
-
|
|
59
|
+
curl -fsSL https://raw.githubusercontent.com/lethevimlet/sshift/main/install.sh | bash
|
|
96
60
|
```
|
|
97
61
|
|
|
98
|
-
|
|
62
|
+
**Windows (PowerShell):**
|
|
99
63
|
|
|
100
64
|
```powershell
|
|
65
|
+
Set-ExecutionPolicy Bypass -Scope Process
|
|
101
66
|
Invoke-Expression (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/lethevimlet/sshift/main/install.ps1" -UseBasicParsing).Content
|
|
102
67
|
```
|
|
103
68
|
|
|
104
|
-
|
|
69
|
+
> **Note:** The Windows installer requires PowerShell to be run as Administrator for npm global installations.
|
|
105
70
|
|
|
106
|
-
|
|
71
|
+
The installer will:
|
|
72
|
+
- Install Node.js 18+ if not present
|
|
73
|
+
- Install sshift globally
|
|
74
|
+
- Configure autostart (systemd on Linux, launchd on macOS, Task Scheduler on Windows)
|
|
75
|
+
- Set up automatic updates
|
|
107
76
|
|
|
108
|
-
|
|
77
|
+
### Docker
|
|
109
78
|
|
|
110
79
|
```bash
|
|
111
|
-
|
|
112
|
-
curl -fsSL https://raw.githubusercontent.com/lethevimlet/sshift/main/install.sh | bash -s -- --port 8080
|
|
80
|
+
docker run -d -p 8022:8022 --name sshift ghcr.io/lethevimlet/sshift:latest
|
|
113
81
|
|
|
114
|
-
#
|
|
115
|
-
|
|
82
|
+
# Or with docker-compose
|
|
83
|
+
curl -O https://raw.githubusercontent.com/lethevimlet/sshift/main/docker/docker-compose.yml
|
|
84
|
+
docker-compose up -d
|
|
116
85
|
```
|
|
117
86
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
```powershell
|
|
121
|
-
# Install with custom port
|
|
122
|
-
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/lethevimlet/sshift/main/install.ps1" -OutFile "install.ps1"
|
|
123
|
-
.\install.ps1 -Port 8080
|
|
124
|
-
|
|
125
|
-
# Show help
|
|
126
|
-
.\install.ps1 -Help
|
|
127
|
-
```
|
|
87
|
+
See [Docker README](docker/README.md) for detailed instructions.
|
|
128
88
|
|
|
129
|
-
###
|
|
130
|
-
|
|
131
|
-
To update sshift to the latest version:
|
|
89
|
+
### npm
|
|
132
90
|
|
|
133
91
|
```bash
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
# Or use the installation script
|
|
138
|
-
./install.sh --update
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Uninstallation
|
|
142
|
-
|
|
143
|
-
To remove sshift from your system:
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
# Uninstall via npm
|
|
147
|
-
npm uninstall -g sshift
|
|
148
|
-
|
|
149
|
-
# Or use the installation script
|
|
150
|
-
./install.sh --uninstall
|
|
92
|
+
npm install -g @lethevimlet/sshift
|
|
93
|
+
sshift
|
|
151
94
|
```
|
|
152
95
|
|
|
153
|
-
###
|
|
154
|
-
|
|
155
|
-
1. **Checks for Node.js** - Installs Node.js 18+ if not present
|
|
156
|
-
2. **Installs via npm** - Installs sshift globally using npm
|
|
157
|
-
3. **Creates executable** - Sets up `sshift` command in your PATH
|
|
158
|
-
4. **Configures autostart** (optional) - Sets up sshift to start on boot
|
|
159
|
-
5. **Checks for updates** - Compares local and remote versions
|
|
160
|
-
|
|
161
|
-
### Manual Installation from Source
|
|
162
|
-
|
|
163
|
-
If you prefer to install from source:
|
|
96
|
+
### From Source (GitHub)
|
|
164
97
|
|
|
165
98
|
```bash
|
|
166
|
-
# Clone the repository
|
|
167
99
|
git clone https://github.com/lethevimlet/sshift.git
|
|
168
100
|
cd sshift
|
|
169
|
-
|
|
170
|
-
# Install dependencies
|
|
171
101
|
npm install
|
|
172
|
-
|
|
173
|
-
# Start the server
|
|
174
102
|
npm start
|
|
175
103
|
```
|
|
176
104
|
|
|
177
|
-
The application will be available at `http://localhost:8022` (default production port)
|
|
178
|
-
|
|
179
|
-
### Development Mode
|
|
180
|
-
|
|
181
|
-
```bash
|
|
182
|
-
# Start in development mode (port 3000)
|
|
183
|
-
npm run dev
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### Port Configuration
|
|
187
|
-
|
|
188
|
-
SSHIFT uses a flexible port configuration system with the following priority:
|
|
189
|
-
|
|
190
|
-
1. **PORT environment variable** (highest priority)
|
|
191
|
-
2. **config.json** `port`/`devPort` settings
|
|
192
|
-
3. **Default ports**: 8022 (production), 3000 (development)
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
# Run on custom port
|
|
196
|
-
PORT=9000 ./sshift
|
|
197
|
-
|
|
198
|
-
# Run in development mode (uses devPort from config or 3000)
|
|
199
|
-
NODE_ENV=development ./sshift
|
|
200
|
-
|
|
201
|
-
# Or configure in config.json
|
|
202
|
-
{
|
|
203
|
-
"port": 8022, # Production port
|
|
204
|
-
"devPort": 3000 # Development port
|
|
205
|
-
}
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### Bind Address Configuration
|
|
209
|
-
|
|
210
|
-
SSHIFT can bind to a specific network interface. By default, it binds to `0.0.0.0` (all interfaces).
|
|
211
|
-
|
|
212
|
-
1. **BIND environment variable** (highest priority)
|
|
213
|
-
2. **config.json** `bind` setting
|
|
214
|
-
3. **Default**: `0.0.0.0` (all interfaces)
|
|
215
|
-
|
|
216
|
-
```bash
|
|
217
|
-
# Bind to localhost only (no external access)
|
|
218
|
-
BIND=127.0.0.1 ./sshift
|
|
219
|
-
|
|
220
|
-
# Bind to specific interface
|
|
221
|
-
BIND=192.168.1.100 ./sshift
|
|
222
|
-
|
|
223
|
-
# Or configure in config.json
|
|
224
|
-
{
|
|
225
|
-
"bind": "0.0.0.0" # Bind to all interfaces (default)
|
|
226
|
-
}
|
|
227
|
-
```
|
|
228
|
-
|
|
229
105
|
## ⚙️ Configuration
|
|
230
106
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
SSHIFT uses a **priority-based configuration system** with multiple config file locations:
|
|
234
|
-
|
|
235
|
-
#### Environment Variables (`.env` files)
|
|
236
|
-
|
|
237
|
-
Environment variables are loaded from the following locations in **priority order** (highest to lowest):
|
|
238
|
-
|
|
239
|
-
1. `.env/.env.local` - **User-specific, private config** (highest priority)
|
|
240
|
-
2. `.env.local` - User-specific config in root (backward compatibility)
|
|
241
|
-
3. `.env/.env` - Shared environment config
|
|
242
|
-
4. `.env` - Default environment config (lowest priority)
|
|
243
|
-
|
|
244
|
-
**Example `.env/.env.local`:**
|
|
245
|
-
```env
|
|
246
|
-
# SSH Test Credentials
|
|
247
|
-
SSH_HOST=192.168.1.100
|
|
248
|
-
SSH_PORT=22
|
|
249
|
-
SSH_USER=myuser
|
|
250
|
-
SSH_PASS=mypassword
|
|
251
|
-
|
|
252
|
-
# Or use TEST_* variables
|
|
253
|
-
TEST_HOST=192.168.1.100
|
|
254
|
-
TEST_PORT=22
|
|
255
|
-
TEST_USER=testuser
|
|
256
|
-
TEST_PASS=testpassword
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
#### Configuration File (`config.json`)
|
|
260
|
-
|
|
261
|
-
The application configuration (bookmarks, settings) is loaded from:
|
|
262
|
-
|
|
263
|
-
1. `.env/config.json` - **User-specific, private config** (highest priority)
|
|
264
|
-
2. `config.json` - Default config in root (lowest priority)
|
|
265
|
-
|
|
266
|
-
**Example `.env/config.json`:**
|
|
267
|
-
```json
|
|
268
|
-
{
|
|
269
|
-
"port": 8022,
|
|
270
|
-
"devPort": 3000,
|
|
271
|
-
"bind": "0.0.0.0",
|
|
272
|
-
"bookmarks": [
|
|
273
|
-
{
|
|
274
|
-
"id": "1701234567890",
|
|
275
|
-
"name": "Production Server",
|
|
276
|
-
"host": "prod.example.com",
|
|
277
|
-
"port": 22,
|
|
278
|
-
"username": "deploy",
|
|
279
|
-
"type": "ssh"
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
"id": "1701234567891",
|
|
283
|
-
"name": "Development Server",
|
|
284
|
-
"host": "dev.example.com",
|
|
285
|
-
"port": 22,
|
|
286
|
-
"username": "developer",
|
|
287
|
-
"type": "ssh"
|
|
288
|
-
}
|
|
289
|
-
],
|
|
290
|
-
"settings": {
|
|
291
|
-
"fontSize": 14,
|
|
292
|
-
"fontFamily": "'Courier New', monospace",
|
|
293
|
-
"theme": "dark"
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
#### Custom Layouts
|
|
299
|
-
|
|
300
|
-
SSHIFT supports custom terminal layouts that can be defined in `config.json`. Layouts allow you to split your terminal into multiple panels for multitasking.
|
|
301
|
-
|
|
302
|
-
**Layout Structure:**
|
|
303
|
-
|
|
304
|
-
Each layout consists of:
|
|
305
|
-
- `id` - Unique identifier
|
|
306
|
-
- `name` - Display name shown in the UI
|
|
307
|
-
- `icon` - Lucide icon name (e.g., "square", "columns-2", "grid-2x2")
|
|
308
|
-
- `columns` - Array of column definitions
|
|
309
|
-
|
|
310
|
-
Each column has:
|
|
311
|
-
- `width` - Column width (percentage string, e.g., "50%", "33.33%")
|
|
312
|
-
- `rows` - Array of row definitions within the column
|
|
313
|
-
|
|
314
|
-
Each row has:
|
|
315
|
-
- `height` - Row height (percentage string, e.g., "100%", "50%")
|
|
316
|
-
|
|
317
|
-
**Example Custom Layouts:**
|
|
318
|
-
|
|
319
|
-
```json
|
|
320
|
-
{
|
|
321
|
-
"layouts": [
|
|
322
|
-
{
|
|
323
|
-
"id": "single",
|
|
324
|
-
"name": "Single",
|
|
325
|
-
"icon": "square",
|
|
326
|
-
"columns": [
|
|
327
|
-
{
|
|
328
|
-
"width": "100%",
|
|
329
|
-
"rows": [
|
|
330
|
-
{
|
|
331
|
-
"height": "100%"
|
|
332
|
-
}
|
|
333
|
-
]
|
|
334
|
-
}
|
|
335
|
-
]
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
"id": "2-columns",
|
|
339
|
-
"name": "2 Columns",
|
|
340
|
-
"icon": "columns-2",
|
|
341
|
-
"columns": [
|
|
342
|
-
{
|
|
343
|
-
"width": "50%",
|
|
344
|
-
"rows": [
|
|
345
|
-
{
|
|
346
|
-
"height": "100%"
|
|
347
|
-
}
|
|
348
|
-
]
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
"width": "50%",
|
|
352
|
-
"rows": [
|
|
353
|
-
{
|
|
354
|
-
"height": "100%"
|
|
355
|
-
}
|
|
356
|
-
]
|
|
357
|
-
}
|
|
358
|
-
]
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
"id": "mixed",
|
|
362
|
-
"name": "Mixed",
|
|
363
|
-
"icon": "layout-panel-left",
|
|
364
|
-
"columns": [
|
|
365
|
-
{
|
|
366
|
-
"width": "50%",
|
|
367
|
-
"rows": [
|
|
368
|
-
{
|
|
369
|
-
"height": "100%"
|
|
370
|
-
}
|
|
371
|
-
]
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
"width": "50%",
|
|
375
|
-
"rows": [
|
|
376
|
-
{
|
|
377
|
-
"height": "50%"
|
|
378
|
-
},
|
|
379
|
-
{
|
|
380
|
-
"height": "50%"
|
|
381
|
-
}
|
|
382
|
-
]
|
|
383
|
-
}
|
|
384
|
-
]
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
"id": "quad",
|
|
388
|
-
"name": "4 Panels",
|
|
389
|
-
"icon": "grid-2x2",
|
|
390
|
-
"columns": [
|
|
391
|
-
{
|
|
392
|
-
"width": "50%",
|
|
393
|
-
"rows": [
|
|
394
|
-
{
|
|
395
|
-
"height": "50%"
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
"height": "50%"
|
|
399
|
-
}
|
|
400
|
-
]
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
"width": "50%",
|
|
404
|
-
"rows": [
|
|
405
|
-
{
|
|
406
|
-
"height": "50%"
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
"height": "50%"
|
|
410
|
-
}
|
|
411
|
-
]
|
|
412
|
-
}
|
|
413
|
-
]
|
|
414
|
-
},
|
|
415
|
-
{
|
|
416
|
-
"id": "triple-stack",
|
|
417
|
-
"name": "Triple Stack",
|
|
418
|
-
"icon": "grip-lines",
|
|
419
|
-
"columns": [
|
|
420
|
-
{
|
|
421
|
-
"width": "100%",
|
|
422
|
-
"rows": [
|
|
423
|
-
{
|
|
424
|
-
"height": "33.33%"
|
|
425
|
-
},
|
|
426
|
-
{
|
|
427
|
-
"height": "33.33%"
|
|
428
|
-
},
|
|
429
|
-
{
|
|
430
|
-
"height": "33.34%"
|
|
431
|
-
}
|
|
432
|
-
]
|
|
433
|
-
}
|
|
434
|
-
]
|
|
435
|
-
}
|
|
436
|
-
]
|
|
437
|
-
}
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
**Layout Priority:**
|
|
441
|
-
|
|
442
|
-
SSHIFT loads layouts in the following order (first found wins):
|
|
443
|
-
|
|
444
|
-
1. **`config.json`** (via `/api/config`) - Custom layouts from config
|
|
445
|
-
2. **`src/webapp/layouts.json`** - Default layouts file
|
|
446
|
-
3. **Built-in defaults** - Hardcoded fallback layouts
|
|
447
|
-
|
|
448
|
-
**Tips for Custom Layouts:**
|
|
449
|
-
|
|
450
|
-
- Ensure width percentages add up to 100% across columns
|
|
451
|
-
- Ensure height percentages add up to 100% within each column
|
|
452
|
-
- Use unique `id` values for each layout
|
|
453
|
-
- Choose appropriate Lucide icon names for better UI consistency
|
|
454
|
-
- Common icons: `square`, `columns-2`, `columns-3`, `grid-2x2`, `layout-panel-left`, `grip-lines`
|
|
455
|
-
|
|
456
|
-
**Complete Example with Layouts:**
|
|
457
|
-
|
|
458
|
-
```json
|
|
459
|
-
{
|
|
460
|
-
"port": 8022,
|
|
461
|
-
"devPort": 3000,
|
|
462
|
-
"bind": "0.0.0.0",
|
|
463
|
-
"bookmarks": [
|
|
464
|
-
{
|
|
465
|
-
"id": "1701234567890",
|
|
466
|
-
"name": "Production Server",
|
|
467
|
-
"host": "prod.example.com",
|
|
468
|
-
"port": 22,
|
|
469
|
-
"username": "deploy",
|
|
470
|
-
"type": "ssh"
|
|
471
|
-
}
|
|
472
|
-
],
|
|
473
|
-
"settings": {
|
|
474
|
-
"fontSize": 14,
|
|
475
|
-
"fontFamily": "'Courier New', monospace",
|
|
476
|
-
"theme": "dark"
|
|
477
|
-
},
|
|
478
|
-
"layouts": [
|
|
479
|
-
{
|
|
480
|
-
"id": "custom-3-panels",
|
|
481
|
-
"name": "3 Panels",
|
|
482
|
-
"icon": "columns-3",
|
|
483
|
-
"columns": [
|
|
484
|
-
{
|
|
485
|
-
"width": "33.33%",
|
|
486
|
-
"rows": [{ "height": "100%" }]
|
|
487
|
-
},
|
|
488
|
-
{
|
|
489
|
-
"width": "33.33%",
|
|
490
|
-
"rows": [{ "height": "100%" }]
|
|
491
|
-
},
|
|
492
|
-
{
|
|
493
|
-
"width": "33.34%",
|
|
494
|
-
"rows": [{ "height": "100%" }]
|
|
495
|
-
}
|
|
496
|
-
]
|
|
497
|
-
}
|
|
498
|
-
]
|
|
499
|
-
}
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
### Why Multiple Config Locations?
|
|
503
|
-
|
|
504
|
-
- **`.env/` directory** - Git-ignored, perfect for sensitive data (passwords, keys, production credentials)
|
|
505
|
-
- **Root config files** - Can be committed to git for shared team settings
|
|
506
|
-
- **Priority system** - User-specific settings override shared defaults
|
|
507
|
-
|
|
508
|
-
### Git Ignore
|
|
509
|
-
|
|
510
|
-
The `.gitignore` file automatically excludes:
|
|
511
|
-
```
|
|
512
|
-
.env/
|
|
513
|
-
.env.local
|
|
514
|
-
.env.*.local
|
|
515
|
-
config.json
|
|
516
|
-
```
|
|
517
|
-
|
|
518
|
-
This ensures sensitive credentials never get committed to version control.
|
|
519
|
-
|
|
520
|
-
## 🚀 Usage
|
|
521
|
-
|
|
522
|
-
### Command Line Interface
|
|
523
|
-
|
|
524
|
-
SSHIFT provides a command-line interface for managing the server:
|
|
525
|
-
|
|
526
|
-
#### sshift Executable (Linux/macOS)
|
|
527
|
-
|
|
528
|
-
```bash
|
|
529
|
-
# Start server on default port (8022)
|
|
530
|
-
sshift
|
|
531
|
-
|
|
532
|
-
# Start server on custom port
|
|
533
|
-
sshift --port 8080
|
|
534
|
-
sshift -p 8080
|
|
535
|
-
|
|
536
|
-
# Bind to specific address (default: 0.0.0.0 - all interfaces)
|
|
537
|
-
sshift --bind 127.0.0.1
|
|
538
|
-
sshift -b 192.168.1.100
|
|
539
|
-
|
|
540
|
-
# Start in development mode (port 3000)
|
|
541
|
-
sshift --dev
|
|
542
|
-
sshift -d
|
|
543
|
-
|
|
544
|
-
# Stop running instance
|
|
545
|
-
sshift --stop
|
|
546
|
-
sshift -s
|
|
547
|
-
|
|
548
|
-
# Restart running instance
|
|
549
|
-
sshift --restart
|
|
550
|
-
sshift -r
|
|
551
|
-
|
|
552
|
-
# Check if sshift is running
|
|
553
|
-
sshift --status
|
|
554
|
-
|
|
555
|
-
# Show help message
|
|
556
|
-
sshift --help
|
|
557
|
-
sshift -h
|
|
558
|
-
```
|
|
559
|
-
|
|
560
|
-
#### sshift Executable (Windows)
|
|
561
|
-
|
|
562
|
-
```powershell
|
|
563
|
-
# Start server on default port (8022)
|
|
564
|
-
sshift
|
|
565
|
-
|
|
566
|
-
# Start server on custom port
|
|
567
|
-
sshift --port 8080
|
|
568
|
-
sshift -p 8080
|
|
569
|
-
|
|
570
|
-
# Bind to specific address
|
|
571
|
-
sshift --bind 127.0.0.1
|
|
572
|
-
sshift -b 192.168.1.100
|
|
573
|
-
|
|
574
|
-
# Start in development mode (port 3000)
|
|
575
|
-
sshift --dev
|
|
576
|
-
sshift -d
|
|
577
|
-
|
|
578
|
-
# Stop running instance
|
|
579
|
-
sshift --stop
|
|
580
|
-
sshift -s
|
|
581
|
-
|
|
582
|
-
# Restart running instance
|
|
583
|
-
sshift --restart
|
|
584
|
-
sshift -r
|
|
585
|
-
|
|
586
|
-
# Check if sshift is running
|
|
587
|
-
sshift --status
|
|
588
|
-
|
|
589
|
-
# Show help message
|
|
590
|
-
sshift --help
|
|
591
|
-
sshift -h
|
|
592
|
-
```
|
|
593
|
-
|
|
594
|
-
#### Environment Variables
|
|
595
|
-
|
|
596
|
-
You can also use environment variables to configure sshift:
|
|
597
|
-
|
|
598
|
-
```bash
|
|
599
|
-
# Override port
|
|
600
|
-
PORT=8080 sshift
|
|
601
|
-
|
|
602
|
-
# Override bind address
|
|
603
|
-
BIND=127.0.0.1 sshift
|
|
604
|
-
|
|
605
|
-
# Development mode
|
|
606
|
-
NODE_ENV=development sshift
|
|
607
|
-
```
|
|
608
|
-
|
|
609
|
-
#### Port Priority
|
|
610
|
-
|
|
611
|
-
SSHIFT uses the following priority for determining the port:
|
|
612
|
-
|
|
613
|
-
1. `--port` CLI argument (highest priority)
|
|
614
|
-
2. `PORT` environment variable
|
|
615
|
-
3. `config.json` `port`/`devPort` based on `NODE_ENV`
|
|
616
|
-
4. Default: 8022 (production), 3000 (development)
|
|
617
|
-
|
|
618
|
-
### Installer Scripts
|
|
619
|
-
|
|
620
|
-
The installer scripts also support various commands:
|
|
621
|
-
|
|
622
|
-
#### Linux/macOS (install.sh)
|
|
623
|
-
|
|
624
|
-
```bash
|
|
625
|
-
# Install with custom options
|
|
626
|
-
./install.sh --install-dir /opt/sshift --port 8080
|
|
627
|
-
|
|
628
|
-
# Update existing installation
|
|
629
|
-
./install.sh --update
|
|
630
|
-
|
|
631
|
-
# Start sshift
|
|
632
|
-
./install.sh --start
|
|
633
|
-
|
|
634
|
-
# Stop sshift
|
|
635
|
-
./install.sh --stop
|
|
636
|
-
|
|
637
|
-
# Restart sshift
|
|
638
|
-
./install.sh --restart
|
|
639
|
-
|
|
640
|
-
# Check if sshift is running
|
|
641
|
-
./install.sh --status
|
|
642
|
-
|
|
643
|
-
# Uninstall sshift
|
|
644
|
-
./install.sh --uninstall
|
|
645
|
-
|
|
646
|
-
# Show help
|
|
647
|
-
./install.sh --help
|
|
648
|
-
```
|
|
649
|
-
|
|
650
|
-
#### Windows (install.ps1)
|
|
651
|
-
|
|
652
|
-
```powershell
|
|
653
|
-
# Install with custom options
|
|
654
|
-
.\install.ps1 -InstallDir "C:\sshift" -Port 8080
|
|
655
|
-
|
|
656
|
-
# Update existing installation
|
|
657
|
-
.\install.ps1 -Update
|
|
658
|
-
|
|
659
|
-
# Start sshift
|
|
660
|
-
.\install.ps1 -Start
|
|
107
|
+
SSHIFT uses a priority-based configuration system:
|
|
661
108
|
|
|
662
|
-
|
|
663
|
-
|
|
109
|
+
1. Environment variables (`PORT`, `BIND`)
|
|
110
|
+
2. `.env/.env.local` - User-specific private config
|
|
111
|
+
3. `.env/config.json` - User-specific application config
|
|
112
|
+
4. `config.json` - Default application config
|
|
664
113
|
|
|
665
|
-
|
|
666
|
-
.\install.ps1 -Restart
|
|
667
|
-
|
|
668
|
-
# Check if sshift is running
|
|
669
|
-
.\install.ps1 -Status
|
|
670
|
-
|
|
671
|
-
# Uninstall sshift
|
|
672
|
-
.\install.ps1 -Uninstall
|
|
673
|
-
|
|
674
|
-
# Show help
|
|
675
|
-
.\install.ps1 -Help
|
|
676
|
-
```
|
|
677
|
-
|
|
678
|
-
### SSH Connection
|
|
679
|
-
|
|
680
|
-
1. Click the **"SSH"** button in the header
|
|
681
|
-
2. Enter connection details:
|
|
682
|
-
- **Host** (hostname or IP address)
|
|
683
|
-
- **Port** (default: 22)
|
|
684
|
-
- **Username**
|
|
685
|
-
- **Password** or **Private Key**
|
|
686
|
-
3. Click **"Connect"**
|
|
687
|
-
|
|
688
|
-
### SFTP Connection
|
|
689
|
-
|
|
690
|
-
1. Click the **"SFTP"** button in the header
|
|
691
|
-
2. Enter connection details (same as SSH)
|
|
692
|
-
3. Use the file browser to:
|
|
693
|
-
- **Navigate** directories (double-click)
|
|
694
|
-
- **Download files** (click on file)
|
|
695
|
-
- **Upload files** (upload button)
|
|
696
|
-
- **Create directories** (folder button)
|
|
697
|
-
- **Delete** files/folders (trash icon)
|
|
698
|
-
|
|
699
|
-
### Bookmarks
|
|
700
|
-
|
|
701
|
-
1. Click the **"+"** button in the sidebar
|
|
702
|
-
2. Enter bookmark details
|
|
703
|
-
3. Click **"Save"**
|
|
704
|
-
4. Click on a bookmark to quick-connect
|
|
705
|
-
|
|
706
|
-
### Special Keys (Mobile)
|
|
707
|
-
|
|
708
|
-
- Click the **keyboard icon** in the tabs bar
|
|
709
|
-
- On mobile, **tap on a tab** to show special keys
|
|
710
|
-
- Click any key to send it to the active session
|
|
711
|
-
|
|
712
|
-
## 🔒 Security & Multi-User Setup
|
|
713
|
-
|
|
714
|
-
### ⚠️ Important Security Notes
|
|
715
|
-
|
|
716
|
-
**SSHIFT is designed for single-user or trusted environments.** It does NOT include built-in authentication or multi-user support.
|
|
717
|
-
|
|
718
|
-
### Single User / Trusted Environment
|
|
719
|
-
|
|
720
|
-
For personal use or trusted networks:
|
|
721
|
-
- Run on `localhost` only (default)
|
|
722
|
-
- Use behind a firewall
|
|
723
|
-
- No additional setup needed
|
|
724
|
-
|
|
725
|
-
### Multi-User or Production Deployment
|
|
726
|
-
|
|
727
|
-
**If you need multi-user access or authentication, you MUST use a reverse proxy with authentication.**
|
|
728
|
-
|
|
729
|
-
Recommended authentication solutions:
|
|
730
|
-
- **Nginx + HTTP Basic Auth** - Simple password protection
|
|
731
|
-
- **Authelia** - Full-featured SSO with 2FA/MFA support
|
|
732
|
-
- **Cloudflare Access** - Zero-trust authentication (no server config needed)
|
|
733
|
-
- **OAuth2 Proxy** - Google, GitHub, or other OAuth providers
|
|
734
|
-
- **Keycloak** - Enterprise SSO solution
|
|
735
|
-
|
|
736
|
-
For detailed setup instructions, see the documentation of your chosen authentication solution.
|
|
737
|
-
|
|
738
|
-
### Production Checklist
|
|
739
|
-
|
|
740
|
-
- [ ] Use **HTTPS/WSS** (SSL/TLS required)
|
|
741
|
-
- [ ] Configure **reverse proxy** with authentication
|
|
742
|
-
- [ ] Set up **firewall rules** (limit access by IP)
|
|
743
|
-
- [ ] Use **strong passwords** for SSH connections
|
|
744
|
-
- [ ] Consider **SSH key authentication** instead of passwords
|
|
745
|
-
- [ ] Enable **rate limiting** in your reverse proxy
|
|
746
|
-
- [ ] Set up **logging** and monitoring
|
|
747
|
-
- [ ] Keep **Node.js** and dependencies updated
|
|
748
|
-
|
|
749
|
-
## 🧪 Testing
|
|
750
|
-
|
|
751
|
-
SSHIFT includes comprehensive test suites for SSH, SFTP, and browser UI functionality.
|
|
752
|
-
|
|
753
|
-
### Test Prerequisites
|
|
754
|
-
|
|
755
|
-
#### 1. Environment Configuration
|
|
756
|
-
|
|
757
|
-
Tests use environment variables from `.env` files (see Configuration section).
|
|
758
|
-
|
|
759
|
-
```bash
|
|
760
|
-
# Create test environment file
|
|
761
|
-
cp .env/config.json.example .env/config.json
|
|
762
|
-
|
|
763
|
-
# Edit with your test server credentials
|
|
764
|
-
nano .env/.env.local
|
|
765
|
-
```
|
|
766
|
-
|
|
767
|
-
Add your SSH test credentials:
|
|
768
|
-
```env
|
|
769
|
-
# SSH Test Credentials
|
|
770
|
-
SSH_HOST=192.168.1.100
|
|
771
|
-
SSH_PORT=22
|
|
772
|
-
SSH_USER=myuser
|
|
773
|
-
SSH_PASS=mypassword
|
|
774
|
-
|
|
775
|
-
# Or use TEST_* variables
|
|
776
|
-
TEST_HOST=192.168.1.100
|
|
777
|
-
TEST_PORT=22
|
|
778
|
-
TEST_USER=testuser
|
|
779
|
-
TEST_PASS=testpassword
|
|
780
|
-
```
|
|
781
|
-
|
|
782
|
-
#### 2. Browser Testing Setup (Puppeteer)
|
|
783
|
-
|
|
784
|
-
Browser tests require Chrome/Chromium and system dependencies:
|
|
785
|
-
|
|
786
|
-
**Linux (Debian/Ubuntu):**
|
|
787
|
-
```bash
|
|
788
|
-
# Install Chrome dependencies
|
|
789
|
-
sudo apt-get update
|
|
790
|
-
sudo apt-get install -y \
|
|
791
|
-
libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 \
|
|
792
|
-
libcups2 libdrm2 libxkbcommon0 libxcomposite1 \
|
|
793
|
-
libxdamage1 libxfixes3 libxrandr2 libgbm1 \
|
|
794
|
-
libasound2 libpango-1.0-0 libcairo2
|
|
795
|
-
|
|
796
|
-
# Install Chrome for Puppeteer
|
|
797
|
-
npx puppeteer browsers install chrome
|
|
798
|
-
```
|
|
799
|
-
|
|
800
|
-
**macOS:**
|
|
801
|
-
```bash
|
|
802
|
-
# Chrome is typically already installed
|
|
803
|
-
# If not, install Chrome or run:
|
|
804
|
-
npx puppeteer browsers install chrome
|
|
805
|
-
```
|
|
806
|
-
|
|
807
|
-
**Windows:**
|
|
808
|
-
```powershell
|
|
809
|
-
# Chrome is typically already installed
|
|
810
|
-
# If not, install Chrome or run:
|
|
811
|
-
npx puppeteer browsers install chrome
|
|
812
|
-
```
|
|
813
|
-
|
|
814
|
-
### Running Tests
|
|
815
|
-
|
|
816
|
-
#### Important: Test Requirements
|
|
817
|
-
|
|
818
|
-
**Unit tests** run without any prerequisites.
|
|
819
|
-
|
|
820
|
-
**Integration and Browser tests** require a running server:
|
|
821
|
-
```bash
|
|
822
|
-
# Terminal 1: Start development server
|
|
823
|
-
npm run dev
|
|
824
|
-
|
|
825
|
-
# Terminal 2: Run tests
|
|
826
|
-
npm test
|
|
827
|
-
```
|
|
828
|
-
|
|
829
|
-
#### Run All Tests
|
|
830
|
-
|
|
831
|
-
```bash
|
|
832
|
-
# Run all test suites (requires running server for integration/browser tests)
|
|
833
|
-
npm test
|
|
834
|
-
|
|
835
|
-
# Run with verbose output
|
|
836
|
-
npm test -- --verbose
|
|
837
|
-
|
|
838
|
-
# Run with debug output
|
|
839
|
-
DEBUG=* npm test
|
|
840
|
-
```
|
|
841
|
-
|
|
842
|
-
#### Run Specific Test Suites
|
|
843
|
-
|
|
844
|
-
```bash
|
|
845
|
-
# Unit tests only (no server required)
|
|
846
|
-
npm run test:unit
|
|
847
|
-
|
|
848
|
-
# Integration tests only (requires running server)
|
|
849
|
-
npm run test:integration
|
|
850
|
-
|
|
851
|
-
# Browser/UI tests only (requires running server)
|
|
852
|
-
npm run test:browser
|
|
853
|
-
|
|
854
|
-
# Alternative: Run specific test paths
|
|
855
|
-
npm test -- tests/unit/
|
|
856
|
-
npm test -- tests/integration/
|
|
857
|
-
npm test -- tests/browser/
|
|
858
|
-
|
|
859
|
-
# Specific test file
|
|
860
|
-
npm test -- tests/browser/ui.test.js
|
|
861
|
-
|
|
862
|
-
# Run tests matching a pattern
|
|
863
|
-
npm test -- --testNamePattern="should load"
|
|
864
|
-
```
|
|
865
|
-
|
|
866
|
-
#### Quick Test Commands
|
|
867
|
-
|
|
868
|
-
```bash
|
|
869
|
-
# Run only unit tests (fast, no server needed)
|
|
870
|
-
npm run test:unit
|
|
871
|
-
|
|
872
|
-
# Run integration tests (requires: npm run dev in another terminal)
|
|
873
|
-
npm run test:integration
|
|
874
|
-
|
|
875
|
-
# Run browser tests (requires: npm run dev in another terminal)
|
|
876
|
-
npm run test:browser
|
|
877
|
-
```
|
|
878
|
-
|
|
879
|
-
### Test Suites
|
|
880
|
-
|
|
881
|
-
#### Unit Tests (`tests/unit/`)
|
|
882
|
-
- Test individual components in isolation
|
|
883
|
-
- Fast execution, no external dependencies
|
|
884
|
-
- Mock SSH connections and file operations
|
|
885
|
-
|
|
886
|
-
#### Integration Tests (`tests/integration/`)
|
|
887
|
-
- Test component interactions
|
|
888
|
-
- Require actual SSH server connection
|
|
889
|
-
- Test Socket.IO communication
|
|
890
|
-
- Test REST API endpoints
|
|
891
|
-
|
|
892
|
-
#### Browser Tests (`tests/browser/`)
|
|
893
|
-
- Test UI functionality with Puppeteer
|
|
894
|
-
- Test page loading and rendering
|
|
895
|
-
- Test user interactions (modals, forms)
|
|
896
|
-
- Test WebSocket connections
|
|
897
|
-
- **Requirements**: Chrome/Chromium with system dependencies
|
|
898
|
-
|
|
899
|
-
### Test Files
|
|
900
|
-
|
|
901
|
-
#### Core Test Files
|
|
902
|
-
- `tests/unit/ssh.test.js` - SSH connection unit tests
|
|
903
|
-
- `tests/unit/sftp.test.js` - SFTP operations unit tests
|
|
904
|
-
- `tests/integration/socket.test.js` - Socket.IO integration tests
|
|
905
|
-
- `tests/browser/ui.test.js` - Browser UI tests
|
|
906
|
-
- `tests/browser/console.test.js` - Console error detection
|
|
907
|
-
- `tests/browser/settings-modal.test.js` - Settings modal tests
|
|
908
|
-
|
|
909
|
-
#### Test Utilities
|
|
910
|
-
- `tests/helpers/test-utils.js` - Test utilities and helpers
|
|
911
|
-
- `tests/setup.js` - Jest setup configuration
|
|
912
|
-
|
|
913
|
-
### Continuous Integration
|
|
914
|
-
|
|
915
|
-
For CI/CD pipelines, ensure:
|
|
916
|
-
|
|
917
|
-
1. **Environment variables** are set in CI config
|
|
918
|
-
2. **Chrome dependencies** are installed
|
|
919
|
-
3. **Test server** is running for integration tests
|
|
920
|
-
|
|
921
|
-
**Example GitHub Actions:**
|
|
922
|
-
```yaml
|
|
923
|
-
- name: Install Chrome dependencies
|
|
924
|
-
run: |
|
|
925
|
-
sudo apt-get update
|
|
926
|
-
sudo apt-get install -y \
|
|
927
|
-
libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 \
|
|
928
|
-
libcups2 libdrm2 libxkbcommon0 libxcomposite1 \
|
|
929
|
-
libxdamage1 libxfixes3 libxrandr2 libgbm1 \
|
|
930
|
-
libasound2 libpango-1.0-0 libcairo2
|
|
931
|
-
|
|
932
|
-
- name: Install Chrome for Puppeteer
|
|
933
|
-
run: npx puppeteer browsers install chrome
|
|
934
|
-
|
|
935
|
-
- name: Run tests
|
|
936
|
-
run: npm test
|
|
937
|
-
```
|
|
938
|
-
|
|
939
|
-
### Troubleshooting Tests
|
|
940
|
-
|
|
941
|
-
#### Tests Hang or Timeout
|
|
942
|
-
|
|
943
|
-
**Problem**: Tests hang indefinitely or timeout
|
|
944
|
-
|
|
945
|
-
**Cause**: Integration and browser tests require a running development server
|
|
946
|
-
|
|
947
|
-
**Solution**: Start the development server before running tests:
|
|
948
|
-
```bash
|
|
949
|
-
# Terminal 1: Start server
|
|
950
|
-
npm run dev
|
|
951
|
-
|
|
952
|
-
# Terminal 2: Run tests
|
|
953
|
-
npm test
|
|
954
|
-
|
|
955
|
-
# Or run only unit tests (no server needed)
|
|
956
|
-
npm run test:unit
|
|
957
|
-
```
|
|
958
|
-
|
|
959
|
-
#### Browser Tests Fail with "Code: 127"
|
|
960
|
-
|
|
961
|
-
**Problem**: Chrome fails to launch with error code 127
|
|
962
|
-
|
|
963
|
-
**Solution**: Install Chrome dependencies:
|
|
964
|
-
```bash
|
|
965
|
-
# Linux (Debian/Ubuntu)
|
|
966
|
-
sudo apt-get install -y libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 \
|
|
967
|
-
libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 \
|
|
968
|
-
libxrandr2 libgbm1 libasound2 libpango-1.0-0 libcairo2
|
|
969
|
-
|
|
970
|
-
# Install Chrome for Puppeteer
|
|
971
|
-
npx puppeteer browsers install chrome
|
|
972
|
-
```
|
|
973
|
-
|
|
974
|
-
#### Tests Fail with "waitForTimeout is not a function"
|
|
975
|
-
|
|
976
|
-
**Problem**: Puppeteer v21+ removed `page.waitForTimeout()`
|
|
977
|
-
|
|
978
|
-
**Solution**: The codebase uses the `sleep()` utility function from `tests/helpers/test-utils.js`. If you see this error, ensure you're using the latest test files.
|
|
979
|
-
|
|
980
|
-
#### SSH Connection Tests Fail
|
|
981
|
-
|
|
982
|
-
**Problem**: Cannot connect to SSH server
|
|
983
|
-
|
|
984
|
-
**Solutions**:
|
|
985
|
-
1. Verify SSH credentials in `.env/.env.local`
|
|
986
|
-
2. Ensure SSH server is running and accessible
|
|
987
|
-
3. Check firewall rules allow SSH connections
|
|
988
|
-
4. Verify SSH server supports password authentication
|
|
989
|
-
|
|
990
|
-
#### Browser Tests Timeout
|
|
991
|
-
|
|
992
|
-
**Problem**: Tests timeout waiting for page load
|
|
993
|
-
|
|
994
|
-
**Solutions**:
|
|
995
|
-
1. Increase Jest timeout: `jest.setTimeout(60000)`
|
|
996
|
-
2. Ensure development server is running on correct port
|
|
997
|
-
3. Check `SERVER_URL` environment variable matches server
|
|
998
|
-
|
|
999
|
-
#### Module Not Found Errors
|
|
1000
|
-
|
|
1001
|
-
**Problem**: Test files can't find modules
|
|
1002
|
-
|
|
1003
|
-
**Solution**: Install dependencies:
|
|
1004
|
-
```bash
|
|
1005
|
-
npm install
|
|
1006
|
-
```
|
|
1007
|
-
|
|
1008
|
-
### Test Coverage
|
|
1009
|
-
|
|
1010
|
-
Generate test coverage reports:
|
|
1011
|
-
|
|
1012
|
-
```bash
|
|
1013
|
-
# Run tests with coverage
|
|
1014
|
-
npm test -- --coverage
|
|
1015
|
-
|
|
1016
|
-
# View coverage report
|
|
1017
|
-
open coverage/lcov-report/index.html
|
|
1018
|
-
```
|
|
114
|
+
See [Configuration](docs/configuration.md) for details.
|
|
1019
115
|
|
|
1020
116
|
## 🛠️ Technology Stack
|
|
1021
117
|
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
- **Socket.IO** - WebSocket communication
|
|
1026
|
-
- **ssh2** - SSH2 client and server modules
|
|
1027
|
-
|
|
1028
|
-
### Frontend
|
|
1029
|
-
- **xterm.js** - Terminal emulator
|
|
1030
|
-
- **xterm-addon-fit** - Terminal resizing
|
|
1031
|
-
- **xterm-addon-web-links** - Clickable links
|
|
1032
|
-
- **xterm-addon-search** - Search in terminal
|
|
1033
|
-
|
|
1034
|
-
### Development
|
|
1035
|
-
- **ESLint** - Code linting
|
|
1036
|
-
- **Puppeteer** - Browser testing
|
|
1037
|
-
|
|
1038
|
-
## 📝 API Reference
|
|
1039
|
-
|
|
1040
|
-
### Socket.IO Events
|
|
1041
|
-
|
|
1042
|
-
#### Client → Server
|
|
1043
|
-
|
|
1044
|
-
```javascript
|
|
1045
|
-
// SSH Connection
|
|
1046
|
-
socket.emit('ssh-connect', {
|
|
1047
|
-
sessionId: 'unique-session-id',
|
|
1048
|
-
host: 'example.com',
|
|
1049
|
-
port: 22,
|
|
1050
|
-
username: 'user',
|
|
1051
|
-
password: 'pass',
|
|
1052
|
-
cols: 80,
|
|
1053
|
-
rows: 24
|
|
1054
|
-
});
|
|
1055
|
-
|
|
1056
|
-
// SSH Data
|
|
1057
|
-
socket.emit('ssh-data', {
|
|
1058
|
-
sessionId: 'session-id',
|
|
1059
|
-
data: 'ls -la\n'
|
|
1060
|
-
});
|
|
1061
|
-
|
|
1062
|
-
// SSH Resize
|
|
1063
|
-
socket.emit('ssh-resize', {
|
|
1064
|
-
sessionId: 'session-id',
|
|
1065
|
-
cols: 120,
|
|
1066
|
-
rows: 40
|
|
1067
|
-
});
|
|
1068
|
-
|
|
1069
|
-
// SSH Disconnect
|
|
1070
|
-
socket.emit('ssh-disconnect', {
|
|
1071
|
-
sessionId: 'session-id'
|
|
1072
|
-
});
|
|
1073
|
-
|
|
1074
|
-
// SFTP Connection
|
|
1075
|
-
socket.emit('sftp-connect', {
|
|
1076
|
-
sessionId: 'unique-session-id',
|
|
1077
|
-
host: 'example.com',
|
|
1078
|
-
port: 22,
|
|
1079
|
-
username: 'user',
|
|
1080
|
-
password: 'pass'
|
|
1081
|
-
});
|
|
1082
|
-
|
|
1083
|
-
// SFTP List Directory
|
|
1084
|
-
socket.emit('sftp-list', {
|
|
1085
|
-
sessionId: 'session-id',
|
|
1086
|
-
path: '/home/user'
|
|
1087
|
-
});
|
|
1088
|
-
```
|
|
1089
|
-
|
|
1090
|
-
#### Server → Client
|
|
1091
|
-
|
|
1092
|
-
```javascript
|
|
1093
|
-
// SSH Connected
|
|
1094
|
-
socket.on('ssh-connected', (data) => {
|
|
1095
|
-
console.log('Session ID:', data.sessionId);
|
|
1096
|
-
});
|
|
1097
|
-
|
|
1098
|
-
// SSH Data
|
|
1099
|
-
socket.on('ssh-data', (data) => {
|
|
1100
|
-
console.log('Output:', data.data);
|
|
1101
|
-
});
|
|
1102
|
-
|
|
1103
|
-
// SSH Error
|
|
1104
|
-
socket.on('ssh-error', (data) => {
|
|
1105
|
-
console.error('Error:', data.message);
|
|
1106
|
-
});
|
|
1107
|
-
|
|
1108
|
-
// SFTP Connected
|
|
1109
|
-
socket.on('sftp-connected', (data) => {
|
|
1110
|
-
console.log('SFTP Session ID:', data.sessionId);
|
|
1111
|
-
});
|
|
1112
|
-
|
|
1113
|
-
// SFTP List Result
|
|
1114
|
-
socket.on('sftp-list-result', (data) => {
|
|
1115
|
-
console.log('Files:', data.files);
|
|
1116
|
-
});
|
|
1117
|
-
```
|
|
118
|
+
**Backend:** Node.js, Express, Socket.IO, ssh2
|
|
119
|
+
**Frontend:** xterm.js, xterm addons
|
|
120
|
+
**Development:** ESLint, Puppeteer
|
|
1118
121
|
|
|
1119
122
|
## 🤝 Contributing
|
|
1120
123
|
|
|
1121
|
-
Contributions are welcome!
|
|
1122
|
-
|
|
1123
|
-
1. Fork the repository
|
|
1124
|
-
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
1125
|
-
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
1126
|
-
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
1127
|
-
5. Open a Pull Request
|
|
124
|
+
Contributions are welcome! See [Contributing](docs/contributing.md) for guidelines.
|
|
1128
125
|
|
|
1129
126
|
## 📄 License
|
|
1130
127
|
|
|
1131
|
-
|
|
128
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
1132
129
|
|
|
1133
130
|
## 🙏 Acknowledgments
|
|
1134
131
|
|
|
@@ -1138,9 +135,9 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
1138
135
|
|
|
1139
136
|
## 📞 Support
|
|
1140
137
|
|
|
1141
|
-
- **Issues**: [GitHub Issues](https://github.com/
|
|
1142
|
-
- **Discussions**: [GitHub Discussions](https://github.com/
|
|
138
|
+
- **Issues**: [GitHub Issues](https://github.com/lethevimlet/sshift/issues)
|
|
139
|
+
- **Discussions**: [GitHub Discussions](https://github.com/lethevimlet/sshift/discussions)
|
|
1143
140
|
|
|
1144
141
|
---
|
|
1145
142
|
|
|
1146
|
-
**Made with ❤️ by the SSHIFT Team**
|
|
143
|
+
**Made with ❤️ by the SSHIFT Team**
|