webssh2_client 1.0.0 → 2.0.0-alpha.1
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 +304 -134
- package/client/index.js +11 -7
- package/client/public/client.htm +18 -102
- package/client/public/webssh2.bundle.js +3 -1
- package/client/public/webssh2.css +2 -12
- package/client/public/xterm.css +33 -0
- package/index.js +25 -22
- package/package.json +58 -42
package/README.md
CHANGED
|
@@ -1,223 +1,393 @@
|
|
|
1
1
|
# WebSSH2 Client - Web SSH Client
|
|
2
2
|
|
|
3
|
+
[](https://github.com/billchurch/webssh2_client/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/billchurch/webssh2_client/actions/workflows/release.yml)
|
|
5
|
+
|
|
3
6
|

|
|
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
|

|
|
8
11
|
|
|
9
|
-
#
|
|
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
|
-
|
|
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
|
-
|
|
16
|
+
# Status
|
|
17
17
|
|
|
18
|
-
-
|
|
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 (
|
|
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
|
-
##
|
|
49
|
+
## Server Requirements
|
|
56
50
|
|
|
57
|
-
|
|
51
|
+
The WebSSH2 client requires a compatible server that provides:
|
|
58
52
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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).
|
|
63
59
|
|
|
64
|
-
|
|
60
|
+
## Client Features
|
|
61
|
+
|
|
62
|
+
- Web-based SSH client with xterm.js terminal emulation
|
|
63
|
+
- Customizable terminal settings:
|
|
64
|
+
- Font size and family
|
|
65
|
+
- Color schemes
|
|
66
|
+
- Cursor behavior
|
|
67
|
+
- Scrollback buffer size
|
|
68
|
+
- Session logging with download capability
|
|
69
|
+
- Copy and paste functionality
|
|
70
|
+
- Terminal mouse support
|
|
71
|
+
- Keyboard shortcuts
|
|
72
|
+
- Responsive design
|
|
73
|
+
- Multi-factor authentication support (when supported by server)
|
|
74
|
+
- Support for credential replay and reauthentication
|
|
75
|
+
|
|
76
|
+
## Security and Lint Rules
|
|
77
|
+
|
|
78
|
+
- No innerHTML: The client never uses `innerHTML` for user content. All text uses `textContent` and safe DOM building helpers.
|
|
79
|
+
- CSP: Strict `script-src 'self'` (no inline scripts). Inline styles allowed for xterm DOM renderer and safe color updates.
|
|
80
|
+
- ESLint guardrails:
|
|
81
|
+
- `no-unsanitized` plugin blocks unsanitized DOM sinks (`innerHTML`, `outerHTML`, `insertAdjacentHTML`, `document.write`).
|
|
82
|
+
- Additional bans via `no-restricted-properties` for those sinks, and `no-restricted-syntax` for string-based timers and `new Function`.
|
|
83
|
+
- Xterm integration: Terminal output is rendered with `xterm.write()`; no HTML rendering of remote data.
|
|
65
84
|
|
|
66
85
|
## Configuration
|
|
67
86
|
|
|
68
|
-
The client can be configured
|
|
87
|
+
The client can be configured through:
|
|
88
|
+
|
|
89
|
+
1. URL parameters
|
|
90
|
+
2. Configuration object
|
|
91
|
+
3. User interface settings
|
|
92
|
+
|
|
93
|
+
### URL Parameters
|
|
94
|
+
|
|
95
|
+
Supported URL parameters include:
|
|
69
96
|
|
|
97
|
+
- `host` - SSH server hostname
|
|
70
98
|
- `port` - SSH server port (default: 22)
|
|
71
99
|
- `header` - Optional header text
|
|
72
|
-
- `
|
|
73
|
-
- `
|
|
100
|
+
- `headerStyle` - Complete header styling with Tailwind CSS classes or CSS (recommended)
|
|
101
|
+
- `headerBackground` - Header background styling only (legacy, see Advanced Header Styling below)
|
|
102
|
+
- `sshterm` - Terminal type (default: xterm-color)
|
|
74
103
|
|
|
75
|
-
|
|
104
|
+
#### Advanced Header Styling
|
|
76
105
|
|
|
77
|
-
|
|
106
|
+
WebSSH2 Client supports comprehensive header styling through two approaches: **enhanced headerStyle** (recommended) and **legacy headerBackground** (maintained for backward compatibility).
|
|
78
107
|
|
|
79
|
-
|
|
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
|
|
108
|
+
##### Enhanced Header Styling (headerStyle)
|
|
90
109
|
|
|
91
|
-
|
|
110
|
+
The `headerStyle` parameter provides complete control over header appearance using Tailwind CSS classes or CSS properties:
|
|
92
111
|
|
|
93
|
-
|
|
112
|
+
**Basic Examples:**
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
# Enhanced background with custom height and text
|
|
116
|
+
?header=Production&headerStyle=bg-red-600%20h-10%20text-xl%20font-bold
|
|
94
117
|
|
|
95
|
-
|
|
118
|
+
# Gradient with custom styling
|
|
119
|
+
?header=Staging&headerStyle=bg-gradient-to-r%20from-blue-500%20to-purple-500%20h-8%20text-lg
|
|
96
120
|
|
|
97
|
-
|
|
98
|
-
-
|
|
121
|
+
# Custom text colors and shadows
|
|
122
|
+
?header=Development&headerStyle=bg-green-500%20text-black%20font-semibold%20shadow-lg
|
|
123
|
+
```
|
|
99
124
|
|
|
100
|
-
|
|
125
|
+
**Advanced Styling Capabilities:**
|
|
101
126
|
|
|
102
|
-
|
|
103
|
-
- Optional `port` parameter (e.g., `?port=2222`)
|
|
104
|
-
- HTTP Basic Authentication for credentials
|
|
127
|
+
**Backgrounds & Gradients:**
|
|
105
128
|
|
|
106
|
-
|
|
129
|
+
```
|
|
130
|
+
# Multi-directional gradients
|
|
131
|
+
?headerStyle=bg-gradient-to-br%20from-purple-600%20via-pink-500%20to-yellow-400%20h-12
|
|
107
132
|
|
|
108
|
-
|
|
109
|
-
-
|
|
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.
|
|
133
|
+
# Solid colors with transparency
|
|
134
|
+
?headerStyle=bg-blue-500%20h-8%20shadow-blue-500/50
|
|
112
135
|
|
|
113
|
-
|
|
136
|
+
# Complex gradient patterns
|
|
137
|
+
?headerStyle=bg-gradient-to-r%20from-red-500%20via-yellow-500%20to-green-500%20h-10
|
|
138
|
+
```
|
|
114
139
|
|
|
115
|
-
|
|
140
|
+
**Typography & Layout:**
|
|
116
141
|
|
|
117
|
-
```html
|
|
118
|
-
<script>
|
|
119
|
-
window.webssh2Config = null;
|
|
120
|
-
</script>
|
|
121
142
|
```
|
|
143
|
+
# Large headers with custom fonts
|
|
144
|
+
?headerStyle=bg-slate-700%20h-16%20text-3xl%20font-black%20flex%20items-center%20justify-center
|
|
122
145
|
|
|
123
|
-
|
|
146
|
+
# Compact headers
|
|
147
|
+
?headerStyle=bg-indigo-600%20h-5%20text-xs%20font-medium
|
|
124
148
|
|
|
125
|
-
|
|
149
|
+
# Custom text alignment and colors
|
|
150
|
+
?headerStyle=bg-gradient-to-r%20from-cyan-400%20to-blue-500%20text-left%20text-yellow-100%20px-4
|
|
151
|
+
```
|
|
126
152
|
|
|
127
|
-
|
|
153
|
+
**Borders & Effects:**
|
|
128
154
|
|
|
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
|
-
};
|
|
149
155
|
```
|
|
156
|
+
# Styled borders
|
|
157
|
+
?headerStyle=bg-purple-500%20border-2%20border-white%20border-dashed%20h-8
|
|
150
158
|
|
|
151
|
-
|
|
159
|
+
# Shadow effects
|
|
160
|
+
?headerStyle=bg-green-500%20shadow-xl%20shadow-green-500/50%20rounded-lg%20h-10
|
|
152
161
|
|
|
153
|
-
|
|
162
|
+
# Rounded corners
|
|
163
|
+
?headerStyle=bg-gradient-to-r%20from-pink-400%20to-rose-500%20rounded-xl%20h-12%20mx-2
|
|
164
|
+
```
|
|
154
165
|
|
|
155
|
-
|
|
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.
|
|
166
|
+
**Animations:**
|
|
159
167
|
|
|
160
|
-
|
|
168
|
+
```
|
|
169
|
+
# Pulsing effect for alerts
|
|
170
|
+
?headerStyle=bg-red-600%20animate-pulse%20h-8%20font-bold
|
|
161
171
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
ssh: {
|
|
165
|
-
host: 'example.com',
|
|
166
|
-
port: 22,
|
|
167
|
-
username: 'user', // Optional
|
|
168
|
-
password: 'password' // Optional
|
|
169
|
-
},
|
|
170
|
-
autoConnect: true
|
|
171
|
-
};
|
|
172
|
+
# Bouncing for urgent notifications
|
|
173
|
+
?headerStyle=bg-yellow-500%20animate-bounce%20h-10%20text-black%20font-semibold
|
|
172
174
|
```
|
|
173
175
|
|
|
174
|
-
|
|
176
|
+
**Production Examples:**
|
|
175
177
|
|
|
176
|
-
|
|
178
|
+
```
|
|
179
|
+
# Critical system warning
|
|
180
|
+
?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
|
|
177
181
|
|
|
178
|
-
|
|
179
|
-
-
|
|
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.
|
|
182
|
+
# Development environment
|
|
183
|
+
?header=🛠️%20Development%20Environment&headerStyle=bg-gradient-to-r%20from-green-400%20to-emerald-600%20h-8%20text-white%20font-medium
|
|
182
184
|
|
|
183
|
-
|
|
185
|
+
# Staging deployment
|
|
186
|
+
?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
|
|
184
187
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
header: {
|
|
189
|
-
text: 'My Custom SSH Client',
|
|
190
|
-
background: '#007acc'
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
```
|
|
188
|
+
# Secure connection
|
|
189
|
+
?header=🔐%20Encrypted%20Connection&headerStyle=bg-gradient-to-r%20from-emerald-500%20to-teal-600%20h-8%20text-white%20shadow-md
|
|
190
|
+
```
|
|
194
191
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
192
|
+
##### Legacy Header Styling (headerBackground)
|
|
193
|
+
|
|
194
|
+
For backward compatibility, the original `headerBackground` parameter is still supported:
|
|
195
|
+
|
|
196
|
+
**Basic Colors:**
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
?header=Production&headerBackground=red
|
|
200
|
+
?header=Custom&headerBackground=%23ff6b35
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**Tailwind Classes:**
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
?header=Server%20Alpha&headerBackground=bg-blue-500
|
|
207
|
+
?header=Critical%20System&headerBackground=bg-red-600
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Simple Gradients:**
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
?header=Gradient%20Demo&headerBackground=bg-gradient-to-r%20from-blue-500%20to-purple-500
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
##### Header Styling Reference
|
|
217
|
+
|
|
218
|
+
**Essential Styling Categories:**
|
|
219
|
+
|
|
220
|
+
**🎨 Background Colors & Gradients**
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
# Solid Colors
|
|
224
|
+
bg-red-600, bg-blue-500, bg-green-500, bg-yellow-500, bg-purple-500
|
|
225
|
+
bg-slate-700, bg-gray-800
|
|
226
|
+
|
|
227
|
+
# Gradients (Direction + Colors)
|
|
228
|
+
bg-gradient-to-r from-red-600 to-red-700
|
|
229
|
+
bg-gradient-to-br from-purple-500 via-pink-500 to-yellow-400
|
|
230
|
+
bg-gradient-to-tl from-blue-400 to-cyan-500
|
|
231
|
+
```
|
|
205
232
|
|
|
206
|
-
|
|
233
|
+
**📝 Text Styling**
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
# Sizes: text-xs, text-sm, text-base, text-lg, text-xl, text-2xl, text-3xl, text-4xl
|
|
237
|
+
# Weights: font-normal, font-medium, font-semibold, font-bold, font-black
|
|
238
|
+
# Colors: text-white, text-black, text-yellow-100, text-red-100, text-blue-100
|
|
239
|
+
|
|
240
|
+
# Examples
|
|
241
|
+
text-2xl font-bold text-white
|
|
242
|
+
text-sm font-medium text-black
|
|
243
|
+
text-4xl font-black text-yellow-100
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**📏 Header Heights**
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
# Available: h-4, h-5, h-6, h-7, h-8, h-10, h-12, h-14, h-16
|
|
250
|
+
# Default was h-6 (24px), now customizable
|
|
251
|
+
|
|
252
|
+
h-8 # Compact header
|
|
253
|
+
h-12 # Standard header
|
|
254
|
+
h-16 # Prominent header
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**✨ Visual Effects**
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
# Animations
|
|
261
|
+
animate-pulse # Pulsing effect for alerts
|
|
262
|
+
animate-bounce # Bouncing for urgent notifications
|
|
263
|
+
|
|
264
|
+
# Shadows
|
|
265
|
+
shadow-md, shadow-lg, shadow-xl
|
|
266
|
+
|
|
267
|
+
# Borders
|
|
268
|
+
border-2 border-white border-dashed
|
|
269
|
+
rounded-lg, rounded-xl
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**📍 Layout & Positioning**
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
# Text Alignment
|
|
276
|
+
text-left, text-center, text-right
|
|
277
|
+
|
|
278
|
+
# Spacing
|
|
279
|
+
px-4, px-6 (horizontal padding)
|
|
280
|
+
py-2, py-3 (vertical padding)
|
|
281
|
+
|
|
282
|
+
# Flexbox (for complex layouts)
|
|
283
|
+
flex items-center justify-center
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**Common Use Cases:**
|
|
287
|
+
|
|
288
|
+
**🚨 Production/Critical Systems:**
|
|
289
|
+
|
|
290
|
+
```
|
|
291
|
+
# Red gradient with large text and pulsing animation
|
|
292
|
+
bg-gradient-to-r from-red-600 to-red-700 h-12 text-2xl font-bold animate-pulse
|
|
293
|
+
|
|
294
|
+
# Solid red with white border
|
|
295
|
+
bg-red-600 border-2 border-white h-10 text-xl font-bold
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**🚀 Staging/Development:**
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
# Yellow-orange gradient for staging
|
|
302
|
+
bg-gradient-to-r from-yellow-400 to-orange-500 h-10 text-black font-semibold
|
|
303
|
+
|
|
304
|
+
# Green for development
|
|
305
|
+
bg-gradient-to-r from-green-400 to-emerald-600 h-8 text-white font-medium
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**🔒 Secure/Special Connections:**
|
|
309
|
+
|
|
310
|
+
```
|
|
311
|
+
# Blue gradient with shadow
|
|
312
|
+
bg-gradient-to-r from-blue-500 to-cyan-500 h-8 shadow-lg
|
|
313
|
+
|
|
314
|
+
# Purple with rounded corners
|
|
315
|
+
bg-purple-600 rounded-lg h-10 font-semibold
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
**⚡ Quick Reference:**
|
|
319
|
+
|
|
320
|
+
- **Colors**: red, blue, green, yellow, purple, pink, cyan, emerald, slate, gray
|
|
321
|
+
- **Shades**: 400 (lighter), 500 (medium), 600 (darker), 700 (darkest common)
|
|
322
|
+
- **Text sizes**: xs, sm, base, lg, xl, 2xl, 3xl, 4xl
|
|
323
|
+
- **Heights**: 4-16 (h-4 = 16px, h-16 = 64px)
|
|
324
|
+
- **Combine freely**: `bg-blue-500 h-12 text-xl font-bold animate-pulse shadow-lg`
|
|
325
|
+
|
|
326
|
+
##### Styling System Features
|
|
327
|
+
|
|
328
|
+
**Automatic Detection:**
|
|
329
|
+
The system automatically detects whether you're using:
|
|
330
|
+
|
|
331
|
+
- Tailwind CSS classes (applied as CSS classes)
|
|
332
|
+
- CSS color values (applied as inline styles)
|
|
333
|
+
|
|
334
|
+
**Complete Tailwind Support:**
|
|
335
|
+
|
|
336
|
+
- **Backgrounds:** Solid colors, gradients, transparency
|
|
337
|
+
- **Typography:** Font sizes, weights, colors, alignment
|
|
338
|
+
- **Layout:** Heights, padding, margins, flexbox
|
|
339
|
+
- **Borders:** Styles, colors, radius
|
|
340
|
+
- **Effects:** Shadows, animations
|
|
341
|
+
- **Bundle Optimized:** Curated safelist keeps CSS file size reasonable (~38KB)
|
|
342
|
+
|
|
343
|
+
**Backward Compatibility:**
|
|
344
|
+
|
|
345
|
+
- Existing `headerBackground` URLs continue to work
|
|
346
|
+
- Mixed usage supported (header + headerBackground or headerStyle)
|
|
347
|
+
- Graceful fallback to CSS for non-Tailwind values
|
|
348
|
+
|
|
349
|
+
### Configuration Object
|
|
350
|
+
|
|
351
|
+
You can configure the client by setting `window.webssh2Config`:
|
|
352
|
+
|
|
353
|
+
```javascript
|
|
354
|
+
window.webssh2Config = {
|
|
355
|
+
socket: {
|
|
356
|
+
url: null, // WebSocket URL (auto-detected if null)
|
|
357
|
+
path: '/ssh/socket.io' // Socket.IO path
|
|
358
|
+
},
|
|
359
|
+
ssh: {
|
|
360
|
+
host: null, // SSH server hostname
|
|
361
|
+
port: 22, // SSH server port
|
|
362
|
+
username: null,
|
|
363
|
+
sshterm: 'xterm-color'
|
|
364
|
+
},
|
|
365
|
+
header: {
|
|
366
|
+
text: null,
|
|
367
|
+
background: 'green'
|
|
368
|
+
},
|
|
369
|
+
autoConnect: false
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
## Development
|
|
374
|
+
|
|
375
|
+
See [DEVELOPMENT.md](./DEVELOPMENT.md).
|
|
207
376
|
|
|
208
377
|
## Support
|
|
209
378
|
|
|
210
|
-
If you find this project helpful,
|
|
379
|
+
If you find this project helpful, consider supporting the developer:
|
|
211
380
|
|
|
212
381
|
[](https://www.buymeacoffee.com/billchurch)
|
|
213
382
|
|
|
214
|
-
|
|
215
383
|
## License
|
|
216
384
|
|
|
217
385
|
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
|
|
218
386
|
|
|
219
387
|
## Acknowledgments
|
|
220
388
|
|
|
221
|
-
- [Xterm.js](https://xtermjs.org/) for
|
|
222
|
-
- [Socket.IO](https://socket.io/) for
|
|
223
|
-
- [
|
|
389
|
+
- [Xterm.js](https://xtermjs.org/) for terminal emulation
|
|
390
|
+
- [Socket.IO](https://socket.io/) for WebSocket communication
|
|
391
|
+
- [Vite](https://vitejs.dev/) for development and bundling
|
|
392
|
+
- [ESLint](https://eslint.org/) + [Prettier](https://prettier.io/) for code quality
|
|
393
|
+
- [lucide-static](https://github.com/lucide-icons/lucide) for SVG icons
|
package/client/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
// client
|
|
2
|
-
// client/index.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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(readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'));
|
|
9
|
+
export default {
|
|
10
|
+
getPublicPath: () => path.join(__dirname, 'public'),
|
|
11
|
+
version: packageJson.version
|
|
12
|
+
};
|