@goodandready/dsh-remote-workspace 0.3.0 → 0.3.2
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 +17 -0
- package/README.ru.md +17 -0
- package/README.zh.md +17 -0
- package/docs/design/DESIGN.md +1 -1
- package/lib/alert-service.js +109 -0
- package/lib/client.js +2316 -1991
- package/lib/diagnose-service.js +57 -0
- package/lib/docker-service.js +1 -1
- package/lib/env-service.js +122 -0
- package/lib/index.js +83 -16
- package/lib/mirror-sync-service.js +2 -2
- package/lib/routes/docker.js +85 -0
- package/lib/routes/env.js +60 -0
- package/lib/routes/files.js +88 -0
- package/lib/routes/helpers.js +40 -0
- package/lib/routes/profiles.js +141 -0
- package/lib/routes/sync.js +52 -0
- package/lib/routes/terminal.js +103 -0
- package/lib/routes/tunnels.js +59 -0
- package/lib/routes.js +47 -516
- package/lib/ssh-config-parser.js +89 -0
- package/lib/ssh-service.js +24 -9
- package/lib/tar-sync-service.js +85 -0
- package/lib/tools.js +78 -3
- package/lib/tunnel-service.js +2 -2
- package/lib/updater-service.js +338 -0
- package/lib/vault-service.js +29 -5
- package/lib/watcher-service.js +3 -3
- package/package.json +6 -3
- package/docs/plans/findings.md +0 -19
- package/docs/plans/progress.md +0 -15
- package/docs/plans/task_plan.md +0 -23
package/lib/client.js
CHANGED
|
@@ -1,1991 +1,2316 @@
|
|
|
1
|
-
// Remote Workspace Settings Card (settings.plugin.item) & Session Utility Chip.
|
|
2
|
-
window.__ModuleLoader__.load({
|
|
3
|
-
id: '@goodandready/dsh-remote-workspace',
|
|
4
|
-
factory: (require) => {
|
|
5
|
-
var module = { exports: {} }
|
|
6
|
-
var exports = module.exports
|
|
7
|
-
const React = require('react')
|
|
8
|
-
|
|
9
|
-
const NS = 'dsh-remote-workspace'
|
|
10
|
-
|
|
11
|
-
function ensureCss() {
|
|
12
|
-
if (typeof document === 'undefined') return
|
|
13
|
-
if (document.getElementById('drw-clinebot-full-css')) return
|
|
14
|
-
const style = document.createElement('style')
|
|
15
|
-
style.id = 'drw-clinebot-full-css'
|
|
16
|
-
style.dataset.dshPlugin = NS
|
|
17
|
-
style.textContent = `
|
|
18
|
-
.drw-page{display:flex;flex-direction:column;gap:18px;padding:6px 0 24px;max-width:960px}
|
|
19
|
-
.drw-header{display:flex;flex-direction:column;gap:8px;padding-bottom:14px;border-bottom:1px solid var(--dsw-alias-border-l2)}
|
|
20
|
-
.drw-header-top{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px}
|
|
21
|
-
.drw-page-title{font-size:20px;font-weight:700;color:var(--dsw-alias-label-primary);display:flex;align-items:center;gap:10px}
|
|
22
|
-
.drw-page-sub{font-size:13px;color:var(--dsw-alias-label-secondary);line-height:1.5}
|
|
23
|
-
.drw-header-badges{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
|
|
24
|
-
|
|
25
|
-
.drw-card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;padding:16px 18px;display:flex;flex-direction:column;gap:14px;list-style:none}
|
|
26
|
-
.drw-card-title{font-size:15px;font-weight:600;color:var(--dsw-alias-label-primary);display:flex;align-items:center;justify-content:space-between}
|
|
27
|
-
.drw-card-desc{font-size:13px;color:var(--dsw-alias-label-secondary);margin-top:-6px;line-height:1.4}
|
|
28
|
-
|
|
29
|
-
.drw-row{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
|
|
30
|
-
.drw-grid-2{display:grid;grid-template-columns:repeat(auto-fit, minmax(280px, 1fr));gap:12px}
|
|
31
|
-
.drw-grid-4{display:grid;grid-template-columns:repeat(auto-fit, minmax(190px, 1fr));gap:10px}
|
|
32
|
-
|
|
33
|
-
.drw-badge{font-size:11px;padding:3px 9px;border-radius:999px;border:1px solid var(--dsw-alias-border-l2);display:inline-flex;align-items:center;gap:5px;font-weight:500;font-family:monospace}
|
|
34
|
-
.drw-badge-ok{border-color:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-state-success-primary);background:
|
|
35
|
-
.drw-badge-warn{border-color:var(--dsw-alias-state-warning-primary);color:var(--dsw-alias-state-warning-primary);background:
|
|
36
|
-
.drw-badge-err{border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary);background:
|
|
37
|
-
|
|
38
|
-
.drw-input{height:34px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 10px;font-size:13px;width:100%;box-sizing:border-box}
|
|
39
|
-
.drw-input:focus{outline:none;border-color:var(--dsw-alias-state-brand-primary)}
|
|
40
|
-
.drw-label{font-size:12px;font-weight:500;color:var(--dsw-alias-label-secondary);margin-bottom:2px}
|
|
41
|
-
.drw-hint{font-size:11px;color:var(--dsw-alias-label-dimmed, var(--dsw-alias-label-secondary));line-height:1.3}
|
|
42
|
-
.drw-field{display:flex;flex-direction:column;gap:3px;flex:1;min-width:180px}
|
|
43
|
-
|
|
44
|
-
.drw-btn{appearance:none;font:inherit;cursor:pointer;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:6px 12px;font-size:13px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font-weight:500;display:inline-flex;align-items:center;justify-content:center;gap:6px;transition:all .15s ease}
|
|
45
|
-
.drw-btn:hover:not(:disabled){background:var(--dsw-alias-bg-layer-4, var(--dsw-alias-bg-layer-2));border-color:var(--dsw-alias-label-dimmed, var(--dsw-alias-border-l2))}
|
|
46
|
-
.drw-btn:disabled{opacity:0.6;cursor:not-allowed}
|
|
47
|
-
.drw-btn-primary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border-color:transparent}
|
|
48
|
-
.drw-btn-primary:hover:not(:disabled){opacity:0.9}
|
|
49
|
-
.drw-btn-danger{color:var(--dsw-alias-state-error-primary);border-color:
|
|
50
|
-
.drw-btn-danger:hover:not(:disabled){background:
|
|
51
|
-
|
|
52
|
-
.drw-segmented{display:inline-flex;border-radius:8px;padding:2px;background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);gap:2px}
|
|
53
|
-
.drw-segmented-item{appearance:none;border:none;background:none;cursor:pointer;padding:5px 12px;font-size:12px;font-weight:500;border-radius:6px;color:var(--dsw-alias-label-secondary);transition:all .15s ease}
|
|
54
|
-
.drw-segmented-item-active{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);
|
|
55
|
-
|
|
56
|
-
.drw-table{width:100%;border-collapse:collapse;margin-top:4px}
|
|
57
|
-
.drw-table th{text-align:left;font-size:12px;color:var(--dsw-alias-label-secondary);padding:8px 10px;border-bottom:1px solid var(--dsw-alias-border-l2);font-weight:600}
|
|
58
|
-
.drw-table td{padding:9px 10px;border-bottom:1px solid var(--dsw-alias-border-l2);font-size:13px;color:var(--dsw-alias-label-primary)}
|
|
59
|
-
.drw-table tr:hover{background:var(--dsw-alias-bg-layer-2)}
|
|
60
|
-
|
|
61
|
-
.drw-stat-box{padding:10px 12px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-2);display:flex;flex-direction:column;gap:3px}
|
|
62
|
-
.drw-stat-val{font-size:14px;font-weight:700;color:var(--dsw-alias-label-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
63
|
-
.drw-stat-lbl{font-size:11px;color:var(--dsw-alias-label-secondary)}
|
|
64
|
-
.drw-preview{padding:10px 12px;border-radius:8px;background:var(--dsw-alias-bg-layer-2);font-family:monospace;font-size:12px;white-space:pre-wrap;word-break:break-all;border:1px solid var(--dsw-alias-border-l2);line-height:1.4}
|
|
65
|
-
|
|
66
|
-
.drw-browser-modal{border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-2);padding:12px;display:flex;flex-direction:column;gap:8px;max-height:280px}
|
|
67
|
-
.drw-browser-list{overflow-y:auto;display:flex;flex-direction:column;gap:2px;max-height:190px;padding-right:4px}
|
|
68
|
-
.drw-browser-item{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:6px;cursor:pointer;font-size:13px;font-family:monospace}
|
|
69
|
-
.drw-browser-item:hover{background:var(--dsw-alias-bg-layer-3)}
|
|
70
|
-
|
|
71
|
-
.drw-tabs{display:flex;gap:6px;border-bottom:1px solid var(--dsw-alias-border-l2);padding-bottom:10px;margin-bottom:14px;overflow-x:auto}
|
|
72
|
-
.drw-tab-btn{appearance:none;border:1px solid transparent;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);padding:6px 14px;border-radius:8px;font-size:13px;font-weight:600;cursor:pointer;display:inline-flex;align-items:center;gap:6px;transition:all .15s ease}
|
|
73
|
-
.drw-tab-btn:hover{background:var(--dsw-alias-bg-layer-4);color:var(--dsw-alias-label-primary)}
|
|
74
|
-
.drw-tab-btn.active{background:var(--dsw-alias-bg-layer-4);border-color:var(--dsw-alias-state-brand-primary);color:var(--dsw-alias-state-brand-primary)}
|
|
75
|
-
|
|
76
|
-
.drw-term-window{background
|
|
77
|
-
.drw-term-header{background
|
|
78
|
-
.drw-term-body{flex:1;padding:10px 12px;overflow-y:auto;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12.5px;line-height:1.45;color
|
|
79
|
-
.drw-term-footer{display:flex;background
|
|
80
|
-
.drw-term-input{flex:1;background:transparent;border:none;color
|
|
81
|
-
|
|
82
|
-
.drw-explorer-box{border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-2);padding:12px;display:flex;flex-direction:column;gap:10px}
|
|
83
|
-
.drw-explorer-nav{display:flex;align-items:center;gap:8px;font-family:monospace;font-size:12px;background:var(--dsw-alias-bg-layer-1);padding:6px 10px;border-radius:6px;border:1px solid var(--dsw-alias-border-l2)}
|
|
84
|
-
.drw-file-list{display:flex;flex-direction:column;gap:3px;max-height:260px;overflow-y:auto}
|
|
85
|
-
.drw-file-row{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;border-radius:6px;cursor:pointer;font-size:13px;font-family:monospace;transition:background .1s ease}
|
|
86
|
-
.drw-file-row:hover{background:var(--dsw-alias-bg-layer-3)}
|
|
87
|
-
.drw-file-meta{display:flex;align-items:center;gap:12px;color:var(--dsw-alias-label-secondary);font-size:11.5px}
|
|
88
|
-
|
|
89
|
-
.drw-modal-overlay{position:fixed;inset:0;background:
|
|
90
|
-
.drw-modal-dialog{background:var(--dsw-alias-bg-layer-3);border:1px solid var(--dsw-alias-border-l2);border-radius:12px;width:100%;max-width:800px;max-height:85vh;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 12px 32px
|
|
91
|
-
.drw-modal-hdr{padding:12px 16px;border-bottom:1px solid var(--dsw-alias-border-l2);display:flex;align-items:center;justify-content:space-between;font-weight:600}
|
|
92
|
-
.drw-modal-body{flex:1;padding:12px 16px;overflow-y:auto}
|
|
93
|
-
|
|
94
|
-
.drw-health-bar{display:grid;grid-template-columns:repeat(auto-fit, minmax(130px, 1fr));gap:8px;padding:8px 12px;background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;font-size:11.5px;font-family:monospace}
|
|
95
|
-
.drw-health-item{display:flex;flex-direction:column;gap:2px}
|
|
96
|
-
.drw-progress{height:6px;background:var(--dsw-alias-bg-layer-1);border-radius:3px;overflow:hidden}
|
|
97
|
-
.drw-progress-fill{height:100%;border-radius:3px;transition:width .2s ease}
|
|
98
|
-
|
|
99
|
-
.drw-container-row{display:grid;grid-template-columns:2fr 2fr 1.5fr 1.5fr auto;align-items:center;gap:10px;padding:8px 10px;border-bottom:1px solid var(--dsw-alias-border-l2);font-size:12.5px;font-family:monospace}
|
|
100
|
-
.drw-container-row:hover{background:var(--dsw-alias-bg-layer-3)}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
const
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
try {
|
|
570
|
-
await fetch('/dsh-remote-workspace/
|
|
571
|
-
method: 'POST',
|
|
572
|
-
headers: { 'Content-Type': 'application/json' },
|
|
573
|
-
body: JSON.stringify({
|
|
574
|
-
})
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
'
|
|
631
|
-
{
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
'
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
const
|
|
693
|
-
const [
|
|
694
|
-
const [
|
|
695
|
-
const [
|
|
696
|
-
const [
|
|
697
|
-
const [
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
)
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
const
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
const
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
)
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
className: 'drw-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
React.createElement('
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
)
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
})
|
|
1
|
+
// Remote Workspace Settings Card (settings.plugin.item) & Session Utility Chip.
|
|
2
|
+
window.__ModuleLoader__.load({
|
|
3
|
+
id: '@goodandready/dsh-remote-workspace',
|
|
4
|
+
factory: (require) => {
|
|
5
|
+
var module = { exports: {} }
|
|
6
|
+
var exports = module.exports
|
|
7
|
+
const React = require('react')
|
|
8
|
+
|
|
9
|
+
const NS = 'dsh-remote-workspace'
|
|
10
|
+
|
|
11
|
+
function ensureCss() {
|
|
12
|
+
if (typeof document === 'undefined') return
|
|
13
|
+
if (document.getElementById('drw-clinebot-full-css')) return
|
|
14
|
+
const style = document.createElement('style')
|
|
15
|
+
style.id = 'drw-clinebot-full-css'
|
|
16
|
+
style.dataset.dshPlugin = NS
|
|
17
|
+
style.textContent = `
|
|
18
|
+
.drw-page{display:flex;flex-direction:column;gap:18px;padding:6px 0 24px;max-width:960px}
|
|
19
|
+
.drw-header{display:flex;flex-direction:column;gap:8px;padding-bottom:14px;border-bottom:1px solid var(--dsw-alias-border-l2)}
|
|
20
|
+
.drw-header-top{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px}
|
|
21
|
+
.drw-page-title{font-size:20px;font-weight:700;color:var(--dsw-alias-label-primary);display:flex;align-items:center;gap:10px}
|
|
22
|
+
.drw-page-sub{font-size:13px;color:var(--dsw-alias-label-secondary);line-height:1.5}
|
|
23
|
+
.drw-header-badges{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
|
|
24
|
+
|
|
25
|
+
.drw-card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;padding:16px 18px;display:flex;flex-direction:column;gap:14px;list-style:none}
|
|
26
|
+
.drw-card-title{font-size:15px;font-weight:600;color:var(--dsw-alias-label-primary);display:flex;align-items:center;justify-content:space-between}
|
|
27
|
+
.drw-card-desc{font-size:13px;color:var(--dsw-alias-label-secondary);margin-top:-6px;line-height:1.4}
|
|
28
|
+
|
|
29
|
+
.drw-row{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
|
|
30
|
+
.drw-grid-2{display:grid;grid-template-columns:repeat(auto-fit, minmax(280px, 1fr));gap:12px}
|
|
31
|
+
.drw-grid-4{display:grid;grid-template-columns:repeat(auto-fit, minmax(190px, 1fr));gap:10px}
|
|
32
|
+
|
|
33
|
+
.drw-badge{font-size:11px;padding:3px 9px;border-radius:999px;border:1px solid var(--dsw-alias-border-l2);display:inline-flex;align-items:center;gap:5px;font-weight:500;font-family:monospace}
|
|
34
|
+
.drw-badge-ok{border-color:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-state-success-primary);background:var(--dsw-alias-state-success-bg, var(--dsw-alias-bg-layer-2))}
|
|
35
|
+
.drw-badge-warn{border-color:var(--dsw-alias-state-warning-primary);color:var(--dsw-alias-state-warning-primary);background:var(--dsw-alias-state-warning-bg, var(--dsw-alias-bg-layer-2))}
|
|
36
|
+
.drw-badge-err{border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary);background:var(--dsw-alias-state-error-bg, var(--dsw-alias-bg-layer-2))}
|
|
37
|
+
|
|
38
|
+
.drw-input{height:34px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 10px;font-size:13px;width:100%;box-sizing:border-box}
|
|
39
|
+
.drw-input:focus{outline:none;border-color:var(--dsw-alias-state-brand-primary)}
|
|
40
|
+
.drw-label{font-size:12px;font-weight:500;color:var(--dsw-alias-label-secondary);margin-bottom:2px}
|
|
41
|
+
.drw-hint{font-size:11px;color:var(--dsw-alias-label-dimmed, var(--dsw-alias-label-secondary));line-height:1.3}
|
|
42
|
+
.drw-field{display:flex;flex-direction:column;gap:3px;flex:1;min-width:180px}
|
|
43
|
+
|
|
44
|
+
.drw-btn{appearance:none;font:inherit;cursor:pointer;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:6px 12px;font-size:13px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font-weight:500;display:inline-flex;align-items:center;justify-content:center;gap:6px;transition:all .15s ease}
|
|
45
|
+
.drw-btn:hover:not(:disabled){background:var(--dsw-alias-bg-layer-4, var(--dsw-alias-bg-layer-2));border-color:var(--dsw-alias-label-dimmed, var(--dsw-alias-border-l2))}
|
|
46
|
+
.drw-btn:disabled{opacity:0.6;cursor:not-allowed}
|
|
47
|
+
.drw-btn-primary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border-color:transparent}
|
|
48
|
+
.drw-btn-primary:hover:not(:disabled){opacity:0.9}
|
|
49
|
+
.drw-btn-danger{color:var(--dsw-alias-state-error-primary);border-color:var(--dsw-alias-state-error-border, var(--dsw-alias-border-l2))}
|
|
50
|
+
.drw-btn-danger:hover:not(:disabled){background:var(--dsw-alias-state-error-bg, var(--dsw-alias-bg-layer-2));border-color:var(--dsw-alias-state-error-border, var(--dsw-alias-border-l2))}
|
|
51
|
+
|
|
52
|
+
.drw-segmented{display:inline-flex;border-radius:8px;padding:2px;background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);gap:2px}
|
|
53
|
+
.drw-segmented-item{appearance:none;border:none;background:none;cursor:pointer;padding:5px 12px;font-size:12px;font-weight:500;border-radius:6px;color:var(--dsw-alias-label-secondary);transition:all .15s ease}
|
|
54
|
+
.drw-segmented-item-active{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);border:1px solid var(--dsw-alias-border-l2);font-weight:600}
|
|
55
|
+
|
|
56
|
+
.drw-table{width:100%;border-collapse:collapse;margin-top:4px}
|
|
57
|
+
.drw-table th{text-align:left;font-size:12px;color:var(--dsw-alias-label-secondary);padding:8px 10px;border-bottom:1px solid var(--dsw-alias-border-l2);font-weight:600}
|
|
58
|
+
.drw-table td{padding:9px 10px;border-bottom:1px solid var(--dsw-alias-border-l2);font-size:13px;color:var(--dsw-alias-label-primary)}
|
|
59
|
+
.drw-table tr:hover{background:var(--dsw-alias-bg-layer-2)}
|
|
60
|
+
|
|
61
|
+
.drw-stat-box{padding:10px 12px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-2);display:flex;flex-direction:column;gap:3px}
|
|
62
|
+
.drw-stat-val{font-size:14px;font-weight:700;color:var(--dsw-alias-label-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
63
|
+
.drw-stat-lbl{font-size:11px;color:var(--dsw-alias-label-secondary)}
|
|
64
|
+
.drw-preview{padding:10px 12px;border-radius:8px;background:var(--dsw-alias-bg-layer-2);font-family:monospace;font-size:12px;white-space:pre-wrap;word-break:break-all;border:1px solid var(--dsw-alias-border-l2);line-height:1.4}
|
|
65
|
+
|
|
66
|
+
.drw-browser-modal{border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-2);padding:12px;display:flex;flex-direction:column;gap:8px;max-height:280px}
|
|
67
|
+
.drw-browser-list{overflow-y:auto;display:flex;flex-direction:column;gap:2px;max-height:190px;padding-right:4px}
|
|
68
|
+
.drw-browser-item{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:6px;cursor:pointer;font-size:13px;font-family:monospace}
|
|
69
|
+
.drw-browser-item:hover{background:var(--dsw-alias-bg-layer-3)}
|
|
70
|
+
|
|
71
|
+
.drw-tabs{display:flex;gap:6px;border-bottom:1px solid var(--dsw-alias-border-l2);padding-bottom:10px;margin-bottom:14px;overflow-x:auto}
|
|
72
|
+
.drw-tab-btn{appearance:none;border:1px solid transparent;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);padding:6px 14px;border-radius:8px;font-size:13px;font-weight:600;cursor:pointer;display:inline-flex;align-items:center;gap:6px;transition:all .15s ease}
|
|
73
|
+
.drw-tab-btn:hover{background:var(--dsw-alias-bg-layer-4);color:var(--dsw-alias-label-primary)}
|
|
74
|
+
.drw-tab-btn.active{background:var(--dsw-alias-bg-layer-4);border-color:var(--dsw-alias-state-brand-primary);color:var(--dsw-alias-state-brand-primary)}
|
|
75
|
+
|
|
76
|
+
.drw-term-window{background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;display:flex;flex-direction:column;height:340px;overflow:hidden;box-shadow:0 4px 14px var(--dsw-alias-border-l1)}
|
|
77
|
+
.drw-term-header{background:var(--dsw-alias-bg-layer-2);padding:6px 12px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--dsw-alias-border-l2);font-size:12px;color:var(--dsw-alias-label-secondary);font-family:monospace}
|
|
78
|
+
.drw-term-body{flex:1;padding:10px 12px;overflow-y:auto;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12.5px;line-height:1.45;color:var(--dsw-alias-label-primary);white-space:pre-wrap;word-break:break-all}
|
|
79
|
+
.drw-term-footer{display:flex;background:var(--dsw-alias-bg-layer-2);border-top:1px solid var(--dsw-alias-border-l2);padding:6px}
|
|
80
|
+
.drw-term-input{flex:1;background:transparent;border:none;color:var(--dsw-alias-link-primary, var(--dsw-alias-label-primary));font-family:monospace;font-size:13px;padding:4px 8px;outline:none}
|
|
81
|
+
|
|
82
|
+
.drw-explorer-box{border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-2);padding:12px;display:flex;flex-direction:column;gap:10px}
|
|
83
|
+
.drw-explorer-nav{display:flex;align-items:center;gap:8px;font-family:monospace;font-size:12px;background:var(--dsw-alias-bg-layer-1);padding:6px 10px;border-radius:6px;border:1px solid var(--dsw-alias-border-l2)}
|
|
84
|
+
.drw-file-list{display:flex;flex-direction:column;gap:3px;max-height:260px;overflow-y:auto}
|
|
85
|
+
.drw-file-row{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;border-radius:6px;cursor:pointer;font-size:13px;font-family:monospace;transition:background .1s ease}
|
|
86
|
+
.drw-file-row:hover{background:var(--dsw-alias-bg-layer-3)}
|
|
87
|
+
.drw-file-meta{display:flex;align-items:center;gap:12px;color:var(--dsw-alias-label-secondary);font-size:11.5px}
|
|
88
|
+
|
|
89
|
+
.drw-modal-overlay{position:fixed;inset:0;background:var(--dsw-alias-mask, var(--dsw-alias-bg-layer-1));z-index:9999;display:flex;align-items:center;justify-content:center;padding:20px}
|
|
90
|
+
.drw-modal-dialog{background:var(--dsw-alias-bg-layer-3);border:1px solid var(--dsw-alias-border-l2);border-radius:12px;width:100%;max-width:800px;max-height:85vh;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 12px 32px var(--dsw-alias-border-l1)}
|
|
91
|
+
.drw-modal-hdr{padding:12px 16px;border-bottom:1px solid var(--dsw-alias-border-l2);display:flex;align-items:center;justify-content:space-between;font-weight:600}
|
|
92
|
+
.drw-modal-body{flex:1;padding:12px 16px;overflow-y:auto}
|
|
93
|
+
|
|
94
|
+
.drw-health-bar{display:grid;grid-template-columns:repeat(auto-fit, minmax(130px, 1fr));gap:8px;padding:8px 12px;background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;font-size:11.5px;font-family:monospace}
|
|
95
|
+
.drw-health-item{display:flex;flex-direction:column;gap:2px}
|
|
96
|
+
.drw-progress{height:6px;background:var(--dsw-alias-bg-layer-1);border-radius:3px;overflow:hidden}
|
|
97
|
+
.drw-progress-fill{height:100%;border-radius:3px;transition:width .2s ease}
|
|
98
|
+
|
|
99
|
+
.drw-container-row{display:grid;grid-template-columns:2fr 2fr 1.5fr 1.5fr auto;align-items:center;gap:10px;padding:8px 10px;border-bottom:1px solid var(--dsw-alias-border-l2);font-size:12.5px;font-family:monospace}
|
|
100
|
+
.drw-container-row:hover{background:var(--dsw-alias-bg-layer-3)}
|
|
101
|
+
|
|
102
|
+
.drw-env-table{width:100%;border-collapse:collapse}
|
|
103
|
+
.drw-env-row{display:grid;grid-template-columns:220px 1fr 90px;gap:8px;padding:6px 0;align-items:center;border-bottom:1px solid var(--dsw-alias-border-l2)}
|
|
104
|
+
.drw-alert-badge{padding:4px 8px;border-radius:6px;font-size:11px;font-family:monospace;display:flex;align-items:center;gap:6px}
|
|
105
|
+
.drw-alert-critical{background:var(--dsw-alias-state-error-bg, var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-state-error-primary);border:1px solid var(--dsw-alias-state-error-border, var(--dsw-alias-border-l2))}
|
|
106
|
+
.drw-alert-warning{background:var(--dsw-alias-state-warning-bg, var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-state-warning-primary);border:1px solid var(--dsw-alias-state-warning-border, var(--dsw-alias-border-l2))}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
`
|
|
110
|
+
document.head.appendChild(style)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const en = {
|
|
114
|
+
title: 'Remote Workspace',
|
|
115
|
+
subtitle: 'Native SSH connections, SFTP file access, 3-way mirror sync, and port forwarding tunnels.',
|
|
116
|
+
status: 'Ready',
|
|
117
|
+
|
|
118
|
+
tabProfiles: '🖥️ Host Profiles',
|
|
119
|
+
|
|
120
|
+
tabContainers: '🐳 Containers',
|
|
121
|
+
|
|
122
|
+
tabEnv: '🗃️ .env Manager',
|
|
123
|
+
btnImportSsh: 'Import ~/.ssh/config',
|
|
124
|
+
envTitle: 'Remote Environment Variables (.env)',
|
|
125
|
+
envKey: 'Key',
|
|
126
|
+
envVal: 'Value',
|
|
127
|
+
envSaveVar: 'Save',
|
|
128
|
+
envShowVal: 'Show',
|
|
129
|
+
envHideVal: 'Hide',
|
|
130
|
+
tarSyncFast: '🚀 Fast Tarball Stream',
|
|
131
|
+
diagnoseTitle: 'Quick Diagnostics',
|
|
132
|
+
diagnosePorts: 'Open Ports',
|
|
133
|
+
diagnoseOom: 'OOM Killer Check',
|
|
134
|
+
diagnoseDisk: 'Disk Usage',
|
|
135
|
+
alertLabel: 'Alerts ({count})',
|
|
136
|
+
|
|
137
|
+
containersTitle: 'Remote Docker / Podman Engine',
|
|
138
|
+
containerName: 'Container',
|
|
139
|
+
containerImage: 'Image',
|
|
140
|
+
containerStatus: 'Status',
|
|
141
|
+
containerPorts: 'Ports',
|
|
142
|
+
btnLogs: 'Logs',
|
|
143
|
+
btnRestart: 'Restart',
|
|
144
|
+
btnStop: 'Stop',
|
|
145
|
+
noContainers: 'No active containers found or Docker daemon not running.',
|
|
146
|
+
healthCpu: 'CPU: {val}%',
|
|
147
|
+
healthMem: 'RAM: {val}% ({used}/{total} MB)',
|
|
148
|
+
healthDisk: 'Disk: {val}%',
|
|
149
|
+
healthUptime: 'Up: {val}',
|
|
150
|
+
autoSyncTitle: 'Live Auto-Sync on Save',
|
|
151
|
+
autoSyncDesc: 'Automatically push modified files to remote workspace on local save.',
|
|
152
|
+
btnTransfer: 'Copy to Host...',
|
|
153
|
+
transferTitle: 'Server-to-Server Direct Transfer',
|
|
154
|
+
transferDestHost: 'Destination Server',
|
|
155
|
+
transferDestPath: 'Destination File Path',
|
|
156
|
+
transferBtnExec: 'Transfer Directly',
|
|
157
|
+
transferSuccess: 'Successfully transferred {bytes} bytes to {host}:{path}',
|
|
158
|
+
fJumpHost: 'Jump Host (Bastion)',
|
|
159
|
+
fJumpHostNone: 'Direct Connection (No Jump Host)',
|
|
160
|
+
|
|
161
|
+
tabTerminal: '⚡ Web Terminal',
|
|
162
|
+
tabExplorer: '📂 File Explorer',
|
|
163
|
+
tabTunnels: '🔗 Port Tunnels',
|
|
164
|
+
tabSync: '🔄 Sync Station',
|
|
165
|
+
vaultProtectedBadge: '🛡️ .env Vault Protected',
|
|
166
|
+
termStart: 'Connect Terminal',
|
|
167
|
+
termStop: 'Disconnect',
|
|
168
|
+
termClear: 'Clear',
|
|
169
|
+
termPlaceholder: 'Type command and press Enter (e.g. htop, ls, docker ps)...',
|
|
170
|
+
termConnected: 'Connected to PTY session {id} on {host}',
|
|
171
|
+
termDisconnected: 'Terminal disconnected.',
|
|
172
|
+
explorerTitle: 'Remote Filesystem Explorer',
|
|
173
|
+
filePreviewTitle: 'File Viewer: {path}',
|
|
174
|
+
fileSize: '{size} KB',
|
|
175
|
+
btnSaveFile: 'Save Changes',
|
|
176
|
+
fileSaved: 'File saved successfully.',
|
|
177
|
+
tunnelTraffic: 'RX: {rx} | TX: {tx}',
|
|
178
|
+
tunnelUptime: 'Up: {sec}s',
|
|
179
|
+
openLocalLink: '🌐 Open Local Port',
|
|
180
|
+
badgeOnline: 'Active Host: {name} ({latency} ms)',
|
|
181
|
+
badgeOffline: 'No active host',
|
|
182
|
+
badgeTunnels: 'Tunnels: {count}',
|
|
183
|
+
badgeKey: '🔑 Key Auth',
|
|
184
|
+
badgePassword: '🔒 Password Auth',
|
|
185
|
+
profilesTitle: '🖥️ Remote SSH Profiles',
|
|
186
|
+
profilesDesc: 'Configure remote machines for code execution, SFTP browsing, and background mirror sync.',
|
|
187
|
+
addBtn: '+ Add Host',
|
|
188
|
+
nameCol: 'Name',
|
|
189
|
+
hostCol: 'Host / User',
|
|
190
|
+
portCol: 'Port',
|
|
191
|
+
pathCol: 'Remote Workspace',
|
|
192
|
+
actionsCol: 'Actions',
|
|
193
|
+
noHosts: 'No remote hosts configured yet. Click "+ Add Host" to create your first connection.',
|
|
194
|
+
activeBadge: 'Active',
|
|
195
|
+
pinBtn: 'Pin Active',
|
|
196
|
+
editBtn: 'Edit',
|
|
197
|
+
delBtn: 'Delete',
|
|
198
|
+
delConfirm: 'Delete host profile "{name}"?',
|
|
199
|
+
formTitleNew: 'Add New Host Profile',
|
|
200
|
+
formTitleEdit: 'Edit Host Profile',
|
|
201
|
+
fName: 'Profile Name',
|
|
202
|
+
fHost: 'Host / IP Address',
|
|
203
|
+
fPort: 'Port',
|
|
204
|
+
fUser: 'Username',
|
|
205
|
+
fAuthType: 'Authentication Method',
|
|
206
|
+
fAuthKey: 'SSH Private Key',
|
|
207
|
+
fAuthPass: 'Password',
|
|
208
|
+
fKeyPath: 'Private Key Path',
|
|
209
|
+
fKeyPathHint: 'Path to ~/.ssh/id_rsa or /home/user/.ssh/id_ed25519',
|
|
210
|
+
fPassphrase: 'Key Passphrase (optional)',
|
|
211
|
+
fPassword: 'Account Password',
|
|
212
|
+
fRemotePath: 'Remote Workspace Directory',
|
|
213
|
+
fRemotePathHint: 'Absolute path on the server (e.g. /home/user/my-project)',
|
|
214
|
+
fLocalMirror: 'Local Mirror Directory',
|
|
215
|
+
fLocalMirrorHint: 'Local directory where files are mirrored for fast 3-way synchronization',
|
|
216
|
+
btnBrowse: '📁 Browse Remote...',
|
|
217
|
+
btnSelectThis: 'Select Directory',
|
|
218
|
+
btnTest: '⚡ Test Connection (Ping)',
|
|
219
|
+
btnSave: 'Save Profile',
|
|
220
|
+
btnCancel: 'Cancel',
|
|
221
|
+
testing: 'Testing Connection...',
|
|
222
|
+
saving: 'Saving...',
|
|
223
|
+
testOk: '✅ Connection OK! Latency: {latency} ms | OS: {os}',
|
|
224
|
+
testFail: '❌ Connection Failed: {err}',
|
|
225
|
+
diagTitle: '📊 Active Connection Diagnostics',
|
|
226
|
+
diagDesc: 'Real-time telemetry and engine status for the currently selected remote machine.',
|
|
227
|
+
diagProbeBtn: '⚡ Quick Probe',
|
|
228
|
+
syncTitle: '🔄 Two-Way Workspace Mirror Sync',
|
|
229
|
+
syncDesc: 'Fast 3-way conflict-aware file synchronization between local mirror and remote server.',
|
|
230
|
+
pullBtn: '⬇️ Pull from Remote',
|
|
231
|
+
pushBtn: '⬆️ Push to Remote',
|
|
232
|
+
pulling: 'Pulling files…',
|
|
233
|
+
pushing: 'Pushing files…',
|
|
234
|
+
syncOk: 'Sync completed! Updated {count} file(s).',
|
|
235
|
+
syncConflict: 'Conflict warning: {count} file(s) modified on both sides.',
|
|
236
|
+
syncErr: 'Sync error: {err}',
|
|
237
|
+
tunnelsTitle: '🔀 SSH Port Forwarding (Tunnels)',
|
|
238
|
+
tunnelsDesc: 'Forward remote ports (e.g. databases, web servers, APIs) to your local machine via encrypted SSH tunnels.',
|
|
239
|
+
tLocalPort: 'Local Port',
|
|
240
|
+
tRemotePort: 'Remote Port',
|
|
241
|
+
tOpenBtn: '+ Open Tunnel',
|
|
242
|
+
tOpening: 'Opening…',
|
|
243
|
+
tStopBtn: 'Stop',
|
|
244
|
+
tNoTunnels: 'No active port forwarding tunnels.',
|
|
245
|
+
tunnelsColId: 'Tunnel ID',
|
|
246
|
+
tunnelsColRoute: 'Forwarding Route',
|
|
247
|
+
tunnelsColActions: 'Actions',
|
|
248
|
+
tOpenOk: 'Tunnel opened: 127.0.0.1:{localPort} -> Remote:{remotePort}',
|
|
249
|
+
tOpenErr: 'Failed to open tunnel: {err}'
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const zh = {
|
|
253
|
+
title: '远程开发工作区',
|
|
254
|
+
subtitle: '支持原生 SSH 连接、SFTP 文件访问、3-way 镜像同步与端口转发隧道。',
|
|
255
|
+
status: '就绪',
|
|
256
|
+
|
|
257
|
+
tabProfiles: '🖥️ 主机配置',
|
|
258
|
+
tabContainers: '🐳 容器管理',
|
|
259
|
+
tabEnv: '🗃️ 环境变量',
|
|
260
|
+
btnImportSsh: '导入 ~/.ssh/config',
|
|
261
|
+
envTitle: '远程环境变量配置 (.env)',
|
|
262
|
+
envKey: '变量名',
|
|
263
|
+
envVal: '变量值',
|
|
264
|
+
envSaveVar: '保存',
|
|
265
|
+
envShowVal: '显示',
|
|
266
|
+
envHideVal: '隐藏',
|
|
267
|
+
tarSyncFast: '🚀 快速 Tarball 流式同步',
|
|
268
|
+
diagnoseTitle: '快速诊断',
|
|
269
|
+
diagnosePorts: '开放端口',
|
|
270
|
+
diagnoseOom: 'OOM 检查',
|
|
271
|
+
diagnoseDisk: '磁盘分析',
|
|
272
|
+
alertLabel: '告警 ({count})',
|
|
273
|
+
|
|
274
|
+
containersTitle: '远程 Docker / Podman 引擎',
|
|
275
|
+
containerName: '容器名',
|
|
276
|
+
containerImage: '镜像',
|
|
277
|
+
containerStatus: '运行状态',
|
|
278
|
+
containerPorts: '端口映射',
|
|
279
|
+
btnLogs: '日志',
|
|
280
|
+
btnRestart: '重启',
|
|
281
|
+
btnStop: '停止',
|
|
282
|
+
noContainers: '未找到运行中的容器或 Docker 守护进程未启动。',
|
|
283
|
+
healthCpu: 'CPU: {val}%',
|
|
284
|
+
healthMem: '内存: {val}% ({used}/{total} MB)',
|
|
285
|
+
healthDisk: '磁盘: {val}%',
|
|
286
|
+
healthUptime: '运行: {val}',
|
|
287
|
+
autoSyncTitle: '保存时自动增量同步',
|
|
288
|
+
autoSyncDesc: '本地文件保存时,后台自动增量推送到远程对应工作目录。',
|
|
289
|
+
btnTransfer: '跨主机传输...',
|
|
290
|
+
transferTitle: '主机间直接流式传输',
|
|
291
|
+
transferDestHost: '目标主机',
|
|
292
|
+
transferDestPath: '目标文件路径',
|
|
293
|
+
transferBtnExec: '立即直传',
|
|
294
|
+
transferSuccess: '成功传输 {bytes} 字节到 {host}:{path}',
|
|
295
|
+
fJumpHost: '跳板机 (Bastion)',
|
|
296
|
+
fJumpHostNone: '直连模式 (无跳板机)',
|
|
297
|
+
|
|
298
|
+
tabTerminal: '⚡ 网页终端',
|
|
299
|
+
tabExplorer: '📂 文件管理',
|
|
300
|
+
tabTunnels: '🔗 端口隧道',
|
|
301
|
+
tabSync: '🔄 同步控制台',
|
|
302
|
+
vaultProtectedBadge: '🛡️ .env 保管库加密保护',
|
|
303
|
+
termStart: '连接终端',
|
|
304
|
+
termStop: '断开连接',
|
|
305
|
+
termClear: '清屏',
|
|
306
|
+
termPlaceholder: '输入命令后回车 (如 htop, ls, docker ps)...',
|
|
307
|
+
termConnected: '已连接至主机 {host} 的 PTY 会话 {id}',
|
|
308
|
+
termDisconnected: '终端已断开。',
|
|
309
|
+
explorerTitle: '远程文件系统浏览',
|
|
310
|
+
filePreviewTitle: '文件查看器: {path}',
|
|
311
|
+
fileSize: '{size} KB',
|
|
312
|
+
btnSaveFile: '保存文件更改',
|
|
313
|
+
fileSaved: '文件保存成功。',
|
|
314
|
+
tunnelTraffic: '下行: {rx} | 上行: {tx}',
|
|
315
|
+
tunnelUptime: '运行: {sec}秒',
|
|
316
|
+
openLocalLink: '🌐 打开本地端口',
|
|
317
|
+
badgeOnline: '当前主机: {name} ({latency} ms)',
|
|
318
|
+
badgeOffline: '未选定活跃主机',
|
|
319
|
+
badgeTunnels: '活动隧道: {count}',
|
|
320
|
+
badgeKey: '🔑 私钥认证',
|
|
321
|
+
badgePassword: '🔒 密码认证',
|
|
322
|
+
profilesTitle: '🖥️ 远程 SSH 主机配置',
|
|
323
|
+
profilesDesc: '配置用于命令执行、SFTP 浏览与后台镜像同步的远程服务器。',
|
|
324
|
+
addBtn: '+ 添加主机',
|
|
325
|
+
nameCol: '配置名称',
|
|
326
|
+
hostCol: '主机 / 用户',
|
|
327
|
+
portCol: '端口',
|
|
328
|
+
pathCol: '远程工作区',
|
|
329
|
+
actionsCol: '操作',
|
|
330
|
+
noHosts: '暂无配置的主机。点击 "+ 添加主机" 建立首个连接。',
|
|
331
|
+
activeBadge: '活动中',
|
|
332
|
+
updaterTitle: '插件更新',
|
|
333
|
+
currentVersion: '当前版本',
|
|
334
|
+
latestVersion: 'npm 最新版',
|
|
335
|
+
checkUpdate: '检查更新',
|
|
336
|
+
checking: '正在检查...',
|
|
337
|
+
updateNow: '立即更新',
|
|
338
|
+
updating: '正在更新...',
|
|
339
|
+
upToDate: '已是最新版本',
|
|
340
|
+
updateAvailable: '发现新版本',
|
|
341
|
+
restartRequired: '更新已成功安装,请重启 DSH 使其生效。',
|
|
342
|
+
updateFailed: '更新失败',
|
|
343
|
+
pinBtn: '设为默认',
|
|
344
|
+
editBtn: '编辑',
|
|
345
|
+
delBtn: '删除',
|
|
346
|
+
delConfirm: '确认删除主机配置 "{name}" 吗?',
|
|
347
|
+
formTitleNew: '添加新主机配置',
|
|
348
|
+
formTitleEdit: '编辑主机配置',
|
|
349
|
+
fName: '配置别名',
|
|
350
|
+
fHost: '主机名 / IP 地址',
|
|
351
|
+
fPort: '端口',
|
|
352
|
+
fUser: '登录用户名',
|
|
353
|
+
fAuthType: '身份认证方式',
|
|
354
|
+
fAuthKey: 'SSH 私钥',
|
|
355
|
+
fAuthPass: '账户密码',
|
|
356
|
+
fKeyPath: '私钥文件路径',
|
|
357
|
+
fKeyPathHint: '例如 ~/.ssh/id_rsa 或 /home/user/.ssh/id_ed25519',
|
|
358
|
+
fPassphrase: '私钥口令 (可选)',
|
|
359
|
+
fPassword: '登录密码',
|
|
360
|
+
fRemotePath: '远程项目工作区目录',
|
|
361
|
+
fRemotePathHint: '服务器上的绝对路径 (例如 /home/user/my-project)',
|
|
362
|
+
fLocalMirror: '本地镜像同步目录',
|
|
363
|
+
fLocalMirrorHint: '用于 3-way 差异比对与快速同步的本地镜像路径',
|
|
364
|
+
btnBrowse: '📁 浏览远程目录...',
|
|
365
|
+
btnSelectThis: '选择当前目录',
|
|
366
|
+
btnTest: '⚡ 测试网络连通性 (Ping)',
|
|
367
|
+
btnSave: '保存配置',
|
|
368
|
+
btnCancel: '取消',
|
|
369
|
+
testing: '正在测试连接...',
|
|
370
|
+
saving: '正在保存...',
|
|
371
|
+
testOk: '✅ 连接成功!延迟: {latency} ms | 系统: {os}',
|
|
372
|
+
testFail: '❌ 连接失败: {err}',
|
|
373
|
+
diagTitle: '📊 实时连接状态诊断',
|
|
374
|
+
diagDesc: '查看当前选定主机的网络延迟、系统资源及底层服务运行指标。',
|
|
375
|
+
diagProbeBtn: '⚡ 即时探测',
|
|
376
|
+
syncTitle: '🔄 双向工作区镜像同步',
|
|
377
|
+
syncDesc: '基于三方冲突感知的快速差异同步,支持本地与远程端双向推拉。',
|
|
378
|
+
pullBtn: '⬇️ 拉取至本地 (Pull)',
|
|
379
|
+
pushBtn: '⬆️ 推送至远程 (Push)',
|
|
380
|
+
pulling: '正在拉取文件…',
|
|
381
|
+
pushing: '正在推送文件…',
|
|
382
|
+
syncOk: '同步完成!共更新 {count} 个文件。',
|
|
383
|
+
syncConflict: '冲突警告: 检测到 {count} 个文件在两端均有修改。',
|
|
384
|
+
syncErr: '同步异常: {err}',
|
|
385
|
+
tunnelsTitle: '🔀 SSH 端口安全隧道',
|
|
386
|
+
tunnelsDesc: '通过加密 SSH 隧道将远程端口 (如数据库、开发服务、API) 映射至本地访问。',
|
|
387
|
+
tLocalPort: '本地监听端口',
|
|
388
|
+
tRemotePort: '远程目标端口',
|
|
389
|
+
tOpenBtn: '+ 建立隧道',
|
|
390
|
+
tOpening: '正在建立…',
|
|
391
|
+
tStopBtn: '关闭',
|
|
392
|
+
tNoTunnels: '当前没有运行中的端口转发隧道。',
|
|
393
|
+
tunnelsColId: '隧道标识',
|
|
394
|
+
tunnelsColRoute: '转发路由',
|
|
395
|
+
tunnelsColActions: '管理操作',
|
|
396
|
+
tOpenOk: '隧道已启动: 127.0.0.1:{localPort} -> Remote:{remotePort}',
|
|
397
|
+
tOpenErr: '启动隧道失败: {err}'
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function makeT(dict, fallback) {
|
|
401
|
+
return function t(key, vars) {
|
|
402
|
+
let val = (dict && dict[key]) || (fallback && fallback[key]) || key
|
|
403
|
+
if (vars && typeof val === 'string') {
|
|
404
|
+
for (const k of Object.keys(vars)) {
|
|
405
|
+
val = val.replace(new RegExp('\\{' + k + '\\}', 'g'), String(vars[k]))
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return val
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
let ChevronIcon = null;
|
|
413
|
+
try {
|
|
414
|
+
const primitives = require('@deepseek-ai/dsh-client-ui-primitives');
|
|
415
|
+
ChevronIcon = primitives && primitives.IconChevronDownOutline14;
|
|
416
|
+
} catch (err) {
|
|
417
|
+
ChevronIcon = null;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
function FallbackChevron() {
|
|
421
|
+
return React.createElement(
|
|
422
|
+
'svg',
|
|
423
|
+
{ width: 14, height: 14, viewBox: '0 0 14 14', fill: 'none', 'aria-hidden': true },
|
|
424
|
+
React.createElement('path', {
|
|
425
|
+
d: 'M3.5 5.25L7 8.75L10.5 5.25',
|
|
426
|
+
stroke: 'currentColor',
|
|
427
|
+
strokeWidth: 1.5,
|
|
428
|
+
strokeLinecap: 'round',
|
|
429
|
+
strokeLinejoin: 'round',
|
|
430
|
+
})
|
|
431
|
+
)
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
// --- Sub-component: Remote Environment Tab (New in v0.3.1) ---
|
|
438
|
+
function EnvTab(props) {
|
|
439
|
+
const { activeProfile, t } = props
|
|
440
|
+
const [envEntries, setEnvEntries] = React.useState([])
|
|
441
|
+
const [loading, setLoading] = React.useState(false)
|
|
442
|
+
const [visibleKeys, setVisibleKeys] = React.useState({})
|
|
443
|
+
const [editValues, setEditValues] = React.useState({})
|
|
444
|
+
const [msg, setMsg] = React.useState('')
|
|
445
|
+
|
|
446
|
+
const loadEnv = async () => {
|
|
447
|
+
if (!activeProfile) return
|
|
448
|
+
setLoading(true)
|
|
449
|
+
try {
|
|
450
|
+
const res = await fetch('/dsh-remote-workspace/env/view', {
|
|
451
|
+
method: 'POST',
|
|
452
|
+
headers: { 'Content-Type': 'application/json' },
|
|
453
|
+
body: JSON.stringify({ profileId: activeProfile.id })
|
|
454
|
+
})
|
|
455
|
+
const data = await res.json()
|
|
456
|
+
if (data.ok && Array.isArray(data.entries)) {
|
|
457
|
+
setEnvEntries(data.entries.filter((e) => e.type === 'var'))
|
|
458
|
+
const initialEdits = {}
|
|
459
|
+
data.entries.forEach((e) => {
|
|
460
|
+
if (e.type === 'var') initialEdits[e.key] = e.value
|
|
461
|
+
})
|
|
462
|
+
setEditValues(initialEdits)
|
|
463
|
+
}
|
|
464
|
+
} catch (err) {
|
|
465
|
+
setMsg(`Error loading .env: ${err.message}`)
|
|
466
|
+
}
|
|
467
|
+
setLoading(false)
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
React.useEffect(() => {
|
|
471
|
+
loadEnv()
|
|
472
|
+
}, [activeProfile?.id])
|
|
473
|
+
|
|
474
|
+
const toggleVisible = (key) => {
|
|
475
|
+
setVisibleKeys((prev) => ({ ...prev, [key]: !prev[key] }))
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
const saveVar = async (key) => {
|
|
479
|
+
try {
|
|
480
|
+
const res = await fetch('/dsh-remote-workspace/env/save', {
|
|
481
|
+
method: 'POST',
|
|
482
|
+
headers: { 'Content-Type': 'application/json' },
|
|
483
|
+
body: JSON.stringify({
|
|
484
|
+
profileId: activeProfile.id,
|
|
485
|
+
key,
|
|
486
|
+
value: editValues[key] || ''
|
|
487
|
+
})
|
|
488
|
+
})
|
|
489
|
+
const data = await res.json()
|
|
490
|
+
if (data.ok) {
|
|
491
|
+
setMsg(`Saved ${key} successfully!`)
|
|
492
|
+
setTimeout(() => setMsg(''), 3000)
|
|
493
|
+
}
|
|
494
|
+
} catch (err) {
|
|
495
|
+
setMsg(`Save failed: ${err.message}`)
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
return React.createElement(
|
|
500
|
+
'div',
|
|
501
|
+
{ style: { display: 'flex', flexDirection: 'column', gap: '14px' } },
|
|
502
|
+
React.createElement(
|
|
503
|
+
'div',
|
|
504
|
+
{ style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
|
|
505
|
+
React.createElement('div', { style: { fontWeight: 600, fontSize: '14px' } }, t('envTitle')),
|
|
506
|
+
React.createElement('button', { type: 'button', className: 'drw-btn', onClick: loadEnv, disabled: loading }, loading ? 'Loading...' : '🔄 Refresh')
|
|
507
|
+
),
|
|
508
|
+
msg ? React.createElement('div', { className: 'drw-badge drw-badge-ok' }, msg) : null,
|
|
509
|
+
React.createElement(
|
|
510
|
+
'div',
|
|
511
|
+
{ style: { border: '1px solid var(--dsw-alias-border-l2)', borderRadius: '8px', padding: '12px', background: 'var(--dsw-alias-bg-layer-2)' } },
|
|
512
|
+
envEntries.length === 0
|
|
513
|
+
? React.createElement('div', { style: { textAlign: 'center', padding: '16px', color: 'var(--dsw-alias-label-secondary)' } }, 'No variables found in remote .env')
|
|
514
|
+
: envEntries.map((e) =>
|
|
515
|
+
React.createElement(
|
|
516
|
+
'div',
|
|
517
|
+
{ key: e.key, className: 'drw-env-row' },
|
|
518
|
+
React.createElement('span', { style: { fontWeight: 600, fontFamily: 'monospace', fontSize: '12.5px' } }, e.key),
|
|
519
|
+
React.createElement('input', {
|
|
520
|
+
type: visibleKeys[e.key] ? 'text' : 'password',
|
|
521
|
+
className: 'drw-input',
|
|
522
|
+
value: editValues[e.key] !== undefined ? editValues[e.key] : e.value,
|
|
523
|
+
onChange: (ev) => {
|
|
524
|
+
const val = ev.target.value
|
|
525
|
+
setEditValues((prev) => ({ ...prev, [e.key]: val }))
|
|
526
|
+
}
|
|
527
|
+
}),
|
|
528
|
+
React.createElement(
|
|
529
|
+
'div',
|
|
530
|
+
{ style: { display: 'flex', gap: '4px', justifyContent: 'flex-end' } },
|
|
531
|
+
React.createElement('button', { type: 'button', className: 'drw-btn', style: { padding: '2px 6px', fontSize: '11px' }, onClick: () => toggleVisible(e.key) }, visibleKeys[e.key] ? t('envHideVal') : t('envShowVal')),
|
|
532
|
+
React.createElement('button', { type: 'button', className: 'drw-btn drw-btn-primary', style: { padding: '2px 6px', fontSize: '11px' }, onClick: () => saveVar(e.key) }, t('envSaveVar'))
|
|
533
|
+
)
|
|
534
|
+
)
|
|
535
|
+
)
|
|
536
|
+
)
|
|
537
|
+
)
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// --- Sub-component: Docker Containers Tab ---
|
|
541
|
+
function ContainersTab(props) {
|
|
542
|
+
const { activeProfile, t } = props
|
|
543
|
+
const [containers, setContainers] = React.useState([])
|
|
544
|
+
const [loading, setLoading] = React.useState(false)
|
|
545
|
+
const [logsModal, setLogsModal] = React.useState(null)
|
|
546
|
+
const [logsContent, setLogsContent] = React.useState('')
|
|
547
|
+
const [logsLoading, setLogsLoading] = React.useState(false)
|
|
548
|
+
|
|
549
|
+
const loadContainers = async () => {
|
|
550
|
+
if (!activeProfile) return
|
|
551
|
+
setLoading(true)
|
|
552
|
+
try {
|
|
553
|
+
const res = await fetch(`/dsh-remote-workspace/docker/list?profileId=${activeProfile.id}`)
|
|
554
|
+
const data = await res.json()
|
|
555
|
+
if (data.ok && Array.isArray(data.containers)) {
|
|
556
|
+
setContainers(data.containers)
|
|
557
|
+
} else {
|
|
558
|
+
setContainers([])
|
|
559
|
+
}
|
|
560
|
+
} catch (err) { /* best-effort cleanup */ }
|
|
561
|
+
setLoading(false)
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
React.useEffect(() => {
|
|
565
|
+
loadContainers()
|
|
566
|
+
}, [activeProfile?.id])
|
|
567
|
+
|
|
568
|
+
const handleAction = async (containerId, action) => {
|
|
569
|
+
try {
|
|
570
|
+
await fetch('/dsh-remote-workspace/docker/action', {
|
|
571
|
+
method: 'POST',
|
|
572
|
+
headers: { 'Content-Type': 'application/json' },
|
|
573
|
+
body: JSON.stringify({ profileId: activeProfile.id, containerId, action })
|
|
574
|
+
})
|
|
575
|
+
await loadContainers()
|
|
576
|
+
} catch (err) { /* best-effort cleanup */ }
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
const showLogs = async (containerId, name) => {
|
|
580
|
+
setLogsModal({ id: containerId, name })
|
|
581
|
+
setLogsLoading(true)
|
|
582
|
+
try {
|
|
583
|
+
const res = await fetch('/dsh-remote-workspace/docker/logs', {
|
|
584
|
+
method: 'POST',
|
|
585
|
+
headers: { 'Content-Type': 'application/json' },
|
|
586
|
+
body: JSON.stringify({ profileId: activeProfile.id, containerId, tail: 150 })
|
|
587
|
+
})
|
|
588
|
+
const data = await res.json()
|
|
589
|
+
setLogsContent(data.logs || '[No logs output]')
|
|
590
|
+
} catch (err) {
|
|
591
|
+
setLogsContent(`[Error: ${err.message}]`)
|
|
592
|
+
}
|
|
593
|
+
setLogsLoading(false)
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
return React.createElement(
|
|
597
|
+
'div',
|
|
598
|
+
{ style: { display: 'flex', flexDirection: 'column', gap: '12px' } },
|
|
599
|
+
React.createElement(
|
|
600
|
+
'div',
|
|
601
|
+
{ style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
|
|
602
|
+
React.createElement('div', { style: { fontWeight: 600, fontSize: '14px' } }, t('containersTitle')),
|
|
603
|
+
React.createElement(
|
|
604
|
+
'button',
|
|
605
|
+
{
|
|
606
|
+
type: 'button',
|
|
607
|
+
className: 'drw-btn',
|
|
608
|
+
onClick: loadContainers,
|
|
609
|
+
disabled: loading
|
|
610
|
+
},
|
|
611
|
+
loading ? 'Refreshing...' : '🔄 Refresh'
|
|
612
|
+
)
|
|
613
|
+
),
|
|
614
|
+
React.createElement(
|
|
615
|
+
'div',
|
|
616
|
+
{ style: { border: '1px solid var(--dsw-alias-border-l2)', borderRadius: '8px', overflow: 'hidden', background: 'var(--dsw-alias-bg-layer-2)' } },
|
|
617
|
+
React.createElement(
|
|
618
|
+
'div',
|
|
619
|
+
{ className: 'drw-container-row', style: { fontWeight: 600, color: 'var(--dsw-alias-label-secondary)', background: 'var(--dsw-alias-bg-layer-1)' } },
|
|
620
|
+
React.createElement('span', null, t('containerName')),
|
|
621
|
+
React.createElement('span', null, t('containerImage')),
|
|
622
|
+
React.createElement('span', null, t('containerStatus')),
|
|
623
|
+
React.createElement('span', null, t('containerPorts')),
|
|
624
|
+
React.createElement('span', { style: { textAlign: 'right' } }, t('actionsCol'))
|
|
625
|
+
),
|
|
626
|
+
containers.length === 0
|
|
627
|
+
? React.createElement('div', { style: { padding: '24px', textAlign: 'center', color: 'var(--dsw-alias-label-secondary)' } }, t('noContainers'))
|
|
628
|
+
: containers.map((c) =>
|
|
629
|
+
React.createElement(
|
|
630
|
+
'div',
|
|
631
|
+
{ key: c.id, className: 'drw-container-row' },
|
|
632
|
+
React.createElement(
|
|
633
|
+
'div',
|
|
634
|
+
{ style: { display: 'flex', alignItems: 'center', gap: '6px' } },
|
|
635
|
+
React.createElement('span', { className: `drw-badge ${c.state === 'running' ? 'drw-badge-ok' : 'drw-badge-warn'}` }, c.state),
|
|
636
|
+
React.createElement('span', { style: { fontWeight: 600 } }, c.names)
|
|
637
|
+
),
|
|
638
|
+
React.createElement('span', { style: { opacity: 0.8, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, c.image),
|
|
639
|
+
React.createElement('span', { style: { fontSize: '11px', opacity: 0.7 } }, c.status),
|
|
640
|
+
React.createElement('span', { style: { fontSize: '11px', opacity: 0.7, overflow: 'hidden', textOverflow: 'ellipsis' } }, c.ports || '—'),
|
|
641
|
+
React.createElement(
|
|
642
|
+
'div',
|
|
643
|
+
{ style: { display: 'flex', gap: '4px', justifyContent: 'flex-end' } },
|
|
644
|
+
React.createElement(
|
|
645
|
+
'button',
|
|
646
|
+
{ type: 'button', className: 'drw-btn', style: { padding: '2px 6px', fontSize: '11px' }, onClick: () => showLogs(c.id, c.names) },
|
|
647
|
+
t('btnLogs')
|
|
648
|
+
),
|
|
649
|
+
React.createElement(
|
|
650
|
+
'button',
|
|
651
|
+
{ type: 'button', className: 'drw-btn', style: { padding: '2px 6px', fontSize: '11px' }, onClick: () => handleAction(c.id, 'restart') },
|
|
652
|
+
t('btnRestart')
|
|
653
|
+
),
|
|
654
|
+
c.state === 'running'
|
|
655
|
+
? React.createElement(
|
|
656
|
+
'button',
|
|
657
|
+
{ type: 'button', className: 'drw-btn drw-btn-danger', style: { padding: '2px 6px', fontSize: '11px' }, onClick: () => handleAction(c.id, 'stop') },
|
|
658
|
+
t('btnStop')
|
|
659
|
+
)
|
|
660
|
+
: null
|
|
661
|
+
)
|
|
662
|
+
)
|
|
663
|
+
)
|
|
664
|
+
),
|
|
665
|
+
// Container Logs Modal
|
|
666
|
+
logsModal
|
|
667
|
+
? React.createElement(
|
|
668
|
+
'div',
|
|
669
|
+
{ className: 'drw-modal-overlay', onClick: () => setLogsModal(null) },
|
|
670
|
+
React.createElement(
|
|
671
|
+
'div',
|
|
672
|
+
{ className: 'drw-modal-dialog', onClick: (e) => e.stopPropagation() },
|
|
673
|
+
React.createElement(
|
|
674
|
+
'div',
|
|
675
|
+
{ className: 'drw-modal-hdr' },
|
|
676
|
+
React.createElement('span', { style: { fontFamily: 'monospace' } }, `Docker Logs: ${logsModal.name} (${logsModal.id})`),
|
|
677
|
+
React.createElement('button', { type: 'button', className: 'drw-btn', onClick: () => setLogsModal(null) }, '✕')
|
|
678
|
+
),
|
|
679
|
+
React.createElement(
|
|
680
|
+
'div',
|
|
681
|
+
{ className: 'drw-modal-body' },
|
|
682
|
+
React.createElement('pre', { style: { background: 'var(--dsw-alias-bg-layer-1)', color: 'var(--dsw-alias-label-primary)', padding: '12px', borderRadius: '8px', fontSize: '12px', maxHeight: '420px', overflowY: 'auto', whiteSpace: 'pre-wrap' } }, logsLoading ? 'Fetching logs...' : logsContent)
|
|
683
|
+
)
|
|
684
|
+
)
|
|
685
|
+
)
|
|
686
|
+
: null
|
|
687
|
+
)
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// --- Sub-component: Web Terminal Tab ---
|
|
691
|
+
function TerminalTab(props) {
|
|
692
|
+
const { activeProfile, t } = props
|
|
693
|
+
const [connected, setConnected] = React.useState(false)
|
|
694
|
+
const [sessionId, setSessionId] = React.useState(null)
|
|
695
|
+
const [output, setOutput] = React.useState('')
|
|
696
|
+
const [cmdInput, setCmdInput] = React.useState('')
|
|
697
|
+
const [loading, setLoading] = React.useState(false)
|
|
698
|
+
const termEndRef = React.useRef(null)
|
|
699
|
+
const evtSourceRef = React.useRef(null)
|
|
700
|
+
|
|
701
|
+
React.useEffect(() => {
|
|
702
|
+
if (termEndRef.current) {
|
|
703
|
+
termEndRef.current.scrollIntoView({ behavior: 'smooth' })
|
|
704
|
+
}
|
|
705
|
+
}, [output])
|
|
706
|
+
|
|
707
|
+
React.useEffect(() => {
|
|
708
|
+
return () => {
|
|
709
|
+
if (evtSourceRef.current) {
|
|
710
|
+
evtSourceRef.current.close()
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}, [])
|
|
714
|
+
|
|
715
|
+
const handleConnect = async () => {
|
|
716
|
+
if (!activeProfile) return
|
|
717
|
+
setLoading(true)
|
|
718
|
+
try {
|
|
719
|
+
const res = await fetch('/dsh-remote-workspace/terminal/create', {
|
|
720
|
+
method: 'POST',
|
|
721
|
+
headers: { 'Content-Type': 'application/json' },
|
|
722
|
+
body: JSON.stringify({ profileId: activeProfile.id, cols: 80, rows: 24 })
|
|
723
|
+
})
|
|
724
|
+
const data = await res.json()
|
|
725
|
+
if (data.ok && data.sessionId) {
|
|
726
|
+
setSessionId(data.sessionId)
|
|
727
|
+
setConnected(true)
|
|
728
|
+
setOutput((prev) => prev + `\n[+] ` + t('termConnected', { id: data.sessionId, host: activeProfile.host }) + `\n`)
|
|
729
|
+
|
|
730
|
+
// Connect SSE stream
|
|
731
|
+
const es = new EventSource(`/dsh-remote-workspace/terminal/stream?sessionId=${data.sessionId}`)
|
|
732
|
+
evtSourceRef.current = es
|
|
733
|
+
es.onmessage = (e) => {
|
|
734
|
+
try {
|
|
735
|
+
const parsed = JSON.parse(e.data)
|
|
736
|
+
if (parsed.chunk) {
|
|
737
|
+
setOutput((p) => p + parsed.chunk)
|
|
738
|
+
}
|
|
739
|
+
} catch (err) { /* best-effort cleanup */ }
|
|
740
|
+
}
|
|
741
|
+
es.onerror = () => {
|
|
742
|
+
setOutput((p) => p + `\n[-] ` + t('termDisconnected') + `\n`)
|
|
743
|
+
setConnected(false)
|
|
744
|
+
es.close()
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
} catch (err) {
|
|
748
|
+
setOutput((p) => p + `\n[!] Connection error: ${err.message}\n`)
|
|
749
|
+
}
|
|
750
|
+
setLoading(false)
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
const handleDisconnect = async () => {
|
|
754
|
+
if (sessionId) {
|
|
755
|
+
try {
|
|
756
|
+
await fetch('/dsh-remote-workspace/terminal/close', {
|
|
757
|
+
method: 'POST',
|
|
758
|
+
headers: { 'Content-Type': 'application/json' },
|
|
759
|
+
body: JSON.stringify({ sessionId })
|
|
760
|
+
})
|
|
761
|
+
} catch (err) { /* best-effort cleanup */ }
|
|
762
|
+
}
|
|
763
|
+
if (evtSourceRef.current) {
|
|
764
|
+
evtSourceRef.current.close()
|
|
765
|
+
}
|
|
766
|
+
setConnected(false)
|
|
767
|
+
setSessionId(null)
|
|
768
|
+
setOutput((p) => p + `\n[-] ` + t('termDisconnected') + `\n`)
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
const sendCommand = async (e) => {
|
|
772
|
+
if (e) e.preventDefault()
|
|
773
|
+
if (!cmdInput || !sessionId) return
|
|
774
|
+
const toSend = cmdInput + '\n'
|
|
775
|
+
setCmdInput('')
|
|
776
|
+
try {
|
|
777
|
+
await fetch('/dsh-remote-workspace/terminal/input', {
|
|
778
|
+
method: 'POST',
|
|
779
|
+
headers: { 'Content-Type': 'application/json' },
|
|
780
|
+
body: JSON.stringify({ sessionId, data: toSend })
|
|
781
|
+
})
|
|
782
|
+
} catch (err) { /* best-effort cleanup */ }
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
const sendCtrlC = async () => {
|
|
786
|
+
if (!sessionId) return
|
|
787
|
+
try {
|
|
788
|
+
await fetch('/dsh-remote-workspace/terminal/input', {
|
|
789
|
+
method: 'POST',
|
|
790
|
+
headers: { 'Content-Type': 'application/json' },
|
|
791
|
+
body: JSON.stringify({ sessionId, data: '\x03' })
|
|
792
|
+
})
|
|
793
|
+
} catch (err) { /* best-effort cleanup */ }
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
return React.createElement(
|
|
797
|
+
'div',
|
|
798
|
+
{ style: { display: 'flex', flexDirection: 'column', gap: '12px' } },
|
|
799
|
+
React.createElement(
|
|
800
|
+
'div',
|
|
801
|
+
{ style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', flexWrap: 'wrap', gap: '8px' } },
|
|
802
|
+
React.createElement(
|
|
803
|
+
'div',
|
|
804
|
+
{ style: { display: 'flex', alignItems: 'center', gap: '8px' } },
|
|
805
|
+
React.createElement('span', { style: { fontWeight: 600, fontSize: '14px' } }, 'SSH PTY Shell:'),
|
|
806
|
+
React.createElement(
|
|
807
|
+
'span',
|
|
808
|
+
{ className: `drw-badge ${connected ? 'drw-badge-ok' : 'drw-badge-warn'}` },
|
|
809
|
+
connected ? `🟢 Online (${activeProfile?.host})` : '⚪ Idle'
|
|
810
|
+
)
|
|
811
|
+
),
|
|
812
|
+
React.createElement(
|
|
813
|
+
'div',
|
|
814
|
+
{ style: { display: 'flex', gap: '8px' } },
|
|
815
|
+
!connected
|
|
816
|
+
? React.createElement(
|
|
817
|
+
'button',
|
|
818
|
+
{
|
|
819
|
+
type: 'button',
|
|
820
|
+
className: 'drw-btn drw-btn-primary',
|
|
821
|
+
disabled: !activeProfile || loading,
|
|
822
|
+
onClick: handleConnect
|
|
823
|
+
},
|
|
824
|
+
loading ? 'Connecting...' : t('termStart')
|
|
825
|
+
)
|
|
826
|
+
: React.createElement(
|
|
827
|
+
'button',
|
|
828
|
+
{
|
|
829
|
+
type: 'button',
|
|
830
|
+
className: 'drw-btn drw-btn-danger',
|
|
831
|
+
onClick: handleDisconnect
|
|
832
|
+
},
|
|
833
|
+
t('termStop')
|
|
834
|
+
),
|
|
835
|
+
connected
|
|
836
|
+
? React.createElement(
|
|
837
|
+
'button',
|
|
838
|
+
{
|
|
839
|
+
type: 'button',
|
|
840
|
+
className: 'drw-btn',
|
|
841
|
+
onClick: sendCtrlC
|
|
842
|
+
},
|
|
843
|
+
'Ctrl+C'
|
|
844
|
+
)
|
|
845
|
+
: null,
|
|
846
|
+
React.createElement(
|
|
847
|
+
'button',
|
|
848
|
+
{
|
|
849
|
+
type: 'button',
|
|
850
|
+
className: 'drw-btn',
|
|
851
|
+
onClick: () => setOutput('')
|
|
852
|
+
},
|
|
853
|
+
t('termClear')
|
|
854
|
+
)
|
|
855
|
+
)
|
|
856
|
+
),
|
|
857
|
+
React.createElement(
|
|
858
|
+
'div',
|
|
859
|
+
{ className: 'drw-term-window' },
|
|
860
|
+
React.createElement(
|
|
861
|
+
'div',
|
|
862
|
+
{ className: 'drw-term-header' },
|
|
863
|
+
React.createElement('span', null, `terminal ~ ${activeProfile?.username || 'user'}@${activeProfile?.host || 'remote'}`),
|
|
864
|
+
React.createElement('span', null, connected ? `Session: ${sessionId}` : 'Offline')
|
|
865
|
+
),
|
|
866
|
+
React.createElement(
|
|
867
|
+
'div',
|
|
868
|
+
{ className: 'drw-term-body' },
|
|
869
|
+
output || (activeProfile ? `[i] Ready to connect to ${activeProfile.username || 'root'}@${activeProfile.host}. Click 'Connect Terminal'.` : `[!] No active host profile selected. Configure and activate a profile first.`),
|
|
870
|
+
React.createElement('div', { ref: termEndRef })
|
|
871
|
+
),
|
|
872
|
+
connected
|
|
873
|
+
? React.createElement(
|
|
874
|
+
'form',
|
|
875
|
+
{ className: 'drw-term-footer', onSubmit: sendCommand },
|
|
876
|
+
React.createElement('span', { style: { color: 'var(--dsw-alias-link-primary)', padding: '4px 6px', fontFamily: 'monospace' } }, '$'),
|
|
877
|
+
React.createElement('input', {
|
|
878
|
+
className: 'drw-term-input',
|
|
879
|
+
type: 'text',
|
|
880
|
+
placeholder: t('termPlaceholder'),
|
|
881
|
+
value: cmdInput,
|
|
882
|
+
onChange: (e) => setCmdInput(e.target.value)
|
|
883
|
+
}),
|
|
884
|
+
React.createElement(
|
|
885
|
+
'button',
|
|
886
|
+
{ type: 'submit', className: 'drw-btn', style: { padding: '2px 8px', fontSize: '11px' } },
|
|
887
|
+
'Send ↵'
|
|
888
|
+
)
|
|
889
|
+
)
|
|
890
|
+
: null
|
|
891
|
+
)
|
|
892
|
+
)
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// --- Sub-component: Remote File Explorer Tab ---
|
|
896
|
+
function ExplorerTab(props) {
|
|
897
|
+
const { activeProfile, t } = props
|
|
898
|
+
const [currentPath, setCurrentPath] = React.useState(activeProfile?.remoteWorkspace || '/')
|
|
899
|
+
const [entries, setEntries] = React.useState([])
|
|
900
|
+
const [loading, setLoading] = React.useState(false)
|
|
901
|
+
const [previewFile, setPreviewFile] = React.useState(null)
|
|
902
|
+
const [previewContent, setPreviewContent] = React.useState('')
|
|
903
|
+
const [editContent, setEditContent] = React.useState('')
|
|
904
|
+
const [previewLoading, setPreviewLoading] = React.useState(false)
|
|
905
|
+
const [saveStatus, setSaveStatus] = React.useState(null)
|
|
906
|
+
|
|
907
|
+
const loadDir = async (dirPath) => {
|
|
908
|
+
if (!activeProfile) return
|
|
909
|
+
setLoading(true)
|
|
910
|
+
try {
|
|
911
|
+
const res = await fetch('/dsh-remote-workspace/browse', {
|
|
912
|
+
method: 'POST',
|
|
913
|
+
headers: { 'Content-Type': 'application/json' },
|
|
914
|
+
body: JSON.stringify({ profileId: activeProfile.id, remotePath: dirPath })
|
|
915
|
+
})
|
|
916
|
+
const data = await res.json()
|
|
917
|
+
if (data.ok && Array.isArray(data.entries)) {
|
|
918
|
+
setCurrentPath(dirPath)
|
|
919
|
+
setEntries(data.entries)
|
|
920
|
+
}
|
|
921
|
+
} catch (err) { /* best-effort cleanup */ }
|
|
922
|
+
setLoading(false)
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
React.useEffect(() => {
|
|
926
|
+
if (activeProfile) {
|
|
927
|
+
loadDir(activeProfile.remoteWorkspace || '/')
|
|
928
|
+
}
|
|
929
|
+
}, [activeProfile?.id])
|
|
930
|
+
|
|
931
|
+
const handleNavUp = () => {
|
|
932
|
+
const parts = currentPath.split('/').filter(Boolean)
|
|
933
|
+
parts.pop()
|
|
934
|
+
const parent = '/' + parts.join('/')
|
|
935
|
+
loadDir(parent || '/')
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
const openFile = async (entry) => {
|
|
939
|
+
const filePath = currentPath.endsWith('/') ? currentPath + entry.filename : currentPath + '/' + entry.filename
|
|
940
|
+
setPreviewLoading(true)
|
|
941
|
+
setPreviewFile(filePath)
|
|
942
|
+
setSaveStatus(null)
|
|
943
|
+
try {
|
|
944
|
+
const res = await fetch('/dsh-remote-workspace/file/view', {
|
|
945
|
+
method: 'POST',
|
|
946
|
+
headers: { 'Content-Type': 'application/json' },
|
|
947
|
+
body: JSON.stringify({ profileId: activeProfile.id, filePath })
|
|
948
|
+
})
|
|
949
|
+
const data = await res.json()
|
|
950
|
+
if (data.ok) {
|
|
951
|
+
setPreviewContent(data.content)
|
|
952
|
+
setEditContent(data.content)
|
|
953
|
+
} else {
|
|
954
|
+
setPreviewContent(`[Error loading file: ${data.error || 'Failed'}]`)
|
|
955
|
+
setEditContent('')
|
|
956
|
+
}
|
|
957
|
+
} catch (err) {
|
|
958
|
+
setPreviewContent(`[Error: ${err.message}]`)
|
|
959
|
+
}
|
|
960
|
+
setPreviewLoading(false)
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
const handleSaveFile = async () => {
|
|
964
|
+
if (!previewFile || !activeProfile) return
|
|
965
|
+
setSaveStatus('saving')
|
|
966
|
+
try {
|
|
967
|
+
const res = await fetch('/dsh-remote-workspace/file/save', {
|
|
968
|
+
method: 'POST',
|
|
969
|
+
headers: { 'Content-Type': 'application/json' },
|
|
970
|
+
body: JSON.stringify({ profileId: activeProfile.id, filePath: previewFile, content: editContent })
|
|
971
|
+
})
|
|
972
|
+
const data = await res.json()
|
|
973
|
+
if (data.ok) {
|
|
974
|
+
setSaveStatus('saved')
|
|
975
|
+
setPreviewContent(editContent)
|
|
976
|
+
} else {
|
|
977
|
+
setSaveStatus('error')
|
|
978
|
+
}
|
|
979
|
+
} catch (_) {
|
|
980
|
+
setSaveStatus('error')
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
return React.createElement(
|
|
985
|
+
'div',
|
|
986
|
+
{ className: 'drw-explorer-box' },
|
|
987
|
+
React.createElement(
|
|
988
|
+
'div',
|
|
989
|
+
{ style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
|
|
990
|
+
React.createElement('div', { style: { fontWeight: 600, fontSize: '14px' } }, t('explorerTitle')),
|
|
991
|
+
React.createElement(
|
|
992
|
+
'button',
|
|
993
|
+
{
|
|
994
|
+
type: 'button',
|
|
995
|
+
className: 'drw-btn',
|
|
996
|
+
onClick: () => loadDir(currentPath),
|
|
997
|
+
disabled: loading
|
|
998
|
+
},
|
|
999
|
+
loading ? 'Refreshing...' : '🔄 Refresh'
|
|
1000
|
+
)
|
|
1001
|
+
),
|
|
1002
|
+
React.createElement(
|
|
1003
|
+
'div',
|
|
1004
|
+
{ className: 'drw-explorer-nav' },
|
|
1005
|
+
React.createElement(
|
|
1006
|
+
'button',
|
|
1007
|
+
{
|
|
1008
|
+
type: 'button',
|
|
1009
|
+
className: 'drw-btn',
|
|
1010
|
+
style: { padding: '2px 8px', fontSize: '11px' },
|
|
1011
|
+
onClick: handleNavUp,
|
|
1012
|
+
disabled: currentPath === '/' || loading
|
|
1013
|
+
},
|
|
1014
|
+
'⬆️ Up'
|
|
1015
|
+
),
|
|
1016
|
+
React.createElement('span', { style: { color: 'var(--dsw-alias-label-secondary)' } }, 'Path:'),
|
|
1017
|
+
React.createElement('span', { style: { fontWeight: 600, color: 'var(--dsw-alias-state-brand-primary)' } }, currentPath)
|
|
1018
|
+
),
|
|
1019
|
+
React.createElement(
|
|
1020
|
+
'div',
|
|
1021
|
+
{ className: 'drw-file-list' },
|
|
1022
|
+
entries.length === 0
|
|
1023
|
+
? React.createElement('div', { style: { padding: '16px', textAlign: 'center', color: 'var(--dsw-alias-label-secondary)' } }, loading ? 'Reading directory...' : 'Directory is empty.')
|
|
1024
|
+
: entries.map((e) =>
|
|
1025
|
+
React.createElement(
|
|
1026
|
+
'div',
|
|
1027
|
+
{
|
|
1028
|
+
key: e.filename,
|
|
1029
|
+
className: 'drw-file-row',
|
|
1030
|
+
onClick: () => (e.isDirectory ? loadDir(currentPath.endsWith('/') ? currentPath + e.filename : currentPath + '/' + e.filename) : openFile(e))
|
|
1031
|
+
},
|
|
1032
|
+
React.createElement(
|
|
1033
|
+
'div',
|
|
1034
|
+
{ style: { display: 'flex', alignItems: 'center', gap: '8px' } },
|
|
1035
|
+
React.createElement('span', null, e.isDirectory ? '📁' : '📄'),
|
|
1036
|
+
React.createElement('span', { style: { fontWeight: e.isDirectory ? 600 : 400 } }, e.filename)
|
|
1037
|
+
),
|
|
1038
|
+
React.createElement(
|
|
1039
|
+
'div',
|
|
1040
|
+
{ className: 'drw-file-meta' },
|
|
1041
|
+
e.size !== undefined ? React.createElement('span', null, `${Math.round(e.size / 1024)} KB`) : null,
|
|
1042
|
+
e.permissions ? React.createElement('span', { style: { opacity: 0.6 } }, e.permissions) : null
|
|
1043
|
+
)
|
|
1044
|
+
)
|
|
1045
|
+
)
|
|
1046
|
+
),
|
|
1047
|
+
// File Preview / Edit Modal
|
|
1048
|
+
previewFile
|
|
1049
|
+
? React.createElement(
|
|
1050
|
+
'div',
|
|
1051
|
+
{ className: 'drw-modal-overlay', onClick: () => setPreviewFile(null) },
|
|
1052
|
+
React.createElement(
|
|
1053
|
+
'div',
|
|
1054
|
+
{ className: 'drw-modal-dialog', onClick: (e) => e.stopPropagation() },
|
|
1055
|
+
React.createElement(
|
|
1056
|
+
'div',
|
|
1057
|
+
{ className: 'drw-modal-hdr' },
|
|
1058
|
+
React.createElement('span', { style: { fontFamily: 'monospace' } }, t('filePreviewTitle', { path: previewFile })),
|
|
1059
|
+
React.createElement(
|
|
1060
|
+
'button',
|
|
1061
|
+
{
|
|
1062
|
+
type: 'button',
|
|
1063
|
+
className: 'drw-btn',
|
|
1064
|
+
style: { padding: '2px 8px' },
|
|
1065
|
+
onClick: () => setPreviewFile(null)
|
|
1066
|
+
},
|
|
1067
|
+
'✕'
|
|
1068
|
+
)
|
|
1069
|
+
),
|
|
1070
|
+
React.createElement(
|
|
1071
|
+
'div',
|
|
1072
|
+
{ className: 'drw-modal-body', style: { display: 'flex', flexDirection: 'column', gap: '10px' } },
|
|
1073
|
+
previewLoading
|
|
1074
|
+
? React.createElement('div', { style: { padding: '20px', textAlign: 'center' } }, 'Loading content...')
|
|
1075
|
+
: React.createElement('textarea', {
|
|
1076
|
+
style: {
|
|
1077
|
+
width: '100%',
|
|
1078
|
+
height: '320px',
|
|
1079
|
+
background: 'var(--dsw-alias-bg-layer-1)',
|
|
1080
|
+
color: 'var(--dsw-alias-label-primary)',
|
|
1081
|
+
fontFamily: 'monospace',
|
|
1082
|
+
fontSize: '12px',
|
|
1083
|
+
padding: '10px',
|
|
1084
|
+
border: '1px solid var(--dsw-alias-border-l2)',
|
|
1085
|
+
borderRadius: '8px',
|
|
1086
|
+
resize: 'vertical',
|
|
1087
|
+
boxSizing: 'border-box'
|
|
1088
|
+
},
|
|
1089
|
+
value: editContent,
|
|
1090
|
+
onChange: (e) => setEditContent(e.target.value)
|
|
1091
|
+
}),
|
|
1092
|
+
React.createElement(
|
|
1093
|
+
'div',
|
|
1094
|
+
{ style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
|
|
1095
|
+
React.createElement(
|
|
1096
|
+
'span',
|
|
1097
|
+
{ style: { fontSize: '12px', color: saveStatus === 'saved' ? 'var(--dsw-alias-state-success-primary)' : 'var(--dsw-alias-label-secondary)' } },
|
|
1098
|
+
saveStatus === 'saved' ? t('fileSaved') : saveStatus === 'error' ? 'Error saving file.' : ''
|
|
1099
|
+
),
|
|
1100
|
+
React.createElement(
|
|
1101
|
+
'div',
|
|
1102
|
+
{ style: { display: 'flex', gap: '8px' } },
|
|
1103
|
+
React.createElement(
|
|
1104
|
+
'button',
|
|
1105
|
+
{
|
|
1106
|
+
type: 'button',
|
|
1107
|
+
className: 'drw-btn',
|
|
1108
|
+
onClick: () => setPreviewFile(null)
|
|
1109
|
+
},
|
|
1110
|
+
'Close'
|
|
1111
|
+
),
|
|
1112
|
+
React.createElement(
|
|
1113
|
+
'button',
|
|
1114
|
+
{
|
|
1115
|
+
type: 'button',
|
|
1116
|
+
className: 'drw-btn drw-btn-primary',
|
|
1117
|
+
onClick: handleSaveFile,
|
|
1118
|
+
disabled: saveStatus === 'saving'
|
|
1119
|
+
},
|
|
1120
|
+
saveStatus === 'saving' ? 'Saving...' : t('btnSaveFile')
|
|
1121
|
+
)
|
|
1122
|
+
)
|
|
1123
|
+
)
|
|
1124
|
+
)
|
|
1125
|
+
)
|
|
1126
|
+
)
|
|
1127
|
+
: null
|
|
1128
|
+
)
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
function SettingsView(props) {
|
|
1132
|
+
const [activeTab, setActiveTab] = React.useState('profiles')
|
|
1133
|
+
const [healthData, setHealthData] = React.useState(null)
|
|
1134
|
+
const [autoSync, setAutoSync] = React.useState(false)
|
|
1135
|
+
|
|
1136
|
+
const t = props.t || (props.locale === 'zh' ? makeT(zh, en) : makeT(en, zh))
|
|
1137
|
+
const [profiles, setProfiles] = React.useState([])
|
|
1138
|
+
const [activeId, setActiveId] = React.useState(null)
|
|
1139
|
+
const [tunnels, setTunnels] = React.useState([])
|
|
1140
|
+
const [editing, setEditing] = React.useState(null)
|
|
1141
|
+
const [busy, setBusy] = React.useState(null)
|
|
1142
|
+
const [testResult, setTestResult] = React.useState(null)
|
|
1143
|
+
const [syncMsg, setSyncMsg] = React.useState(null)
|
|
1144
|
+
const [tunnelMsg, setTunnelMsg] = React.useState(null)
|
|
1145
|
+
const [showPassword, setShowPassword] = React.useState(false)
|
|
1146
|
+
|
|
1147
|
+
// Tunnel creation inputs
|
|
1148
|
+
const [newTunnelLocal, setNewTunnelLocal] = React.useState('3000')
|
|
1149
|
+
const [newTunnelRemote, setNewTunnelRemote] = React.useState('3000')
|
|
1150
|
+
|
|
1151
|
+
// Remote Directory Browser State
|
|
1152
|
+
const [browserOpen, setBrowserOpen] = React.useState(false)
|
|
1153
|
+
const [browserPath, setBrowserPath] = React.useState('/')
|
|
1154
|
+
const [browserEntries, setBrowserEntries] = React.useState([])
|
|
1155
|
+
const [browserLoading, setBrowserLoading] = React.useState(false)
|
|
1156
|
+
|
|
1157
|
+
const loadState = async () => {
|
|
1158
|
+
try {
|
|
1159
|
+
const res = await fetch('/dsh-remote-workspace/state')
|
|
1160
|
+
if (res.ok) {
|
|
1161
|
+
const data = await res.json()
|
|
1162
|
+
if (data.ok) {
|
|
1163
|
+
setProfiles(data.profiles || [])
|
|
1164
|
+
setActiveId(data.activeId || null)
|
|
1165
|
+
setTunnels(data.tunnels || [])
|
|
1166
|
+
setAutoSync(Boolean(data.autoSync))
|
|
1167
|
+
if (data.activeId) {
|
|
1168
|
+
fetch(`/dsh-remote-workspace/health?profileId=${data.activeId}`).then(r => r.json()).then(h => { if (h.ok) setHealthData(h.health) }).catch(() => {})
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
} catch (err) { /* best-effort cleanup */ }
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
React.useEffect(() => {
|
|
1176
|
+
ensureCss()
|
|
1177
|
+
loadState()
|
|
1178
|
+
}, [])
|
|
1179
|
+
|
|
1180
|
+
const handleSave = async (profile) => {
|
|
1181
|
+
setBusy('saving')
|
|
1182
|
+
try {
|
|
1183
|
+
const res = await fetch('/dsh-remote-workspace/profiles/save', {
|
|
1184
|
+
method: 'POST',
|
|
1185
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1186
|
+
body: JSON.stringify(profile)
|
|
1187
|
+
})
|
|
1188
|
+
if (res.ok) {
|
|
1189
|
+
setEditing(null)
|
|
1190
|
+
setBrowserOpen(false)
|
|
1191
|
+
setTestResult(null)
|
|
1192
|
+
await loadState()
|
|
1193
|
+
}
|
|
1194
|
+
} catch (err) { /* best-effort cleanup */ }
|
|
1195
|
+
setBusy(null)
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
const handleDelete = async (id, name) => {
|
|
1199
|
+
if (!confirm(t('delConfirm', { name: name || id }))) return
|
|
1200
|
+
try {
|
|
1201
|
+
const res = await fetch('/dsh-remote-workspace/profiles/delete', {
|
|
1202
|
+
method: 'POST',
|
|
1203
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1204
|
+
body: JSON.stringify({ id })
|
|
1205
|
+
})
|
|
1206
|
+
if (res.ok) {
|
|
1207
|
+
if (editing && editing.id === id) setEditing(null)
|
|
1208
|
+
await loadState()
|
|
1209
|
+
}
|
|
1210
|
+
} catch (err) { /* best-effort cleanup */ }
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
const handleSetActive = async (id) => {
|
|
1214
|
+
try {
|
|
1215
|
+
const res = await fetch('/dsh-remote-workspace/profiles/active', {
|
|
1216
|
+
method: 'POST',
|
|
1217
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1218
|
+
body: JSON.stringify({ id })
|
|
1219
|
+
})
|
|
1220
|
+
if (res.ok) {
|
|
1221
|
+
await loadState()
|
|
1222
|
+
}
|
|
1223
|
+
} catch (err) { /* best-effort cleanup */ }
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
const handleTest = async (prof) => {
|
|
1227
|
+
setBusy('testing')
|
|
1228
|
+
setTestResult(null)
|
|
1229
|
+
try {
|
|
1230
|
+
const res = await fetch('/dsh-remote-workspace/test', {
|
|
1231
|
+
method: 'POST',
|
|
1232
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1233
|
+
body: JSON.stringify({ profile: prof })
|
|
1234
|
+
})
|
|
1235
|
+
const data = await res.json()
|
|
1236
|
+
setTestResult(data)
|
|
1237
|
+
} catch (err) {
|
|
1238
|
+
setTestResult({ ok: false, error: err.message })
|
|
1239
|
+
}
|
|
1240
|
+
setBusy(null)
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
const openDirectoryBrowser = async (initialPath) => {
|
|
1244
|
+
setBrowserOpen(true)
|
|
1245
|
+
const target = initialPath && initialPath.startsWith('/') ? initialPath : '/'
|
|
1246
|
+
await fetchRemoteDir(target)
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
const fetchRemoteDir = async (dirPath) => {
|
|
1250
|
+
setBrowserLoading(true)
|
|
1251
|
+
try {
|
|
1252
|
+
const res = await fetch('/dsh-remote-workspace/browse', {
|
|
1253
|
+
method: 'POST',
|
|
1254
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1255
|
+
body: JSON.stringify({ profile: editing, remotePath: dirPath })
|
|
1256
|
+
})
|
|
1257
|
+
const data = await res.json()
|
|
1258
|
+
if (data.ok) {
|
|
1259
|
+
setBrowserPath(data.currentPath || dirPath)
|
|
1260
|
+
setBrowserEntries(data.entries || [])
|
|
1261
|
+
}
|
|
1262
|
+
} catch (err) { /* best-effort cleanup */ }
|
|
1263
|
+
setBrowserLoading(false)
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
const handleSync = async (direction) => {
|
|
1267
|
+
setBusy(`sync_${direction}`)
|
|
1268
|
+
setSyncMsg(null)
|
|
1269
|
+
try {
|
|
1270
|
+
const res = await fetch('/dsh-remote-workspace/sync', {
|
|
1271
|
+
method: 'POST',
|
|
1272
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1273
|
+
body: JSON.stringify({ direction })
|
|
1274
|
+
})
|
|
1275
|
+
const data = await res.json()
|
|
1276
|
+
if (data.ok) {
|
|
1277
|
+
const count = (direction === 'push' ? data.pushed?.length : data.pulled?.length) || 0
|
|
1278
|
+
if (data.conflicts && data.conflicts.length > 0) {
|
|
1279
|
+
setSyncMsg({ ok: false, text: t('syncConflict', { count: data.conflicts.length }) })
|
|
1280
|
+
} else {
|
|
1281
|
+
setSyncMsg({ ok: true, text: t('syncOk', { count }) })
|
|
1282
|
+
}
|
|
1283
|
+
} else {
|
|
1284
|
+
setSyncMsg({ ok: false, text: t('syncErr', { err: data.error || 'Unknown error' }) })
|
|
1285
|
+
}
|
|
1286
|
+
} catch (err) {
|
|
1287
|
+
setSyncMsg({ ok: false, text: t('syncErr', { err: err.message }) })
|
|
1288
|
+
}
|
|
1289
|
+
setBusy(null)
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
const handleStartTunnel = async () => {
|
|
1293
|
+
if (!activeId) return
|
|
1294
|
+
setBusy('tunnel_open')
|
|
1295
|
+
setTunnelMsg(null)
|
|
1296
|
+
try {
|
|
1297
|
+
const res = await fetch('/dsh-remote-workspace/tunnels/start', {
|
|
1298
|
+
method: 'POST',
|
|
1299
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1300
|
+
body: JSON.stringify({
|
|
1301
|
+
profileId: activeId,
|
|
1302
|
+
localPort: newTunnelLocal,
|
|
1303
|
+
remotePort: newTunnelRemote
|
|
1304
|
+
})
|
|
1305
|
+
})
|
|
1306
|
+
const data = await res.json()
|
|
1307
|
+
if (data.ok) {
|
|
1308
|
+
setTunnelMsg({ ok: true, text: t('tOpenOk', { localPort: newTunnelLocal, remotePort: newTunnelRemote }) })
|
|
1309
|
+
await loadState()
|
|
1310
|
+
} else {
|
|
1311
|
+
setTunnelMsg({ ok: false, text: t('tOpenErr', { err: data.error || 'Failed' }) })
|
|
1312
|
+
}
|
|
1313
|
+
} catch (err) {
|
|
1314
|
+
setTunnelMsg({ ok: false, text: t('tOpenErr', { err: err.message }) })
|
|
1315
|
+
}
|
|
1316
|
+
setBusy(null)
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
const handleStopTunnel = async (tunnelId) => {
|
|
1320
|
+
try {
|
|
1321
|
+
const res = await fetch('/dsh-remote-workspace/tunnels/stop', {
|
|
1322
|
+
method: 'POST',
|
|
1323
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1324
|
+
body: JSON.stringify({ tunnelId })
|
|
1325
|
+
})
|
|
1326
|
+
if (res.ok) {
|
|
1327
|
+
await loadState()
|
|
1328
|
+
}
|
|
1329
|
+
} catch (err) { /* best-effort cleanup */ }
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
const activeProfile = profiles.find((p) => p.id === activeId)
|
|
1333
|
+
|
|
1334
|
+
return React.createElement(
|
|
1335
|
+
'div',
|
|
1336
|
+
{ className: 'drw-page' },
|
|
1337
|
+
|
|
1338
|
+
// Header with Live Badges (ClineBot Style)
|
|
1339
|
+
React.createElement(
|
|
1340
|
+
'div',
|
|
1341
|
+
{ className: 'drw-header' },
|
|
1342
|
+
React.createElement(
|
|
1343
|
+
'div',
|
|
1344
|
+
{ className: 'drw-header-top' },
|
|
1345
|
+
React.createElement('div', { className: 'drw-page-title' }, '🌐 ' + t('title')),
|
|
1346
|
+
React.createElement(
|
|
1347
|
+
'div',
|
|
1348
|
+
{ className: 'drw-header-badges' },
|
|
1349
|
+
activeProfile
|
|
1350
|
+
? React.createElement('span', { className: 'drw-badge drw-badge-ok' }, t('badgeOnline', { name: activeProfile.name || activeProfile.host, latency: testResult?.latencyMs ?? 15 }))
|
|
1351
|
+
: React.createElement('span', { className: 'drw-badge drw-badge-warn' }, t('badgeOffline')),
|
|
1352
|
+
activeProfile
|
|
1353
|
+
? React.createElement('span', { className: 'drw-badge' }, activeProfile.authType === 'password' ? t('badgePassword') : t('badgeKey'))
|
|
1354
|
+
: null,
|
|
1355
|
+
React.createElement('span', { className: `drw-badge ${tunnels.length > 0 ? 'drw-badge-ok' : ''}` }, t('badgeTunnels', { count: tunnels.length }))
|
|
1356
|
+
)
|
|
1357
|
+
),
|
|
1358
|
+
React.createElement('div', { className: 'drw-page-sub' }, t('subtitle'))
|
|
1359
|
+
),
|
|
1360
|
+
|
|
1361
|
+
// Section 1: SSH Profiles Table & Management
|
|
1362
|
+
React.createElement(
|
|
1363
|
+
'div',
|
|
1364
|
+
{ className: 'drw-card' },
|
|
1365
|
+
React.createElement(
|
|
1366
|
+
'div',
|
|
1367
|
+
{ className: 'drw-card-title' },
|
|
1368
|
+
React.createElement('span', null, t('profilesTitle')),
|
|
1369
|
+
!editing
|
|
1370
|
+
? React.createElement(
|
|
1371
|
+
'button',
|
|
1372
|
+
{
|
|
1373
|
+
type: 'button',
|
|
1374
|
+
className: 'drw-btn drw-btn-primary',
|
|
1375
|
+
onClick: () => {
|
|
1376
|
+
setEditing({
|
|
1377
|
+
id: 'prof_' + Math.random().toString(36).substr(2, 9),
|
|
1378
|
+
name: 'New Server',
|
|
1379
|
+
host: '',
|
|
1380
|
+
port: 22,
|
|
1381
|
+
username: 'root',
|
|
1382
|
+
authType: 'key',
|
|
1383
|
+
privateKeyPath: '~/.ssh/id_rsa',
|
|
1384
|
+
passphrase: '',
|
|
1385
|
+
password: '',
|
|
1386
|
+
remoteWorkspace: '',
|
|
1387
|
+
localMirrorPath: ''
|
|
1388
|
+
})
|
|
1389
|
+
setTestResult(null)
|
|
1390
|
+
}
|
|
1391
|
+
},
|
|
1392
|
+
t('addBtn')
|
|
1393
|
+
)
|
|
1394
|
+
: null
|
|
1395
|
+
),
|
|
1396
|
+
React.createElement('div', { className: 'drw-card-desc' }, t('profilesDesc')),
|
|
1397
|
+
|
|
1398
|
+
// Interactive Editing Form
|
|
1399
|
+
editing
|
|
1400
|
+
? React.createElement(
|
|
1401
|
+
'div',
|
|
1402
|
+
{
|
|
1403
|
+
style: {
|
|
1404
|
+
padding: '16px',
|
|
1405
|
+
borderRadius: '10px',
|
|
1406
|
+
background: 'var(--dsw-alias-bg-layer-2)',
|
|
1407
|
+
border: '1px solid var(--dsw-alias-border-l2)',
|
|
1408
|
+
display: 'flex',
|
|
1409
|
+
flexDirection: 'column',
|
|
1410
|
+
gap: '14px'
|
|
1411
|
+
}
|
|
1412
|
+
},
|
|
1413
|
+
React.createElement(
|
|
1414
|
+
'div',
|
|
1415
|
+
{ style: { fontWeight: 600, fontSize: '14px', color: 'var(--dsw-alias-label-primary)' } },
|
|
1416
|
+
editing.name ? t('formTitleEdit') : t('formTitleNew')
|
|
1417
|
+
),
|
|
1418
|
+
React.createElement(
|
|
1419
|
+
'div',
|
|
1420
|
+
{ className: 'drw-grid-2' },
|
|
1421
|
+
React.createElement(
|
|
1422
|
+
'div',
|
|
1423
|
+
{ className: 'drw-field' },
|
|
1424
|
+
React.createElement('span', { className: 'drw-label' }, t('fName')),
|
|
1425
|
+
React.createElement('input', {
|
|
1426
|
+
className: 'drw-input',
|
|
1427
|
+
value: editing.name || '',
|
|
1428
|
+
onChange: (e) => setEditing({ ...editing, name: e.target.value })
|
|
1429
|
+
})
|
|
1430
|
+
),
|
|
1431
|
+
React.createElement(
|
|
1432
|
+
'div',
|
|
1433
|
+
{ className: 'drw-field' },
|
|
1434
|
+
React.createElement('span', { className: 'drw-label' }, t('fHost')),
|
|
1435
|
+
React.createElement('input', {
|
|
1436
|
+
className: 'drw-input',
|
|
1437
|
+
placeholder: '192.168.1.100 or server.domain.com',
|
|
1438
|
+
value: editing.host || '',
|
|
1439
|
+
onChange: (e) => setEditing({ ...editing, host: e.target.value })
|
|
1440
|
+
})
|
|
1441
|
+
),
|
|
1442
|
+
React.createElement(
|
|
1443
|
+
'div',
|
|
1444
|
+
{ className: 'drw-field' },
|
|
1445
|
+
React.createElement('span', { className: 'drw-label' }, t('fPort')),
|
|
1446
|
+
React.createElement('input', {
|
|
1447
|
+
className: 'drw-input',
|
|
1448
|
+
type: 'number',
|
|
1449
|
+
value: editing.port || 22,
|
|
1450
|
+
onChange: (e) => setEditing({ ...editing, port: parseInt(e.target.value, 10) || 22 })
|
|
1451
|
+
})
|
|
1452
|
+
),
|
|
1453
|
+
React.createElement(
|
|
1454
|
+
'div',
|
|
1455
|
+
{ className: 'drw-field' },
|
|
1456
|
+
React.createElement('span', { className: 'drw-label' }, t('fUser')),
|
|
1457
|
+
React.createElement('input', {
|
|
1458
|
+
className: 'drw-input',
|
|
1459
|
+
value: editing.username || '',
|
|
1460
|
+
onChange: (e) => setEditing({ ...editing, username: e.target.value })
|
|
1461
|
+
})
|
|
1462
|
+
)
|
|
1463
|
+
),
|
|
1464
|
+
|
|
1465
|
+
// Auth Method Segmented Switcher (Key vs Password)
|
|
1466
|
+
React.createElement(
|
|
1467
|
+
'div',
|
|
1468
|
+
{ style: { display: 'flex', flexDirection: 'column', gap: '8px' } },
|
|
1469
|
+
React.createElement('span', { className: 'drw-label' }, t('fAuthType')),
|
|
1470
|
+
React.createElement(
|
|
1471
|
+
'div',
|
|
1472
|
+
{ className: 'drw-segmented' },
|
|
1473
|
+
React.createElement(
|
|
1474
|
+
'button',
|
|
1475
|
+
{
|
|
1476
|
+
type: 'button',
|
|
1477
|
+
className: `drw-segmented-item ${editing.authType !== 'password' ? 'drw-segmented-item-active' : ''}`,
|
|
1478
|
+
onClick: () => setEditing({ ...editing, authType: 'key' })
|
|
1479
|
+
},
|
|
1480
|
+
'🔑 ' + t('fAuthKey')
|
|
1481
|
+
),
|
|
1482
|
+
React.createElement(
|
|
1483
|
+
'button',
|
|
1484
|
+
{
|
|
1485
|
+
type: 'button',
|
|
1486
|
+
className: `drw-segmented-item ${editing.authType === 'password' ? 'drw-segmented-item-active' : ''}`,
|
|
1487
|
+
onClick: () => setEditing({ ...editing, authType: 'password' })
|
|
1488
|
+
},
|
|
1489
|
+
'🔒 ' + t('fAuthPass')
|
|
1490
|
+
)
|
|
1491
|
+
)
|
|
1492
|
+
),
|
|
1493
|
+
|
|
1494
|
+
// Conditional Auth Inputs
|
|
1495
|
+
editing.authType === 'password'
|
|
1496
|
+
? React.createElement(
|
|
1497
|
+
'div',
|
|
1498
|
+
{ className: 'drw-field' },
|
|
1499
|
+
React.createElement('span', { className: 'drw-label' }, t('fPassword')),
|
|
1500
|
+
React.createElement(
|
|
1501
|
+
'div',
|
|
1502
|
+
{ style: { display: 'flex', gap: '8px' } },
|
|
1503
|
+
React.createElement('input', {
|
|
1504
|
+
className: 'drw-input',
|
|
1505
|
+
type: showPassword ? 'text' : 'password',
|
|
1506
|
+
placeholder: '••••••••••••',
|
|
1507
|
+
value: editing.password || '',
|
|
1508
|
+
onChange: (e) => setEditing({ ...editing, password: e.target.value })
|
|
1509
|
+
}),
|
|
1510
|
+
React.createElement(
|
|
1511
|
+
'button',
|
|
1512
|
+
{
|
|
1513
|
+
type: 'button',
|
|
1514
|
+
className: 'drw-btn',
|
|
1515
|
+
style: { fontSize: '11px', whiteSpace: 'nowrap' },
|
|
1516
|
+
onClick: () => setShowPassword((v) => !v)
|
|
1517
|
+
},
|
|
1518
|
+
showPassword ? 'Hide' : 'Show'
|
|
1519
|
+
)
|
|
1520
|
+
)
|
|
1521
|
+
)
|
|
1522
|
+
: React.createElement(
|
|
1523
|
+
'div',
|
|
1524
|
+
{ className: 'drw-grid-2' },
|
|
1525
|
+
React.createElement(
|
|
1526
|
+
'div',
|
|
1527
|
+
{ className: 'drw-field' },
|
|
1528
|
+
React.createElement('span', { className: 'drw-label' }, t('fKeyPath')),
|
|
1529
|
+
React.createElement('input', {
|
|
1530
|
+
className: 'drw-input',
|
|
1531
|
+
placeholder: '~/.ssh/id_rsa or /home/user/.ssh/id_ed25519',
|
|
1532
|
+
value: editing.privateKeyPath || '',
|
|
1533
|
+
onChange: (e) => setEditing({ ...editing, privateKeyPath: e.target.value })
|
|
1534
|
+
}),
|
|
1535
|
+
React.createElement('span', { className: 'drw-hint' }, t('fKeyPathHint'))
|
|
1536
|
+
),
|
|
1537
|
+
React.createElement(
|
|
1538
|
+
'div',
|
|
1539
|
+
{ className: 'drw-field' },
|
|
1540
|
+
React.createElement('span', { className: 'drw-label' }, t('fPassphrase')),
|
|
1541
|
+
React.createElement('input', {
|
|
1542
|
+
className: 'drw-input',
|
|
1543
|
+
type: 'password',
|
|
1544
|
+
placeholder: 'Optional passphrase',
|
|
1545
|
+
value: editing.passphrase || '',
|
|
1546
|
+
onChange: (e) => setEditing({ ...editing, passphrase: e.target.value })
|
|
1547
|
+
})
|
|
1548
|
+
)
|
|
1549
|
+
),
|
|
1550
|
+
|
|
1551
|
+
// Workspace Paths (Remote Workspace & Local Mirror)
|
|
1552
|
+
React.createElement(
|
|
1553
|
+
'div',
|
|
1554
|
+
{ className: 'drw-grid-2' },
|
|
1555
|
+
React.createElement(
|
|
1556
|
+
'div',
|
|
1557
|
+
{ className: 'drw-field' },
|
|
1558
|
+
React.createElement('span', { className: 'drw-label' }, t('fRemotePath')),
|
|
1559
|
+
React.createElement(
|
|
1560
|
+
'div',
|
|
1561
|
+
{ style: { display: 'flex', gap: '8px' } },
|
|
1562
|
+
React.createElement('input', {
|
|
1563
|
+
className: 'drw-input',
|
|
1564
|
+
placeholder: '/home/user/project',
|
|
1565
|
+
value: editing.remoteWorkspace || '',
|
|
1566
|
+
onChange: (e) => setEditing({ ...editing, remoteWorkspace: e.target.value })
|
|
1567
|
+
}),
|
|
1568
|
+
React.createElement(
|
|
1569
|
+
'button',
|
|
1570
|
+
{
|
|
1571
|
+
type: 'button',
|
|
1572
|
+
className: 'drw-btn',
|
|
1573
|
+
style: { whiteSpace: 'nowrap', fontSize: '12px' },
|
|
1574
|
+
disabled: !editing.host,
|
|
1575
|
+
onClick: () => openDirectoryBrowser(editing.remoteWorkspace || '/')
|
|
1576
|
+
},
|
|
1577
|
+
t('btnBrowse')
|
|
1578
|
+
)
|
|
1579
|
+
),
|
|
1580
|
+
React.createElement('span', { className: 'drw-hint' }, t('fRemotePathHint'))
|
|
1581
|
+
),
|
|
1582
|
+
React.createElement(
|
|
1583
|
+
'div',
|
|
1584
|
+
{ className: 'drw-field' },
|
|
1585
|
+
React.createElement('span', { className: 'drw-label' }, t('fLocalMirror')),
|
|
1586
|
+
React.createElement('input', {
|
|
1587
|
+
className: 'drw-input',
|
|
1588
|
+
placeholder: '~/.dsh/mirrors/my-project',
|
|
1589
|
+
value: editing.localMirrorPath || '',
|
|
1590
|
+
onChange: (e) => setEditing({ ...editing, localMirrorPath: e.target.value })
|
|
1591
|
+
}),
|
|
1592
|
+
React.createElement('span', { className: 'drw-hint' }, t('fLocalMirrorHint'))
|
|
1593
|
+
)
|
|
1594
|
+
),
|
|
1595
|
+
|
|
1596
|
+
// Directory Browser Modal
|
|
1597
|
+
browserOpen
|
|
1598
|
+
? React.createElement(
|
|
1599
|
+
'div',
|
|
1600
|
+
{ className: 'drw-browser-modal' },
|
|
1601
|
+
React.createElement(
|
|
1602
|
+
'div',
|
|
1603
|
+
{ style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
|
|
1604
|
+
React.createElement('span', { style: { fontSize: '12px', fontWeight: 600, color: 'var(--dsw-alias-label-primary)' } }, `📂 ${browserPath}`),
|
|
1605
|
+
React.createElement(
|
|
1606
|
+
'div',
|
|
1607
|
+
{ style: { display: 'flex', gap: '6px' } },
|
|
1608
|
+
React.createElement(
|
|
1609
|
+
'button',
|
|
1610
|
+
{
|
|
1611
|
+
type: 'button',
|
|
1612
|
+
className: 'drw-btn drw-btn-primary',
|
|
1613
|
+
style: { fontSize: '11px', padding: '3px 8px' },
|
|
1614
|
+
onClick: () => {
|
|
1615
|
+
setEditing({ ...editing, remoteWorkspace: browserPath })
|
|
1616
|
+
setBrowserOpen(false)
|
|
1617
|
+
}
|
|
1618
|
+
},
|
|
1619
|
+
t('btnSelectThis')
|
|
1620
|
+
),
|
|
1621
|
+
React.createElement(
|
|
1622
|
+
'button',
|
|
1623
|
+
{
|
|
1624
|
+
type: 'button',
|
|
1625
|
+
className: 'drw-btn',
|
|
1626
|
+
style: { fontSize: '11px', padding: '3px 8px' },
|
|
1627
|
+
onClick: () => setBrowserOpen(false)
|
|
1628
|
+
},
|
|
1629
|
+
'✕'
|
|
1630
|
+
)
|
|
1631
|
+
)
|
|
1632
|
+
),
|
|
1633
|
+
React.createElement(
|
|
1634
|
+
'div',
|
|
1635
|
+
{ className: 'drw-browser-list' },
|
|
1636
|
+
browserLoading
|
|
1637
|
+
? React.createElement('div', { style: { padding: '8px', fontSize: '12px', color: 'var(--dsw-alias-label-secondary)' } }, 'Loading directory entries...')
|
|
1638
|
+
: React.createElement(
|
|
1639
|
+
React.Fragment,
|
|
1640
|
+
null,
|
|
1641
|
+
browserPath !== '/'
|
|
1642
|
+
? React.createElement(
|
|
1643
|
+
'div',
|
|
1644
|
+
{
|
|
1645
|
+
className: 'drw-browser-item',
|
|
1646
|
+
onClick: () => {
|
|
1647
|
+
const parent = browserPath.substring(0, browserPath.lastIndexOf('/')) || '/'
|
|
1648
|
+
fetchRemoteDir(parent)
|
|
1649
|
+
}
|
|
1650
|
+
},
|
|
1651
|
+
'📁 .. (parent directory)'
|
|
1652
|
+
)
|
|
1653
|
+
: null,
|
|
1654
|
+
browserEntries
|
|
1655
|
+
.filter((e) => e.isDirectory)
|
|
1656
|
+
.map((e) =>
|
|
1657
|
+
React.createElement(
|
|
1658
|
+
'div',
|
|
1659
|
+
{
|
|
1660
|
+
key: e.filename,
|
|
1661
|
+
className: 'drw-browser-item',
|
|
1662
|
+
onClick: () => {
|
|
1663
|
+
const next = browserPath === '/' ? `/${e.filename}` : `${browserPath}/${e.filename}`
|
|
1664
|
+
fetchRemoteDir(next)
|
|
1665
|
+
}
|
|
1666
|
+
},
|
|
1667
|
+
`📁 ${e.filename}`
|
|
1668
|
+
)
|
|
1669
|
+
)
|
|
1670
|
+
)
|
|
1671
|
+
)
|
|
1672
|
+
)
|
|
1673
|
+
: null,
|
|
1674
|
+
|
|
1675
|
+
// Form Action Buttons
|
|
1676
|
+
React.createElement(
|
|
1677
|
+
'div',
|
|
1678
|
+
{ className: 'drw-row', style: { justifyContent: 'flex-end', marginTop: '6px' } },
|
|
1679
|
+
React.createElement(
|
|
1680
|
+
'button',
|
|
1681
|
+
{
|
|
1682
|
+
type: 'button',
|
|
1683
|
+
className: 'drw-btn',
|
|
1684
|
+
disabled: !editing.host || !!busy,
|
|
1685
|
+
onClick: () => handleTest(editing)
|
|
1686
|
+
},
|
|
1687
|
+
busy === 'testing' ? t('testing') : t('btnTest')
|
|
1688
|
+
),
|
|
1689
|
+
React.createElement(
|
|
1690
|
+
'button',
|
|
1691
|
+
{
|
|
1692
|
+
type: 'button',
|
|
1693
|
+
className: 'drw-btn',
|
|
1694
|
+
onClick: () => {
|
|
1695
|
+
setEditing(null)
|
|
1696
|
+
setBrowserOpen(false)
|
|
1697
|
+
setTestResult(null)
|
|
1698
|
+
}
|
|
1699
|
+
},
|
|
1700
|
+
t('btnCancel')
|
|
1701
|
+
),
|
|
1702
|
+
React.createElement(
|
|
1703
|
+
'button',
|
|
1704
|
+
{
|
|
1705
|
+
type: 'button',
|
|
1706
|
+
className: 'drw-btn drw-btn-primary',
|
|
1707
|
+
disabled: !editing.host || !!busy,
|
|
1708
|
+
onClick: () => handleSave(editing)
|
|
1709
|
+
},
|
|
1710
|
+
busy === 'saving' ? t('saving') : t('btnSave')
|
|
1711
|
+
)
|
|
1712
|
+
),
|
|
1713
|
+
testResult
|
|
1714
|
+
? React.createElement(
|
|
1715
|
+
'div',
|
|
1716
|
+
{
|
|
1717
|
+
className: 'drw-preview',
|
|
1718
|
+
style: {
|
|
1719
|
+
borderColor: testResult.ok ? 'var(--dsw-alias-state-success-primary)' : 'var(--dsw-alias-state-error-primary)'
|
|
1720
|
+
}
|
|
1721
|
+
},
|
|
1722
|
+
testResult.ok
|
|
1723
|
+
? t('testOk', { latency: testResult.latencyMs ?? testResult.latency ?? 0, os: testResult.remoteOs || testResult.os || 'Linux' })
|
|
1724
|
+
: t('testFail', { err: testResult.error || 'Connection timed out' })
|
|
1725
|
+
)
|
|
1726
|
+
: null
|
|
1727
|
+
)
|
|
1728
|
+
: null,
|
|
1729
|
+
|
|
1730
|
+
// Profiles List Table
|
|
1731
|
+
profiles.length > 0
|
|
1732
|
+
? React.createElement(
|
|
1733
|
+
'table',
|
|
1734
|
+
{ className: 'drw-table' },
|
|
1735
|
+
React.createElement(
|
|
1736
|
+
'thead',
|
|
1737
|
+
null,
|
|
1738
|
+
React.createElement(
|
|
1739
|
+
'tr',
|
|
1740
|
+
null,
|
|
1741
|
+
React.createElement('th', null, t('nameCol')),
|
|
1742
|
+
React.createElement('th', null, t('hostCol')),
|
|
1743
|
+
React.createElement('th', null, t('portCol')),
|
|
1744
|
+
React.createElement('th', null, t('pathCol')),
|
|
1745
|
+
React.createElement('th', { style: { textAlign: 'right' } }, t('actionsCol'))
|
|
1746
|
+
)
|
|
1747
|
+
),
|
|
1748
|
+
React.createElement(
|
|
1749
|
+
'tbody',
|
|
1750
|
+
null,
|
|
1751
|
+
profiles.map((p) => {
|
|
1752
|
+
const isAct = p.id === activeId
|
|
1753
|
+
return React.createElement(
|
|
1754
|
+
'tr',
|
|
1755
|
+
{ key: p.id },
|
|
1756
|
+
React.createElement(
|
|
1757
|
+
'td',
|
|
1758
|
+
null,
|
|
1759
|
+
React.createElement('span', { style: { fontWeight: 600 } }, p.name || 'Server'),
|
|
1760
|
+
React.createElement(
|
|
1761
|
+
'span',
|
|
1762
|
+
{ className: 'drw-badge', style: { marginLeft: '8px' } },
|
|
1763
|
+
p.authType === 'password' ? '🔒 pwd' : '🔑 key'
|
|
1764
|
+
),
|
|
1765
|
+
isAct
|
|
1766
|
+
? React.createElement('span', { className: 'drw-badge drw-badge-ok', style: { marginLeft: '6px' } }, t('activeBadge'))
|
|
1767
|
+
: null
|
|
1768
|
+
),
|
|
1769
|
+
React.createElement('td', { style: { fontFamily: 'monospace' } }, `${p.username || 'root'}@${p.host}`),
|
|
1770
|
+
React.createElement('td', { style: { fontFamily: 'monospace' } }, p.port || 22),
|
|
1771
|
+
React.createElement('td', { style: { fontFamily: 'monospace', fontSize: '12px' } }, p.remoteWorkspace || '—'),
|
|
1772
|
+
React.createElement(
|
|
1773
|
+
'td',
|
|
1774
|
+
{ style: { textAlign: 'right' } },
|
|
1775
|
+
React.createElement(
|
|
1776
|
+
'div',
|
|
1777
|
+
{ style: { display: 'inline-flex', gap: '6px' } },
|
|
1778
|
+
!isAct
|
|
1779
|
+
? React.createElement(
|
|
1780
|
+
'button',
|
|
1781
|
+
{
|
|
1782
|
+
type: 'button',
|
|
1783
|
+
className: 'drw-btn',
|
|
1784
|
+
style: { fontSize: '11px', padding: '3px 8px' },
|
|
1785
|
+
onClick: () => handleSetActive(p.id)
|
|
1786
|
+
},
|
|
1787
|
+
t('pinBtn')
|
|
1788
|
+
)
|
|
1789
|
+
: null,
|
|
1790
|
+
React.createElement(
|
|
1791
|
+
'button',
|
|
1792
|
+
{
|
|
1793
|
+
type: 'button',
|
|
1794
|
+
className: 'drw-btn',
|
|
1795
|
+
style: { fontSize: '11px', padding: '3px 8px' },
|
|
1796
|
+
onClick: () => {
|
|
1797
|
+
setEditing({ ...p })
|
|
1798
|
+
setTestResult(null)
|
|
1799
|
+
}
|
|
1800
|
+
},
|
|
1801
|
+
t('editBtn')
|
|
1802
|
+
),
|
|
1803
|
+
React.createElement(
|
|
1804
|
+
'button',
|
|
1805
|
+
{
|
|
1806
|
+
type: 'button',
|
|
1807
|
+
className: 'drw-btn drw-btn-danger',
|
|
1808
|
+
style: { fontSize: '11px', padding: '3px 8px' },
|
|
1809
|
+
onClick: () => handleDelete(p.id, p.name)
|
|
1810
|
+
},
|
|
1811
|
+
t('delBtn')
|
|
1812
|
+
)
|
|
1813
|
+
)
|
|
1814
|
+
)
|
|
1815
|
+
)
|
|
1816
|
+
})
|
|
1817
|
+
)
|
|
1818
|
+
)
|
|
1819
|
+
: !editing
|
|
1820
|
+
? React.createElement('div', { style: { fontSize: '13px', color: 'var(--dsw-alias-label-secondary)' } }, t('noHosts'))
|
|
1821
|
+
: null
|
|
1822
|
+
),
|
|
1823
|
+
|
|
1824
|
+
// Section 2: Active Connection Diagnostics (ClineBot Card 4 style)
|
|
1825
|
+
activeProfile
|
|
1826
|
+
? React.createElement(
|
|
1827
|
+
'div',
|
|
1828
|
+
{ className: 'drw-card' },
|
|
1829
|
+
React.createElement(
|
|
1830
|
+
'div',
|
|
1831
|
+
{ className: 'drw-card-title' },
|
|
1832
|
+
React.createElement('span', null, t('diagTitle')),
|
|
1833
|
+
React.createElement(
|
|
1834
|
+
'button',
|
|
1835
|
+
{
|
|
1836
|
+
type: 'button',
|
|
1837
|
+
className: 'drw-btn',
|
|
1838
|
+
style: { fontSize: '11px', padding: '3px 9px' },
|
|
1839
|
+
disabled: busy === 'testing',
|
|
1840
|
+
onClick: () => handleTest(activeProfile)
|
|
1841
|
+
},
|
|
1842
|
+
busy === 'testing' ? t('testing') : t('diagProbeBtn')
|
|
1843
|
+
)
|
|
1844
|
+
),
|
|
1845
|
+
React.createElement('div', { className: 'drw-card-desc' }, t('diagDesc')),
|
|
1846
|
+
React.createElement(
|
|
1847
|
+
'div',
|
|
1848
|
+
{ className: 'drw-grid-4' },
|
|
1849
|
+
React.createElement(
|
|
1850
|
+
'div',
|
|
1851
|
+
{ className: 'drw-stat-box' },
|
|
1852
|
+
React.createElement('div', { className: 'drw-stat-val' }, activeProfile.name || activeProfile.host),
|
|
1853
|
+
React.createElement('div', { className: 'drw-stat-lbl' }, `SSH: ${activeProfile.username}@${activeProfile.host}:${activeProfile.port || 22}`)
|
|
1854
|
+
),
|
|
1855
|
+
React.createElement(
|
|
1856
|
+
'div',
|
|
1857
|
+
{ className: 'drw-stat-box' },
|
|
1858
|
+
React.createElement('div', { className: 'drw-stat-val' }, activeProfile.remoteWorkspace || '—'),
|
|
1859
|
+
React.createElement('div', { className: 'drw-stat-lbl' }, 'Remote Workspace')
|
|
1860
|
+
),
|
|
1861
|
+
React.createElement(
|
|
1862
|
+
'div',
|
|
1863
|
+
{ className: 'drw-stat-box' },
|
|
1864
|
+
React.createElement('div', { className: 'drw-stat-val' }, activeProfile.localMirrorPath || '—'),
|
|
1865
|
+
React.createElement('div', { className: 'drw-stat-lbl' }, 'Local Mirror Path')
|
|
1866
|
+
),
|
|
1867
|
+
React.createElement(
|
|
1868
|
+
'div',
|
|
1869
|
+
{ className: 'drw-stat-box' },
|
|
1870
|
+
React.createElement('div', { className: 'drw-stat-val', style: { color: 'var(--dsw-alias-state-success-primary)' } }, 'Ready ✓'),
|
|
1871
|
+
React.createElement('div', { className: 'drw-stat-lbl' }, activeProfile.authType === 'password' ? 'Password Auth' : 'SSH Key Auth')
|
|
1872
|
+
)
|
|
1873
|
+
)
|
|
1874
|
+
)
|
|
1875
|
+
: null,
|
|
1876
|
+
|
|
1877
|
+
// Section 3: Mirror Sync (ClineBot Action Card style)
|
|
1878
|
+
activeProfile
|
|
1879
|
+
? React.createElement(
|
|
1880
|
+
'div',
|
|
1881
|
+
{ className: 'drw-card' },
|
|
1882
|
+
React.createElement('div', { className: 'drw-card-title' }, t('syncTitle')),
|
|
1883
|
+
React.createElement('div', { className: 'drw-card-desc' }, t('syncDesc')),
|
|
1884
|
+
|
|
1885
|
+
React.createElement(
|
|
1886
|
+
'div',
|
|
1887
|
+
{ style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '10px 14px', background: 'var(--dsw-alias-bg-layer-2)', borderRadius: '8px', border: '1px solid var(--dsw-alias-border-l2)', marginBottom: '12px' } },
|
|
1888
|
+
React.createElement(
|
|
1889
|
+
'div',
|
|
1890
|
+
{ style: { display: 'flex', flexDirection: 'column', gap: '2px' } },
|
|
1891
|
+
React.createElement('span', { style: { fontWeight: 600, fontSize: '13px' } }, t('autoSyncTitle')),
|
|
1892
|
+
React.createElement('span', { style: { fontSize: '11px', color: 'var(--dsw-alias-label-secondary)' } }, t('autoSyncDesc'))
|
|
1893
|
+
),
|
|
1894
|
+
React.createElement(
|
|
1895
|
+
'button',
|
|
1896
|
+
{
|
|
1897
|
+
type: 'button',
|
|
1898
|
+
className: `drw-btn ${autoSync ? 'drw-btn-primary' : ''}`,
|
|
1899
|
+
style: { padding: '4px 12px', fontSize: '12px' },
|
|
1900
|
+
onClick: async () => {
|
|
1901
|
+
const next = !autoSync
|
|
1902
|
+
try {
|
|
1903
|
+
const res = await fetch('/dsh-remote-workspace/watcher/toggle', {
|
|
1904
|
+
method: 'POST',
|
|
1905
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1906
|
+
body: JSON.stringify({ enabled: next })
|
|
1907
|
+
})
|
|
1908
|
+
const d = await res.json()
|
|
1909
|
+
if (d.ok) setAutoSync(d.autoSync)
|
|
1910
|
+
} catch (err) { /* best-effort cleanup */ }
|
|
1911
|
+
}
|
|
1912
|
+
},
|
|
1913
|
+
autoSync ? '⚡ Active (ON)' : '⚪ Off'
|
|
1914
|
+
)
|
|
1915
|
+
),
|
|
1916
|
+
|
|
1917
|
+
React.createElement(
|
|
1918
|
+
'div',
|
|
1919
|
+
{ className: 'drw-row' },
|
|
1920
|
+
React.createElement(
|
|
1921
|
+
'button',
|
|
1922
|
+
{
|
|
1923
|
+
type: 'button',
|
|
1924
|
+
className: 'drw-btn',
|
|
1925
|
+
disabled: !!busy || !activeProfile.remoteWorkspace || !activeProfile.localMirrorPath,
|
|
1926
|
+
onClick: () => handleSync('pull')
|
|
1927
|
+
},
|
|
1928
|
+
busy === 'sync_pull' ? t('pulling') : t('pullBtn')
|
|
1929
|
+
),
|
|
1930
|
+
React.createElement(
|
|
1931
|
+
'button',
|
|
1932
|
+
{
|
|
1933
|
+
type: 'button',
|
|
1934
|
+
className: 'drw-btn',
|
|
1935
|
+
disabled: !!busy || !activeProfile.remoteWorkspace || !activeProfile.localMirrorPath,
|
|
1936
|
+
onClick: () => handleSync('push')
|
|
1937
|
+
},
|
|
1938
|
+
busy === 'sync_push' ? t('pushing') : t('pushBtn')
|
|
1939
|
+
)
|
|
1940
|
+
),
|
|
1941
|
+
syncMsg
|
|
1942
|
+
? React.createElement(
|
|
1943
|
+
'div',
|
|
1944
|
+
{
|
|
1945
|
+
className: 'drw-preview',
|
|
1946
|
+
style: {
|
|
1947
|
+
borderColor: syncMsg.ok ? 'var(--dsw-alias-state-success-primary)' : 'var(--dsw-alias-state-error-primary)'
|
|
1948
|
+
}
|
|
1949
|
+
},
|
|
1950
|
+
syncMsg.text
|
|
1951
|
+
)
|
|
1952
|
+
: null
|
|
1953
|
+
)
|
|
1954
|
+
: null,
|
|
1955
|
+
|
|
1956
|
+
// Section 4: SSH Port Forwarding (Tunnels Manager)
|
|
1957
|
+
React.createElement(
|
|
1958
|
+
'div',
|
|
1959
|
+
{ className: 'drw-card' },
|
|
1960
|
+
React.createElement('div', { className: 'drw-card-title' }, t('tunnelsTitle')),
|
|
1961
|
+
React.createElement('div', { className: 'drw-card-desc' }, t('tunnelsDesc')),
|
|
1962
|
+
|
|
1963
|
+
// Start tunnel inline row
|
|
1964
|
+
activeProfile
|
|
1965
|
+
? React.createElement(
|
|
1966
|
+
'div',
|
|
1967
|
+
{ className: 'drw-row', style: { alignItems: 'flex-end', background: 'var(--dsw-alias-bg-layer-2)', padding: '10px 12px', borderRadius: '8px' } },
|
|
1968
|
+
React.createElement(
|
|
1969
|
+
'div',
|
|
1970
|
+
{ style: { display: 'flex', flexDirection: 'column', gap: '3px' } },
|
|
1971
|
+
React.createElement('span', { className: 'drw-label' }, t('tLocalPort')),
|
|
1972
|
+
React.createElement('input', {
|
|
1973
|
+
className: 'drw-input',
|
|
1974
|
+
style: { width: '120px' },
|
|
1975
|
+
type: 'number',
|
|
1976
|
+
value: newTunnelLocal,
|
|
1977
|
+
onChange: (e) => setNewTunnelLocal(e.target.value)
|
|
1978
|
+
})
|
|
1979
|
+
),
|
|
1980
|
+
React.createElement('span', { style: { paddingBottom: '8px', color: 'var(--dsw-alias-label-secondary)' } }, '→'),
|
|
1981
|
+
React.createElement(
|
|
1982
|
+
'div',
|
|
1983
|
+
{ style: { display: 'flex', flexDirection: 'column', gap: '3px' } },
|
|
1984
|
+
React.createElement('span', { className: 'drw-label' }, t('tRemotePort')),
|
|
1985
|
+
React.createElement('input', {
|
|
1986
|
+
className: 'drw-input',
|
|
1987
|
+
style: { width: '120px' },
|
|
1988
|
+
type: 'number',
|
|
1989
|
+
value: newTunnelRemote,
|
|
1990
|
+
onChange: (e) => setNewTunnelRemote(e.target.value)
|
|
1991
|
+
})
|
|
1992
|
+
),
|
|
1993
|
+
React.createElement(
|
|
1994
|
+
'button',
|
|
1995
|
+
{
|
|
1996
|
+
type: 'button',
|
|
1997
|
+
className: 'drw-btn drw-btn-primary',
|
|
1998
|
+
disabled: busy === 'tunnel_open',
|
|
1999
|
+
onClick: handleStartTunnel
|
|
2000
|
+
},
|
|
2001
|
+
busy === 'tunnel_open' ? t('tOpening') : t('tOpenBtn')
|
|
2002
|
+
)
|
|
2003
|
+
)
|
|
2004
|
+
: null,
|
|
2005
|
+
|
|
2006
|
+
tunnelMsg
|
|
2007
|
+
? React.createElement(
|
|
2008
|
+
'div',
|
|
2009
|
+
{
|
|
2010
|
+
className: 'drw-preview',
|
|
2011
|
+
style: {
|
|
2012
|
+
borderColor: tunnelMsg.ok ? 'var(--dsw-alias-state-success-primary)' : 'var(--dsw-alias-state-error-primary)'
|
|
2013
|
+
}
|
|
2014
|
+
},
|
|
2015
|
+
tunnelMsg.text
|
|
2016
|
+
)
|
|
2017
|
+
: null,
|
|
2018
|
+
|
|
2019
|
+
// Tunnels Table
|
|
2020
|
+
tunnels.length > 0
|
|
2021
|
+
? React.createElement(
|
|
2022
|
+
'table',
|
|
2023
|
+
{ className: 'drw-table' },
|
|
2024
|
+
React.createElement(
|
|
2025
|
+
'thead',
|
|
2026
|
+
null,
|
|
2027
|
+
React.createElement(
|
|
2028
|
+
'tr',
|
|
2029
|
+
null,
|
|
2030
|
+
React.createElement('th', null, t('tunnelsColId')),
|
|
2031
|
+
React.createElement('th', null, t('tunnelsColRoute')),
|
|
2032
|
+
React.createElement('th', { style: { textAlign: 'right' } }, t('tunnelsColActions'))
|
|
2033
|
+
)
|
|
2034
|
+
),
|
|
2035
|
+
React.createElement(
|
|
2036
|
+
'tbody',
|
|
2037
|
+
null,
|
|
2038
|
+
tunnels.map((tun) =>
|
|
2039
|
+
React.createElement(
|
|
2040
|
+
'tr',
|
|
2041
|
+
{ key: tun.id },
|
|
2042
|
+
React.createElement('td', { style: { fontFamily: 'monospace', fontSize: '12px' } }, tun.id),
|
|
2043
|
+
React.createElement(
|
|
2044
|
+
'td',
|
|
2045
|
+
null,
|
|
2046
|
+
React.createElement('span', { className: 'drw-badge drw-badge-ok' }, `127.0.0.1:${tun.localPort}`),
|
|
2047
|
+
' → ',
|
|
2048
|
+
React.createElement('span', { className: 'drw-badge' }, `${tun.targetHost || '127.0.0.1'}:${tun.remotePort}`)
|
|
2049
|
+
),
|
|
2050
|
+
React.createElement(
|
|
2051
|
+
'td',
|
|
2052
|
+
{ style: { textAlign: 'right' } },
|
|
2053
|
+
React.createElement(
|
|
2054
|
+
'button',
|
|
2055
|
+
{
|
|
2056
|
+
type: 'button',
|
|
2057
|
+
className: 'drw-btn drw-btn-danger',
|
|
2058
|
+
style: { fontSize: '11px', padding: '3px 8px' },
|
|
2059
|
+
onClick: () => handleStopTunnel(tun.id)
|
|
2060
|
+
},
|
|
2061
|
+
t('tStopBtn')
|
|
2062
|
+
)
|
|
2063
|
+
)
|
|
2064
|
+
)
|
|
2065
|
+
)
|
|
2066
|
+
)
|
|
2067
|
+
)
|
|
2068
|
+
: React.createElement('div', { style: { fontSize: '13px', color: 'var(--dsw-alias-label-secondary)' } }, t('tNoTunnels'))
|
|
2069
|
+
)
|
|
2070
|
+
)
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
// Accordion item for Settings -> Plugins section
|
|
2074
|
+
function UpdaterSection(props) {
|
|
2075
|
+
const t = props.t || ((k) => k);
|
|
2076
|
+
const [updateStatus, setUpdateStatus] = React.useState(null);
|
|
2077
|
+
const [loading, setLoading] = React.useState(false);
|
|
2078
|
+
const [updating, setUpdating] = React.useState(false);
|
|
2079
|
+
const [msg, setMsg] = React.useState(null);
|
|
2080
|
+
|
|
2081
|
+
const checkUpdate = React.useCallback(async () => {
|
|
2082
|
+
setLoading(true);
|
|
2083
|
+
setMsg(null);
|
|
2084
|
+
try {
|
|
2085
|
+
const res = await fetch('/dsh-remote-workspace/update', {
|
|
2086
|
+
headers: { accept: 'application/json' },
|
|
2087
|
+
cache: 'no-store'
|
|
2088
|
+
});
|
|
2089
|
+
if (!res.ok) throw new Error('HTTP ' + res.status);
|
|
2090
|
+
const data = await res.json();
|
|
2091
|
+
setUpdateStatus(data);
|
|
2092
|
+
} catch (e) {
|
|
2093
|
+
setMsg({ ok: false, text: (t('updateFailed') || 'Failed: ') + (e?.message || String(e)) });
|
|
2094
|
+
} finally {
|
|
2095
|
+
setLoading(false);
|
|
2096
|
+
}
|
|
2097
|
+
}, [t]);
|
|
2098
|
+
|
|
2099
|
+
const doUpdate = async () => {
|
|
2100
|
+
setUpdating(true);
|
|
2101
|
+
setMsg(null);
|
|
2102
|
+
try {
|
|
2103
|
+
const res = await fetch('/dsh-remote-workspace/update', {
|
|
2104
|
+
method: 'POST',
|
|
2105
|
+
headers: {
|
|
2106
|
+
'x-dsh-plugin-update': '1',
|
|
2107
|
+
'content-type': 'application/json'
|
|
2108
|
+
}
|
|
2109
|
+
});
|
|
2110
|
+
const data = await res.json();
|
|
2111
|
+
if (!res.ok) throw new Error(data.error || ('HTTP ' + res.status));
|
|
2112
|
+
setUpdateStatus(data);
|
|
2113
|
+
if (data.restartRequired) {
|
|
2114
|
+
setMsg({ ok: true, text: t('restartRequired') });
|
|
2115
|
+
}
|
|
2116
|
+
} catch (e) {
|
|
2117
|
+
setMsg({ ok: false, text: (t('updateFailed') || 'Update failed: ') + (e?.message || String(e)) });
|
|
2118
|
+
} finally {
|
|
2119
|
+
setUpdating(false);
|
|
2120
|
+
}
|
|
2121
|
+
};
|
|
2122
|
+
|
|
2123
|
+
React.useEffect(() => {
|
|
2124
|
+
checkUpdate();
|
|
2125
|
+
}, [checkUpdate]);
|
|
2126
|
+
|
|
2127
|
+
return React.createElement(
|
|
2128
|
+
'div',
|
|
2129
|
+
{
|
|
2130
|
+
style: {
|
|
2131
|
+
display: 'flex',
|
|
2132
|
+
alignItems: 'center',
|
|
2133
|
+
justifyContent: 'space-between',
|
|
2134
|
+
padding: '10px 14px',
|
|
2135
|
+
marginBottom: '14px',
|
|
2136
|
+
borderRadius: '8px',
|
|
2137
|
+
background: 'var(--dsw-alias-bg-layer-2)',
|
|
2138
|
+
border: '1px solid var(--dsw-alias-border-l2)',
|
|
2139
|
+
fontSize: '13px'
|
|
2140
|
+
}
|
|
2141
|
+
},
|
|
2142
|
+
React.createElement(
|
|
2143
|
+
'div',
|
|
2144
|
+
{ style: { display: 'flex', alignItems: 'center', gap: '8px' } },
|
|
2145
|
+
React.createElement('span', null, '📦'),
|
|
2146
|
+
React.createElement(
|
|
2147
|
+
'div',
|
|
2148
|
+
null,
|
|
2149
|
+
React.createElement('span', { style: { fontWeight: 500 } }, 'v' + (updateStatus?.currentVersion || '0.3.1')),
|
|
2150
|
+
updateStatus?.latestVersion && updateStatus.latestVersion !== updateStatus.currentVersion
|
|
2151
|
+
? React.createElement('span', { style: { marginLeft: '8px', color: 'var(--dsw-alias-state-warning-text)' } }, '→ v' + updateStatus.latestVersion)
|
|
2152
|
+
: null,
|
|
2153
|
+
msg
|
|
2154
|
+
? React.createElement('div', { style: { fontSize: '11px', marginTop: '3px', color: msg.ok ? 'var(--dsw-alias-state-success-text)' : 'var(--dsw-alias-state-error-text)' } }, msg.text)
|
|
2155
|
+
: null
|
|
2156
|
+
)
|
|
2157
|
+
),
|
|
2158
|
+
React.createElement(
|
|
2159
|
+
'div',
|
|
2160
|
+
{ style: { display: 'flex', gap: '8px' } },
|
|
2161
|
+
updateStatus?.updateAvailable
|
|
2162
|
+
? React.createElement(
|
|
2163
|
+
'button',
|
|
2164
|
+
{
|
|
2165
|
+
type: 'button',
|
|
2166
|
+
className: 'drw-btn drw-btn-primary',
|
|
2167
|
+
disabled: updating,
|
|
2168
|
+
onClick: doUpdate,
|
|
2169
|
+
style: { fontSize: '12px', padding: '4px 10px' }
|
|
2170
|
+
},
|
|
2171
|
+
updating ? t('updating') : t('updateNow')
|
|
2172
|
+
)
|
|
2173
|
+
: React.createElement(
|
|
2174
|
+
'button',
|
|
2175
|
+
{
|
|
2176
|
+
type: 'button',
|
|
2177
|
+
className: 'drw-btn',
|
|
2178
|
+
disabled: loading,
|
|
2179
|
+
onClick: checkUpdate,
|
|
2180
|
+
style: { fontSize: '12px', padding: '4px 10px' }
|
|
2181
|
+
},
|
|
2182
|
+
loading ? t('checking') : (updateStatus?.updateAvailable === false ? t('upToDate') : t('checkUpdate'))
|
|
2183
|
+
)
|
|
2184
|
+
)
|
|
2185
|
+
);
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
function PluginCard(props) {
|
|
2189
|
+
const [open, setOpen] = React.useState(false)
|
|
2190
|
+
const t = props.t || (props.locale === 'zh' ? makeT(zh, en) : makeT(en, zh))
|
|
2191
|
+
|
|
2192
|
+
React.useEffect(() => {
|
|
2193
|
+
ensureCss()
|
|
2194
|
+
}, [])
|
|
2195
|
+
|
|
2196
|
+
return React.createElement(
|
|
2197
|
+
'li',
|
|
2198
|
+
{ className: 'drw-card', style: { listStyle: 'none', marginBottom: '12px' } },
|
|
2199
|
+
React.createElement(
|
|
2200
|
+
'button',
|
|
2201
|
+
{
|
|
2202
|
+
type: 'button',
|
|
2203
|
+
style: {
|
|
2204
|
+
background: 'none',
|
|
2205
|
+
border: 'none',
|
|
2206
|
+
cursor: 'pointer',
|
|
2207
|
+
display: 'flex',
|
|
2208
|
+
alignItems: 'center',
|
|
2209
|
+
width: '100%',
|
|
2210
|
+
padding: 0,
|
|
2211
|
+
textAlign: 'left',
|
|
2212
|
+
},
|
|
2213
|
+
'aria-expanded': open,
|
|
2214
|
+
onClick: () => setOpen((v) => !v),
|
|
2215
|
+
},
|
|
2216
|
+
React.createElement('span', { style: { fontSize: '20px', marginRight: '12px' } }, '🌐'),
|
|
2217
|
+
React.createElement(
|
|
2218
|
+
'div',
|
|
2219
|
+
{ style: { flex: 1 } },
|
|
2220
|
+
React.createElement('div', { style: { fontWeight: 600, fontSize: '15px', color: 'var(--dsw-alias-label-primary)' } }, t('title')),
|
|
2221
|
+
React.createElement('div', { style: { fontSize: '13px', color: 'var(--dsw-alias-label-secondary)' } }, t('subtitle'))
|
|
2222
|
+
),
|
|
2223
|
+
React.createElement('span', { className: 'drw-badge drw-badge-ok', style: { marginRight: '14px' } }, t('status')),
|
|
2224
|
+
React.createElement(
|
|
2225
|
+
'span',
|
|
2226
|
+
{ style: { transform: open ? 'rotate(180deg)' : 'none', transition: 'transform .16s' } },
|
|
2227
|
+
React.createElement(FallbackChevron)
|
|
2228
|
+
)
|
|
2229
|
+
),
|
|
2230
|
+
open
|
|
2231
|
+
? React.createElement(
|
|
2232
|
+
'div',
|
|
2233
|
+
{ style: { marginTop: '16px', borderTop: '1px solid var(--dsw-alias-border-l2)', paddingTop: '16px' } },
|
|
2234
|
+
React.createElement(React.Fragment, null, React.createElement(UpdaterSection, props), React.createElement(SettingsView, props))
|
|
2235
|
+
)
|
|
2236
|
+
: null
|
|
2237
|
+
)
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
function RemoteWorkspaceChip(props) {
|
|
2241
|
+
ensureCss()
|
|
2242
|
+
const [activeHost, setActiveHost] = React.useState(null)
|
|
2243
|
+
|
|
2244
|
+
React.useEffect(() => {
|
|
2245
|
+
fetch('/dsh-remote-workspace/state')
|
|
2246
|
+
.then((r) => r.json())
|
|
2247
|
+
.then((d) => {
|
|
2248
|
+
if (d.ok && d.activeId && d.profiles) {
|
|
2249
|
+
const f = d.profiles.find((p) => p.id === d.activeId)
|
|
2250
|
+
if (f) setActiveHost(f.name || f.host)
|
|
2251
|
+
}
|
|
2252
|
+
})
|
|
2253
|
+
.catch(() => {})
|
|
2254
|
+
}, [])
|
|
2255
|
+
|
|
2256
|
+
return React.createElement(
|
|
2257
|
+
'div',
|
|
2258
|
+
{
|
|
2259
|
+
style: {
|
|
2260
|
+
display: 'flex',
|
|
2261
|
+
alignItems: 'center',
|
|
2262
|
+
gap: '6px',
|
|
2263
|
+
padding: '2px 8px',
|
|
2264
|
+
fontSize: '11px',
|
|
2265
|
+
fontFamily: 'monospace',
|
|
2266
|
+
borderRadius: '999px',
|
|
2267
|
+
border: '1px solid var(--dsw-alias-border-l2)',
|
|
2268
|
+
background: 'var(--dsw-alias-bg-layer-1)',
|
|
2269
|
+
color: activeHost ? 'var(--dsw-alias-state-success-primary)' : 'var(--dsw-alias-label-secondary)',
|
|
2270
|
+
cursor: 'pointer'
|
|
2271
|
+
}
|
|
2272
|
+
},
|
|
2273
|
+
React.createElement('span', null, '🌐'),
|
|
2274
|
+
React.createElement('span', null, activeHost ? `SSH: ${activeHost}` : 'SSH: Local')
|
|
2275
|
+
)
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
function apply(ctx) {
|
|
2279
|
+
if (ctx.locale && typeof ctx.locale.register === 'function') {
|
|
2280
|
+
if (typeof ctx.effect === 'function') {
|
|
2281
|
+
ctx.effect(() => ctx.locale.register(NS, { en, zh }), 'dsh-remote-workspace: dictionaries');
|
|
2282
|
+
} else {
|
|
2283
|
+
ctx.locale.register(NS, { en, zh });
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
if (ctx.slots && typeof ctx.slots.inject === 'function') {
|
|
2288
|
+
ctx.slots.inject('settings.plugin.item', () =>
|
|
2289
|
+
ctx.slots.register(
|
|
2290
|
+
{
|
|
2291
|
+
name: 'settings.plugin.item',
|
|
2292
|
+
key: NS,
|
|
2293
|
+
locale: NS,
|
|
2294
|
+
inject: () => ({ ctx })
|
|
2295
|
+
},
|
|
2296
|
+
(props) => React.createElement(PluginCard, Object.assign({}, props, { ctx }))
|
|
2297
|
+
)
|
|
2298
|
+
)
|
|
2299
|
+
|
|
2300
|
+
ctx.slots.inject('conversation.session.header.utilities', () =>
|
|
2301
|
+
ctx.slots.register(
|
|
2302
|
+
{
|
|
2303
|
+
name: 'conversation.session.header.utilities',
|
|
2304
|
+
id: '@goodandready/dsh-remote-workspace',
|
|
2305
|
+
order: 30
|
|
2306
|
+
},
|
|
2307
|
+
(props) => React.createElement(RemoteWorkspaceChip, props)
|
|
2308
|
+
)
|
|
2309
|
+
)
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
module.exports = { apply, inject: ['slots', 'locale'] }
|
|
2314
|
+
return module.exports
|
|
2315
|
+
}
|
|
2316
|
+
})
|