webssh2_client 1.0.0 → 2.0.0-alpha.10

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 CHANGED
@@ -1,223 +1,469 @@
1
1
  # WebSSH2 Client - Web SSH Client
2
2
 
3
+ [![CI](https://github.com/billchurch/webssh2_client/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/billchurch/webssh2_client/actions/workflows/ci.yml)
4
+ [![Release](https://github.com/billchurch/webssh2_client/actions/workflows/release.yml/badge.svg?branch=main)](https://github.com/billchurch/webssh2_client/actions/workflows/release.yml)
5
+
3
6
  ![Orthrus Mascot](images/orthrus.png)
4
7
 
5
- WebSSH2 Client is an HTML5 web-based terminal emulator and SSH client. It uses WebSockets to communicate with a WebSSH2 server, which in turn uses SSH2 to connect to SSH servers.
8
+ WebSSH2 Client is an HTML5 web-based terminal emulator and SSH client component. It uses WebSockets to communicate with a WebSSH2 server, which in turn uses SSH2 to connect to SSH servers.
6
9
 
7
10
  ![WebSSH2 demo](https://user-images.githubusercontent.com/1668075/182425293-acc8741e-cc92-4105-afdc-9538e1685d4b.gif)
8
11
 
9
- # EXPERIMENTAL
10
- The current status is experimental, and this first version is a refactor of webssh2 v0.2.x to be compatible with a refactor of the same version of webssh2 as a stand-alone server-side component running Node.js v6.9.1.
11
-
12
- The intention is to harmonize the latest release of webssh2 by splitting out the client and server as separate repos (webssh2-client and webssh2-server) but joining them both together as modules in a parent webssh2 in an attempt to provide backward compatibility.
12
+ # Important Notice
13
13
 
14
- The main idea behind bifurcating the client/server is to make it easier to customize the client to work in other frameworks and use cases.
14
+ This package contains only the browser-side client component of WebSSH2. It requires a compatible WebSSH2 server to function. The server component is available at [webssh2 server](https://github.com/billchurch/webssh2/tree/bigip-server). This package is intended for advanced users who want to customize or integrate the client component independently.
15
15
 
16
- ## Table of Contents
16
+ # Status
17
17
 
18
- - [Requirements](#requirements)
19
- - [Installation](#installation)
20
- - [Usage](#usage)
21
- - [Configuration](#configuration)
22
- - [Features](#features)
23
- - [Routes](#routes)
24
- - [Development](#development)
25
- - [Advanced Configuration](#advanced-configuration)
26
- - [Support](#support)
27
- - [License](#license)
28
- - [Acknowledgments](#acknowledgments)
18
+ This is an experimental refactor of the WebSSH2 v0.2.x client to function as a standalone component. It has been separated from the server-side code to facilitate customization and integration with different frameworks.
29
19
 
30
20
  ## Requirements
31
21
 
32
22
  - Modern web browser with JavaScript enabled
33
- - WebSSH2 server (see server README for setup instructions)
23
+ - Compatible WebSSH2 server instance (v0.2.x or compatible)
24
+ - Socket.IO v2.2.0 compatibility (due to server requirements)
34
25
 
35
26
  ## Installation
36
27
 
37
28
  1. Clone the repository:
29
+
38
30
  ```
39
31
  git clone https://github.com/billchurch/webssh2_client.git
40
32
  cd webssh2_client
41
33
  ```
42
34
 
43
35
  2. Install dependencies:
36
+
44
37
  ```
45
38
  npm install
46
39
  ```
47
40
 
48
41
  3. Build the client:
42
+
49
43
  ```
50
44
  npm run build
51
45
  ```
52
46
 
53
47
  4. The built client files will be in the `client/public` directory.
54
48
 
55
- ## Usage
49
+ ## Server Requirements
56
50
 
57
- 1. Set up and start the WebSSH2 server (see server README for instructions).
51
+ The WebSSH2 client requires a compatible server that provides:
58
52
 
59
- 2. Access the web client by navigating to the server's URL, typically:
60
- ```
61
- http://localhost:2222/ssh
62
- ```
53
+ - WebSocket endpoint for SSH communication
54
+ - Authentication handling
55
+ - SSH connection management
56
+ - Socket.IO v2.2.0 compatibility
57
+
58
+ For server setup instructions, refer to the [WebSSH2 server documentation](https://github.com/billchurch/webssh2/tree/bigip-server).
59
+
60
+ ## Client Features
63
61
 
64
- 3. You'll be prompted for host details and SSH credentials.
62
+ - Web-based SSH client with xterm.js terminal emulation
63
+ - **Terminal Search Functionality:**
64
+ - Real-time search with live match highlighting
65
+ - Case-sensitive and regex search options
66
+ - Whole word matching
67
+ - Match counter (current/total)
68
+ - OS-aware keyboard shortcuts (Ctrl+F on Windows/Linux, ⌘F on macOS)
69
+ - Navigation with Enter/Shift+Enter or arrow buttons
70
+ - F3/Shift+F3 for quick match navigation
71
+ - **Advanced Clipboard Integration:**
72
+ - Auto-copy on selection (similar to terminals like tmux or PuTTY, configurable)
73
+ - Middle-click paste support (configurable)
74
+ - Keyboard shortcuts: Ctrl+Shift+C/V (Windows/Linux) or Cmd+Shift+C/V (macOS)
75
+ - Browser compatibility detection with fallback mechanisms
76
+ - Visual feedback with toast notifications
77
+ - All features can be toggled in Terminal Settings
78
+ - Customizable terminal settings:
79
+ - Font size and family
80
+ - Color schemes
81
+ - Cursor behavior
82
+ - Scrollback buffer size
83
+ - Clipboard behavior controls
84
+ - Session logging with download capability
85
+ - Copy and paste functionality
86
+ - Terminal mouse support
87
+ - Keyboard shortcuts
88
+ - Responsive design
89
+ - Multi-factor authentication support (when supported by server)
90
+ - Support for credential replay and reauthentication
91
+
92
+ ## Security and Lint Rules
93
+
94
+ - No innerHTML: The client never uses `innerHTML` for user content. All text uses `textContent` and safe DOM building helpers.
95
+ - CSP: Strict `script-src 'self'` (no inline scripts). Inline styles allowed for xterm DOM renderer and safe color updates.
96
+ - ESLint guardrails:
97
+ - `no-unsanitized` plugin blocks unsanitized DOM sinks (`innerHTML`, `outerHTML`, `insertAdjacentHTML`, `document.write`).
98
+ - Additional bans via `no-restricted-properties` for those sinks, and `no-restricted-syntax` for string-based timers and `new Function`.
99
+ - Xterm integration: Terminal output is rendered with `xterm.write()`; no HTML rendering of remote data.
65
100
 
66
101
  ## Configuration
67
102
 
68
- The client can be configured using URL parameters or through the config file on the server. Some configurable options include:
103
+ The client can be configured through:
104
+
105
+ 1. URL parameters
106
+ 2. Configuration object
107
+ 3. User interface settings
69
108
 
109
+ ### URL Parameters
110
+
111
+ Supported URL parameters include:
112
+
113
+ - `host` - SSH server hostname
70
114
  - `port` - SSH server port (default: 22)
71
115
  - `header` - Optional header text
72
- - `headerBackground` - Optional header background color
73
- - `sshterm` - Terminal type for pty (default: xterm-color)
116
+ - `headerStyle` - Complete header styling with Tailwind CSS classes or CSS (recommended)
117
+ - `headerBackground` - Header background styling only (legacy, see Advanced Header Styling below)
118
+ - `sshterm` - Terminal type (default: xterm-color)
74
119
 
75
- For a full list of configuration options, refer to the server README.
120
+ #### Advanced Header Styling
76
121
 
77
- ## Features
122
+ WebSSH2 Client supports comprehensive header styling through two approaches: **enhanced headerStyle** (recommended) and **legacy headerBackground** (maintained for backward compatibility).
78
123
 
79
- - Web-based SSH client with xterm.js terminal emulation
80
- - Supports various SSH authentication methods (password and keyboard-interactive)
81
- - Customizable terminal settings (font size, font family, colors, etc.)
82
- - Session logging with download option
83
- - Support for reauthentication and credential replay
84
- - Responsive design for various screen sizes
85
- - Keyboard shortcuts support
86
- - Terminal Mouse support
87
- - Copy and paste functionality
88
- - Multi-factor authentication support
89
- - CORS support for flexible server setups
124
+ ##### Enhanced Header Styling (headerStyle)
90
125
 
91
- ## Routes
126
+ The `headerStyle` parameter provides complete control over header appearance using Tailwind CSS classes or CSS properties:
92
127
 
93
- The WebSSH2 Server (not provided by this package) provides two main routes:
128
+ **Basic Examples:**
94
129
 
95
- ### 1. `/ssh`
130
+ ```
131
+ # Enhanced background with custom height and text
132
+ ?header=Production&headerStyle=bg-red-600%20h-10%20text-xl%20font-bold
96
133
 
97
- - Interactive login form
98
- - Terminal configuration options
134
+ # Gradient with custom styling
135
+ ?header=Staging&headerStyle=bg-gradient-to-r%20from-blue-500%20to-purple-500%20h-8%20text-lg
99
136
 
100
- ### 2. `/ssh/host/:host`
137
+ # Custom text colors and shadows
138
+ ?header=Development&headerStyle=bg-green-500%20text-black%20font-semibold%20shadow-lg
139
+ ```
101
140
 
102
- - Quick connections to specific hosts
103
- - Optional `port` parameter (e.g., `?port=2222`)
104
- - HTTP Basic Authentication for credentials
141
+ **Advanced Styling Capabilities:**
105
142
 
106
- ## Development
143
+ **Backgrounds & Gradients:**
107
144
 
108
- - To add custom JavaScript, modify `./src/client.htm`, `./src/index.js`, or add your file to `webpack.*.js`.
109
- - For security, use HTTPS when transmitting credentials via HTTP Basic Auth.
110
- - Terminal settings can be customized after login via `Menu | Settings` and persist across sessions.
111
- - Debug mode can be enabled by setting the `DEBUG` environment variable.
145
+ ```
146
+ # Multi-directional gradients
147
+ ?headerStyle=bg-gradient-to-br%20from-purple-600%20via-pink-500%20to-yellow-400%20h-12
112
148
 
113
- ## Advanced Configuration
149
+ # Solid colors with transparency
150
+ ?headerStyle=bg-blue-500%20h-8%20shadow-blue-500/50
114
151
 
115
- In the client HTML file, you'll find this script tag:
152
+ # Complex gradient patterns
153
+ ?headerStyle=bg-gradient-to-r%20from-red-500%20via-yellow-500%20to-green-500%20h-10
154
+ ```
155
+
156
+ **Typography & Layout:**
116
157
 
117
- ```html
118
- <script>
119
- window.webssh2Config = null;
120
- </script>
121
158
  ```
159
+ # Large headers with custom fonts
160
+ ?headerStyle=bg-slate-700%20h-16%20text-3xl%20font-black%20flex%20items-center%20justify-center
122
161
 
123
- The WebSSH2 server replaces this null value with a configuration object. However, you can also set this manually to override server-provided settings or to configure the client when using it standalone.
162
+ # Compact headers
163
+ ?headerStyle=bg-indigo-600%20h-5%20text-xs%20font-medium
124
164
 
125
- ### Configuration Options
165
+ # Custom text alignment and colors
166
+ ?headerStyle=bg-gradient-to-r%20from-cyan-400%20to-blue-500%20text-left%20text-yellow-100%20px-4
167
+ ```
126
168
 
127
- Here's a comprehensive list of parameters that can be injected using `window.webssh2Config`:
169
+ **Borders & Effects:**
128
170
 
129
- ```javascript
130
- window.webssh2Config = {
131
- socket: {
132
- url: null, // WebSocket URL. If null, it will be automatically determined
133
- path: '/ssh/socket.io', // Socket.IO path
134
- },
135
- ssh: {
136
- host: null, // SSH server hostname (required for autoConnect)
137
- port: 22, // SSH server port
138
- username: null, // SSH username (required for autoConnect)
139
- password: null, // SSH password (required for autoConnect)
140
- sshterm: 'xterm-color', // Terminal type
141
- readyTimeout: 20000, // SSH connection timeout (ms)
142
- },
143
- header: {
144
- text: null, // Custom header text
145
- background: 'green', // Header background color
146
- },
147
- autoConnect: false // Whether to connect automatically
148
- };
171
+ ```
172
+ # Styled borders
173
+ ?headerStyle=bg-purple-500%20border-2%20border-white%20border-dashed%20h-8
174
+
175
+ # Shadow effects
176
+ ?headerStyle=bg-green-500%20shadow-xl%20shadow-green-500/50%20rounded-lg%20h-10
177
+
178
+ # Rounded corners
179
+ ?headerStyle=bg-gradient-to-r%20from-pink-400%20to-rose-500%20rounded-xl%20h-12%20mx-2
149
180
  ```
150
181
 
151
- ### Auto-Connect Functionality
182
+ **Animations:**
152
183
 
153
- The `autoConnect` option is used to create pre-configured connections:
184
+ ```
185
+ # Pulsing effect for alerts
186
+ ?headerStyle=bg-red-600%20animate-pulse%20h-8%20font-bold
154
187
 
155
- - When set to `true`, the client will attempt to connect immediately using the provided SSH configuration, bypassing the login form.
156
- - For `autoConnect` to work, you must provide at least the `host` in the SSH configuration.
157
- - `autoConnect` requires a username and password. If these are not provided, the server may use other methods (like basic auth or session data) to authenticate the connection.
158
- - If the host is missing when `autoConnect` is `true,` the login form will be shown instead.
188
+ # Bouncing for urgent notifications
189
+ ?headerStyle=bg-yellow-500%20animate-bounce%20h-10%20text-black%20font-semibold
190
+ ```
159
191
 
160
- Example usage:
192
+ **Production Examples:**
161
193
 
162
- ```javascript
163
- window.webssh2Config = {
164
- ssh: {
165
- host: 'example.com',
166
- port: 22,
167
- username: 'user', // Optional
168
- password: 'password' // Optional
169
- },
170
- autoConnect: true
171
- };
172
194
  ```
195
+ # Critical system warning
196
+ ?header=🚨%20PRODUCTION%20-%20CRITICAL%20🚨&headerStyle=bg-gradient-to-r%20from-red-600%20to-red-700%20h-12%20text-2xl%20font-bold%20animate-pulse%20shadow-lg
173
197
 
174
- This configuration will attempt to connect to `example.com` as soon as the page loads, using any provided credentials or relying on server-side authentication methods.
198
+ # Development environment
199
+ ?header=🛠️%20Development%20Environment&headerStyle=bg-gradient-to-r%20from-green-400%20to-emerald-600%20h-8%20text-white%20font-medium
175
200
 
176
- ### Security Considerations
201
+ # Staging deployment
202
+ ?header=🚀%20Staging%20Deployment&headerStyle=bg-gradient-to-r%20from-yellow-400%20to-orange-500%20h-10%20text-black%20font-semibold%20border-b-2%20border-orange-600
177
203
 
178
- The `autoConnect` feature only requires the host to be specified. The server handles authentication, which may use various methods, including basic auth or session data.
179
- - If you do include a username and password in the client-side configuration, be cautious, as this may pose security risks, especially in production environments.
180
- - For production use, consider using secure server-side authentication methods rather than including credentials in the client-side configuration.
181
- When `autoConnect` is not used, ensure your server is configured to prompt for or securely handle credentials as needed.
204
+ # Secure connection
205
+ ?header=🔐%20Encrypted%20Connection&headerStyle=bg-gradient-to-r%20from-emerald-500%20to-teal-600%20h-8%20text-white%20shadow-md
206
+ ```
182
207
 
183
- ### Customization Examples
208
+ ##### Legacy Header Styling (headerBackground)
184
209
 
185
- 1. Setting a custom header:
186
- ```javascript
187
- window.webssh2Config = {
188
- header: {
189
- text: 'My Custom SSH Client',
190
- background: '#007acc'
191
- }
192
- };
193
- ```
210
+ For backward compatibility, the original `headerBackground` parameter is still supported:
194
211
 
195
- 2. Configuring for a specific SSH server with auto-connect:
196
- ```javascript
197
- window.webssh2Config = {
198
- ssh: {
199
- host: 'myserver.example.com',
200
- port: 2222
201
- },
202
- autoConnect: true
203
- };
204
- ```
212
+ **Basic Colors:**
213
+
214
+ ```
215
+ ?header=Production&headerBackground=red
216
+ ?header=Custom&headerBackground=%23ff6b35
217
+ ```
218
+
219
+ **Tailwind Classes:**
220
+
221
+ ```
222
+ ?header=Server%20Alpha&headerBackground=bg-blue-500
223
+ ?header=Critical%20System&headerBackground=bg-red-600
224
+ ```
225
+
226
+ **Simple Gradients:**
205
227
 
206
- By leveraging these configuration options, you can customize the WebSSH2 client to suit your needs or integrate it seamlessly into your existing systems. Remember that the server handles authentication, providing flexibility in managing and securing credentials.
228
+ ```
229
+ ?header=Gradient%20Demo&headerBackground=bg-gradient-to-r%20from-blue-500%20to-purple-500
230
+ ```
231
+
232
+ ##### Header Styling Reference
233
+
234
+ **Essential Styling Categories:**
235
+
236
+ **🎨 Background Colors & Gradients**
237
+
238
+ ```
239
+ # Solid Colors
240
+ bg-red-500, bg-red-600, bg-blue-500, bg-blue-600, bg-green-500, bg-yellow-500
241
+ bg-purple-500, bg-pink-500, bg-indigo-500, bg-cyan-500, bg-emerald-500, bg-slate-700
242
+
243
+ # Gradients (All 8 Directions Available)
244
+ bg-gradient-to-r, bg-gradient-to-l, bg-gradient-to-t, bg-gradient-to-b
245
+ bg-gradient-to-tr, bg-gradient-to-tl, bg-gradient-to-br, bg-gradient-to-bl
246
+
247
+ # Color Ranges (from/to/via)
248
+ from-red-500 to from-red-700, from-blue-500 to from-blue-700
249
+ from-green-500 to from-green-700, from-yellow-400 to from-yellow-500
250
+ from-orange-400 to from-orange-500, from-purple-500 to from-purple-600
251
+ from-indigo-500 to from-indigo-600, from-pink-500 to from-pink-600
252
+ from-cyan-400 to from-cyan-500, from-emerald-500, from-teal-500, from-slate-700
253
+ via-yellow-500, via-pink-500, via-purple-500, via-blue-500
254
+ ```
255
+
256
+ **📝 Text Styling**
257
+
258
+ ```
259
+ # Sizes: text-xs, text-sm, text-base, text-lg, text-xl, text-2xl, text-3xl, text-4xl
260
+ # Weights: font-normal, font-medium, font-semibold, font-bold, font-black
261
+ # Colors: text-white, text-black, text-yellow-100, text-blue-100, text-red-100, text-green-100, text-gray-100
262
+ # Alignment: text-center, text-left
263
+
264
+ # Examples
265
+ text-2xl font-bold text-white
266
+ text-sm font-medium text-black
267
+ text-4xl font-black text-yellow-100
268
+ ```
269
+
270
+ **📏 Header Heights**
271
+
272
+ ```
273
+ # Available: h-4, h-5, h-6, h-7, h-8, h-10, h-12, h-14, h-16
274
+ # Default was h-6 (24px), now customizable
275
+
276
+ h-5 # Very compact header
277
+ h-8 # Compact header
278
+ h-12 # Standard header
279
+ h-16 # Prominent header
280
+ ```
281
+
282
+ **✨ Visual Effects**
283
+
284
+ ```
285
+ # Animations
286
+ animate-pulse # Pulsing effect for alerts
287
+ animate-bounce # Bouncing for urgent notifications
288
+
289
+ # Shadows
290
+ shadow, shadow-md, shadow-lg, shadow-xl
291
+
292
+ # Borders
293
+ border, border-2, border-4
294
+ border-red-500, border-blue-500, border-white
295
+ border-dashed, border-solid
296
+
297
+ # Border Radius
298
+ rounded, rounded-lg, rounded-xl
299
+ ```
300
+
301
+ **📍 Layout & Positioning**
302
+
303
+ ```
304
+ # Text Alignment
305
+ text-left, text-center
306
+
307
+ # Spacing (Padding)
308
+ px-2, px-4, px-6 (horizontal padding)
309
+ py-1, py-2, py-3 (vertical padding)
310
+
311
+ # Flexbox (for complex layouts)
312
+ flex items-center justify-center
313
+ ```
314
+
315
+ **Common Use Cases:**
316
+
317
+ **🚨 Production/Critical Systems:**
318
+
319
+ ```
320
+ # Red gradient with large text and pulsing animation
321
+ bg-gradient-to-r from-red-600 to-red-700 h-12 text-2xl font-bold animate-pulse
322
+
323
+ # Solid red with white border
324
+ bg-red-600 border-2 border-white h-10 text-xl font-bold
325
+ ```
326
+
327
+ **🚀 Staging/Development:**
328
+
329
+ ```
330
+ # Yellow-orange gradient for staging
331
+ bg-gradient-to-r from-yellow-400 to-orange-500 h-10 text-black font-semibold
332
+
333
+ # Green for development
334
+ bg-gradient-to-r from-green-400 to-emerald-600 h-8 text-white font-medium
335
+ ```
336
+
337
+ **🔒 Secure/Special Connections:**
338
+
339
+ ```
340
+ # Blue gradient with shadow
341
+ bg-gradient-to-r from-blue-500 to-cyan-500 h-8 shadow-lg
342
+
343
+ # Purple with rounded corners
344
+ bg-purple-600 rounded-lg h-10 font-semibold
345
+ ```
346
+
347
+ **⚡ Quick Reference:**
348
+
349
+ - **Solid Colors**: red-500/600, blue-500/600, green-500, yellow-500, purple-500, pink-500, indigo-500, cyan-500, emerald-500, slate-700
350
+ - **Gradient Colors**: Full range 400-700 for red/blue/green, 400-500 for yellow/orange, 500-600 for purple/indigo/pink, etc.
351
+ - **Text sizes**: xs, sm, base, lg, xl, 2xl, 3xl, 4xl
352
+ - **Heights**: 4, 5, 6, 7, 8, 10, 12, 14, 16 (h-4 = 16px, h-16 = 64px)
353
+ - **Combine freely**: `bg-blue-500 h-12 text-xl font-bold animate-pulse shadow-lg`
354
+
355
+ ##### Styling System Features
356
+
357
+ **Automatic Detection:**
358
+ The system automatically detects whether you're using:
359
+
360
+ - Tailwind CSS classes (applied as CSS classes)
361
+ - CSS color values (applied as inline styles)
362
+
363
+ **Complete Tailwind Support:**
364
+
365
+ - **Backgrounds:** Solid colors, gradients, transparency
366
+ - **Typography:** Font sizes, weights, colors, alignment
367
+ - **Layout:** Heights, padding, margins, flexbox
368
+ - **Borders:** Styles, colors, radius
369
+ - **Effects:** Shadows, animations
370
+ - **Bundle Optimized:** Curated safelist keeps CSS file size reasonable (~33KB)
371
+
372
+ **Backward Compatibility:**
373
+
374
+ - Existing `headerBackground` URLs continue to work
375
+ - Mixed usage supported (header + headerBackground or headerStyle)
376
+ - Graceful fallback to CSS for non-Tailwind values
377
+
378
+ ### Clipboard Settings
379
+
380
+ The WebSSH2 client includes comprehensive clipboard integration. All clipboard features can be configured through the Terminal Settings modal (accessible from the menu) or via localStorage:
381
+
382
+ #### Features
383
+
384
+ 1. **Auto-copy on Selection**: Automatically copies selected text to the system clipboard when you select text with your mouse (similar to tmux or PuTTY)
385
+ 2. **Middle-click Paste**: Paste clipboard contents by middle-clicking in the terminal
386
+ 3. **Keyboard Shortcuts**: Use Ctrl+Shift+C to copy and Ctrl+Shift+V to paste (Cmd+Shift+C/V on macOS)
387
+
388
+ #### Configuration
389
+
390
+ Clipboard settings are stored in localStorage under `webssh2.settings.global` and can be toggled via the Terminal Settings modal:
391
+
392
+ - `clipboardAutoSelectToCopy` (default: `true`) - Enable/disable auto-copy on selection
393
+ - `clipboardEnableMiddleClickPaste` (default: `true`) - Enable/disable middle-click paste
394
+ - `clipboardEnableKeyboardShortcuts` (default: `true`) - Enable/disable keyboard shortcuts
395
+
396
+ #### Browser Compatibility
397
+
398
+ The clipboard integration includes:
399
+
400
+ - Automatic detection of browser clipboard API support
401
+ - Fallback mechanisms for older browsers
402
+ - Security context validation (HTTPS/localhost required)
403
+ - Browser-specific warnings and guidance
404
+ - Visual feedback via toast notifications for clipboard operations
405
+
406
+ #### Programmatic Configuration
407
+
408
+ You can also configure clipboard settings programmatically:
409
+
410
+ ```javascript
411
+ // Read current settings
412
+ const settings = JSON.parse(
413
+ localStorage.getItem('webssh2.settings.global') || '{}'
414
+ )
415
+
416
+ // Update clipboard settings
417
+ settings.clipboardAutoSelectToCopy = false // Disable auto-copy
418
+ settings.clipboardEnableMiddleClickPaste = true // Enable middle-click
419
+ settings.clipboardEnableKeyboardShortcuts = true // Enable shortcuts
420
+
421
+ // Save settings
422
+ localStorage.setItem('webssh2.settings.global', JSON.stringify(settings))
423
+ ```
424
+
425
+ ### Configuration Object
426
+
427
+ You can configure the client by setting `window.webssh2Config`:
428
+
429
+ ```javascript
430
+ window.webssh2Config = {
431
+ socket: {
432
+ url: null, // WebSocket URL (auto-detected if null)
433
+ path: '/ssh/socket.io' // Socket.IO path
434
+ },
435
+ ssh: {
436
+ host: null, // SSH server hostname
437
+ port: 22, // SSH server port
438
+ username: null,
439
+ sshterm: 'xterm-color'
440
+ },
441
+ header: {
442
+ text: null,
443
+ background: 'green'
444
+ },
445
+ autoConnect: false
446
+ }
447
+ ```
448
+
449
+ ## Development
450
+
451
+ See [DEVELOPMENT.md](./DEVELOPMENT.md).
207
452
 
208
453
  ## Support
209
454
 
210
- If you find this project helpful, you can support the developer:
455
+ If you find this project helpful, consider supporting the developer:
211
456
 
212
457
  [![Buy Me A Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/billchurch)
213
458
 
214
-
215
459
  ## License
216
460
 
217
461
  This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
218
462
 
219
463
  ## Acknowledgments
220
464
 
221
- - [Xterm.js](https://xtermjs.org/) for providing the terminal emulator
222
- - [Socket.IO](https://socket.io/) for real-time, bidirectional communication
223
- - [Webpack](https://webpack.js.org/) for module bundling
465
+ - [Xterm.js](https://xtermjs.org/) for terminal emulation
466
+ - [Socket.IO](https://socket.io/) for WebSocket communication
467
+ - [Vite](https://vitejs.dev/) for development and bundling
468
+ - [ESLint](https://eslint.org/) + [Prettier](https://prettier.io/) for code quality
469
+ - [lucide-static](https://github.com/lucide-icons/lucide) for SVG icons
package/client/index.js CHANGED
@@ -1,8 +1,14 @@
1
1
  // client
2
- // client/index.js
3
- const path = require('path');
4
-
5
- module.exports = {
2
+ // client/index.ts
3
+ import path from 'path'
4
+ import { readFileSync } from 'fs'
5
+ import { fileURLToPath } from 'url'
6
+ const __filename = fileURLToPath(import.meta.url)
7
+ const __dirname = path.dirname(__filename)
8
+ const packageJson = JSON.parse(
9
+ readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')
10
+ )
11
+ export default {
6
12
  getPublicPath: () => path.join(__dirname, 'public'),
7
- version: require('../package.json').version
8
- };
13
+ version: packageJson.version
14
+ }