dsh-remote 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/lib/binding.js +86 -26
- package/lib/client.js +420 -152
- package/lib/forwards.js +18 -6
- package/lib/main.js +45 -12
- package/lib/mirror-paths.js +17 -0
- package/lib/registry.js +6 -1
- package/lib/routes-forwards.js +81 -10
- package/lib/update.js +55 -0
- package/package.json +2 -2
package/lib/client.js
CHANGED
|
@@ -27,7 +27,7 @@ window.__ModuleLoader__.load({
|
|
|
27
27
|
|
|
28
28
|
const React = require('react')
|
|
29
29
|
const name = 'dsh-remote'
|
|
30
|
-
const CLIENT_VERSION = '1.
|
|
30
|
+
const CLIENT_VERSION = '1.3.0'
|
|
31
31
|
|
|
32
32
|
// ── optional host primitives ────────────────────────────────────────────
|
|
33
33
|
// Issue #74: a remote session's .md link must open over SFTP, NOT via the
|
|
@@ -82,6 +82,18 @@ window.__ModuleLoader__.load({
|
|
|
82
82
|
const HostSwitch = (Primitives && typeof Primitives.Switch === 'function') ? Primitives.Switch : null
|
|
83
83
|
const HostSegmentedTabs = (Primitives && typeof Primitives.SegmentedTabs === 'function') ? Primitives.SegmentedTabs : null
|
|
84
84
|
const HostFileTypeIcon = (Primitives && typeof Primitives.FileTypeIcon === 'function') ? Primitives.FileTypeIcon : null
|
|
85
|
+
const HostCheckbox = (Primitives && typeof Primitives.Checkbox === 'function') ? Primitives.Checkbox : null
|
|
86
|
+
const HostChevronDownIcon = (Primitives && typeof Primitives.IconChevronDownOutlineRegular === 'function') ? Primitives.IconChevronDownOutlineRegular : null
|
|
87
|
+
const HostChevronRightIcon = (Primitives && typeof Primitives.IconChevronRightOutlineRegular === 'function') ? Primitives.IconChevronRightOutlineRegular : null
|
|
88
|
+
const HostChevronLeftIcon = (Primitives && typeof Primitives.IconChevronLeftOutlineRegular === 'function') ? Primitives.IconChevronLeftOutlineRegular : null
|
|
89
|
+
const HostChevronUpIcon = (Primitives && typeof Primitives.IconChevronUpOutlineRegular === 'function') ? Primitives.IconChevronUpOutlineRegular : null
|
|
90
|
+
const HostEllipsisIcon = (Primitives && typeof Primitives.IconEllipsisOutlineRegular === 'function') ? Primitives.IconEllipsisOutlineRegular : null
|
|
91
|
+
const HostCloseIcon = (Primitives && typeof Primitives.IconCloseOutlineRegular === 'function') ? Primitives.IconCloseOutlineRegular : null
|
|
92
|
+
const HostGlobeIcon = (Primitives && typeof Primitives.IconGlobeOutlineRegular === 'function') ? Primitives.IconGlobeOutlineRegular : null
|
|
93
|
+
const HostForwardIcon = (Primitives && typeof Primitives.IconRightUpOutlineRegular === 'function') ? Primitives.IconRightUpOutlineRegular : null
|
|
94
|
+
const HostLogIcon = (Primitives && typeof Primitives.IconListPenOutlineRegular === 'function') ? Primitives.IconListPenOutlineRegular : null
|
|
95
|
+
const HostCleanupIcon = (Primitives && typeof Primitives.IconTrashOutlineRegular === 'function') ? Primitives.IconTrashOutlineRegular : null
|
|
96
|
+
const HostSlidersIcon = (Primitives && typeof Primitives.IconSlidersTwoOutlineRegular === 'function') ? Primitives.IconSlidersTwoOutlineRegular : null
|
|
85
97
|
|
|
86
98
|
// Issue #93: floating layers must PORTAL to document.body, exactly like the
|
|
87
99
|
// host's own Modal/Menu (and like our context menu already does with an
|
|
@@ -211,7 +223,6 @@ window.__ModuleLoader__.load({
|
|
|
211
223
|
'ide.unsupported': '当前宿主未提供原生编辑区,无法启用 IDE 模式。',
|
|
212
224
|
|
|
213
225
|
'workspaceSearch.options': '搜索选项',
|
|
214
|
-
'workspaceSearch.details': '扫描详情',
|
|
215
226
|
'workspaceSearch.matches': '{n} 个结果',
|
|
216
227
|
'workspaceSearch.scanned': '已扫描 {n} 项',
|
|
217
228
|
'workspaceSearch.activeOptions': '搜索选项 · {n}',
|
|
@@ -382,6 +393,8 @@ window.__ModuleLoader__.load({
|
|
|
382
393
|
'settings.edit': '编辑',
|
|
383
394
|
'settings.delete': '删除',
|
|
384
395
|
'settings.editMachine': '编辑机器',
|
|
396
|
+
'settings.addMachine': '新增机器',
|
|
397
|
+
'settings.adoptAliasHint': '把 {alias} 保存为机器,可在这里填写登录密码(保存后即可继续编辑)',
|
|
385
398
|
'settings.badgeSshConfig': 'ssh cfg',
|
|
386
399
|
// Issue #51 — transport backend (GSSAPI/Kerberos via system OpenSSH).
|
|
387
400
|
'settings.badgeOpenssh': 'openssh',
|
|
@@ -432,6 +445,7 @@ window.__ModuleLoader__.load({
|
|
|
432
445
|
// 灰按钮必须能解释自己:用户「点了没反应」时唯一能拿到的线索就是 hover 提示。
|
|
433
446
|
'settings.saveNeedsHost': '先填写主机地址才能保存',
|
|
434
447
|
'settings.saveHint': '保存这台机器(留空的密码/私钥/passphrase 沿用已保存的值)',
|
|
448
|
+
'settings.poolRepointFailed': '机器已保存,但切换当前连接失败:{msg}。请重新选择这台机器,或重启 DSH。',
|
|
435
449
|
'settings.fwdNeedsPort': '先填写监听端口才能添加转发',
|
|
436
450
|
'settings.fwdAddHint': '添加一条端口转发',
|
|
437
451
|
'settings.advCollapse': '收起高级配置',
|
|
@@ -482,6 +496,20 @@ window.__ModuleLoader__.load({
|
|
|
482
496
|
'settings.fwdAutoNoticeCancel': '取消',
|
|
483
497
|
'settings.fwdAutoNoticeDontShow': '不再提示',
|
|
484
498
|
'settings.fwdAdd': '添加转发',
|
|
499
|
+
'settings.fwdHost': '主机',
|
|
500
|
+
'settings.fwdHostHint': '这条转发属于哪台主机;只有连上该主机时才能启动。可以给还没连接的主机先存下转发。',
|
|
501
|
+
'settings.fwdHostCurrent': '当前',
|
|
502
|
+
'settings.fwdHostEmpty': '(暂无主机)',
|
|
503
|
+
'settings.fwdHostNeeds': '先选择一台主机才能添加转发',
|
|
504
|
+
'settings.fwdAddedOther': '已添加:连上 {name} 后即可启动这条转发',
|
|
505
|
+
'settings.fwdHostStale': '当前运行的插件宿主端还是旧版本,不认识“主机”字段;已撤销这条转发。请重启 DSH 后再添加。',
|
|
506
|
+
'settings.fwdEdit': '编辑',
|
|
507
|
+
'settings.fwdEditHint': '修改方向、监听端口、目标或所属主机;运行中的转发会先停止,保存后按新配置重新启动',
|
|
508
|
+
'settings.fwdSaveChanges': '保存修改',
|
|
509
|
+
'settings.fwdCancelEdit': '取消',
|
|
510
|
+
'settings.fwdUpdated': '已保存修改',
|
|
511
|
+
'settings.fwdEditingBadge': '编辑中',
|
|
512
|
+
'settings.fwdUpdateStale': '当前运行的插件宿主端还是旧版本,没能保存这些修改;已恢复原来的转发。请重启 DSH 后再编辑。',
|
|
485
513
|
'settings.cleanup': '工作区清理(本地镜像与对话)',
|
|
486
514
|
'settings.cleanupRefresh': '刷新',
|
|
487
515
|
'settings.cleanupEmpty': '没有本地镜像。选定一个远程工作区后它会出现在这里。',
|
|
@@ -531,8 +559,6 @@ window.__ModuleLoader__.load({
|
|
|
531
559
|
'settings.badgePwd': '密码',
|
|
532
560
|
'settings.badgeKeychain': '钥匙串',
|
|
533
561
|
'settings.badgeProxy': '跳板',
|
|
534
|
-
'settings.sectionHide': '收起此栏',
|
|
535
|
-
'settings.sectionShow': '展开此栏',
|
|
536
562
|
'settings.update': '更新',
|
|
537
563
|
'settings.updateChecking': '版本信息加载中…',
|
|
538
564
|
'settings.checking': '检查中…',
|
|
@@ -590,7 +616,7 @@ window.__ModuleLoader__.load({
|
|
|
590
616
|
'settings.modeOff': '关闭',
|
|
591
617
|
'settings.modeManual': '手动',
|
|
592
618
|
'picker.title': '选择工作目录',
|
|
593
|
-
'picker.close': '关闭
|
|
619
|
+
'picker.close': '关闭',
|
|
594
620
|
'picker.tabLocal': '本机',
|
|
595
621
|
'picker.tabRemote': '远程',
|
|
596
622
|
'picker.localIntro': '弹出系统文件夹对话框选择;不可用时用内置目录浏览,也可直接输入本机目录。',
|
|
@@ -618,8 +644,8 @@ window.__ModuleLoader__.load({
|
|
|
618
644
|
'picker.emptyDir': '(空目录)',
|
|
619
645
|
'picker.loading': '加载中…',
|
|
620
646
|
'picker.readingRoot': '正在读取根目录…',
|
|
621
|
-
'picker.back': '回上一级
|
|
622
|
-
'picker.closeBtn': '关闭
|
|
647
|
+
'picker.back': '回上一级',
|
|
648
|
+
'picker.closeBtn': '关闭',
|
|
623
649
|
'picker.newDir': '新建目录',
|
|
624
650
|
'picker.newFolder': '新建文件夹',
|
|
625
651
|
'picker.create': '新建',
|
|
@@ -823,7 +849,6 @@ window.__ModuleLoader__.load({
|
|
|
823
849
|
'ide.unsupported': 'This host does not expose the native editor area required by IDE mode.',
|
|
824
850
|
|
|
825
851
|
'workspaceSearch.options': 'Search options',
|
|
826
|
-
'workspaceSearch.details': 'Scan details',
|
|
827
852
|
'workspaceSearch.matches': '{n} results',
|
|
828
853
|
'workspaceSearch.scanned': '{n} scanned',
|
|
829
854
|
'workspaceSearch.activeOptions': 'Search options · {n}',
|
|
@@ -992,6 +1017,8 @@ window.__ModuleLoader__.load({
|
|
|
992
1017
|
'settings.edit': 'Edit',
|
|
993
1018
|
'settings.delete': 'Delete',
|
|
994
1019
|
'settings.editMachine': 'Edit machine',
|
|
1020
|
+
'settings.addMachine': 'New machine',
|
|
1021
|
+
'settings.adoptAliasHint': 'Save {alias} as a machine so you can set its login password here (it stays editable afterwards)',
|
|
995
1022
|
'settings.badgeSshConfig': 'ssh cfg',
|
|
996
1023
|
// Issue #51 — transport backend (GSSAPI/Kerberos via system OpenSSH).
|
|
997
1024
|
'settings.badgeOpenssh': 'openssh',
|
|
@@ -1036,6 +1063,7 @@ window.__ModuleLoader__.load({
|
|
|
1036
1063
|
'settings.testNeedsHost': 'Fill in the host before testing',
|
|
1037
1064
|
'settings.saveNeedsHost': 'Fill in the host before saving',
|
|
1038
1065
|
'settings.saveHint': 'Save this machine (a blank password/key/passphrase keeps the saved one)',
|
|
1066
|
+
'settings.poolRepointFailed': 'The machine was saved, but re-pointing the active connection failed: {msg}. Select the machine again or restart DSH.',
|
|
1039
1067
|
'settings.fwdNeedsPort': 'Fill in the listen port before adding a forward',
|
|
1040
1068
|
'settings.fwdAddHint': 'Add a port forward',
|
|
1041
1069
|
'settings.advCollapse': 'Hide advanced options',
|
|
@@ -1086,6 +1114,20 @@ window.__ModuleLoader__.load({
|
|
|
1086
1114
|
'settings.fwdAutoNoticeCancel': 'Cancel',
|
|
1087
1115
|
'settings.fwdAutoNoticeDontShow': "Don't show again",
|
|
1088
1116
|
'settings.fwdAdd': 'Add forward',
|
|
1117
|
+
'settings.fwdHost': 'Host',
|
|
1118
|
+
'settings.fwdHostHint': 'Which host this tunnel belongs to. It can start only while that host is connected; you can still define it for a host that is not connected yet.',
|
|
1119
|
+
'settings.fwdHostCurrent': 'current',
|
|
1120
|
+
'settings.fwdHostEmpty': '(no hosts yet)',
|
|
1121
|
+
'settings.fwdHostNeeds': 'Pick a host before adding a forward',
|
|
1122
|
+
'settings.fwdAddedOther': 'Added — start it once {name} is connected',
|
|
1123
|
+
'settings.fwdHostStale': 'The running host half predates the host field and would have attached this tunnel to the connected machine. The forward was removed — restart DSH and add it again.',
|
|
1124
|
+
'settings.fwdEdit': 'Edit',
|
|
1125
|
+
'settings.fwdEditHint': 'Change the direction, listen port, target or host; a running forward is stopped first and then restarted with the new settings',
|
|
1126
|
+
'settings.fwdSaveChanges': 'Save changes',
|
|
1127
|
+
'settings.fwdCancelEdit': 'Cancel',
|
|
1128
|
+
'settings.fwdUpdated': 'Changes saved',
|
|
1129
|
+
'settings.fwdEditingBadge': 'Editing',
|
|
1130
|
+
'settings.fwdUpdateStale': 'The running host half predates forward editing and could not store these changes; the previous forward was restored. Restart DSH and edit again.',
|
|
1089
1131
|
'settings.cleanup': 'Workspace cleanup (local mirrors & chats)',
|
|
1090
1132
|
'settings.cleanupRefresh': 'Refresh',
|
|
1091
1133
|
'settings.cleanupEmpty': 'No local mirrors yet. Pick a remote workspace and it shows up here.',
|
|
@@ -1135,8 +1177,6 @@ window.__ModuleLoader__.load({
|
|
|
1135
1177
|
'settings.badgePwd': 'password',
|
|
1136
1178
|
'settings.badgeKeychain': 'keychain',
|
|
1137
1179
|
'settings.badgeProxy': 'jump',
|
|
1138
|
-
'settings.sectionHide': 'Collapse section',
|
|
1139
|
-
'settings.sectionShow': 'Expand section',
|
|
1140
1180
|
'settings.update': 'Update',
|
|
1141
1181
|
'settings.updateChecking': 'Loading version info…',
|
|
1142
1182
|
'settings.checking': 'Checking…',
|
|
@@ -1195,7 +1235,7 @@ window.__ModuleLoader__.load({
|
|
|
1195
1235
|
'settings.modeOff': 'Off',
|
|
1196
1236
|
'settings.modeManual': 'Manual',
|
|
1197
1237
|
'picker.title': 'Select working directory',
|
|
1198
|
-
'picker.close': 'Close
|
|
1238
|
+
'picker.close': 'Close',
|
|
1199
1239
|
'picker.tabLocal': 'Local',
|
|
1200
1240
|
'picker.tabRemote': 'Remote',
|
|
1201
1241
|
'picker.localIntro': 'Opens the system folder dialog; when unavailable, uses the built-in directory browser. You can also type a local path directly.',
|
|
@@ -1223,8 +1263,8 @@ window.__ModuleLoader__.load({
|
|
|
1223
1263
|
'picker.emptyDir': ' (empty directory)',
|
|
1224
1264
|
'picker.loading': 'Loading…',
|
|
1225
1265
|
'picker.readingRoot': 'Reading root directory…',
|
|
1226
|
-
'picker.back': 'Back
|
|
1227
|
-
'picker.closeBtn': 'Close
|
|
1266
|
+
'picker.back': 'Back',
|
|
1267
|
+
'picker.closeBtn': 'Close',
|
|
1228
1268
|
'picker.newDir': 'New directory',
|
|
1229
1269
|
'picker.newFolder': 'New folder',
|
|
1230
1270
|
'picker.create': 'Create',
|
|
@@ -1472,7 +1512,7 @@ window.__ModuleLoader__.load({
|
|
|
1472
1512
|
// Theme via DSH design tokens so this follows the harness light/dark theme.
|
|
1473
1513
|
const v = (name, fb) => `var(${name}, ${fb})`
|
|
1474
1514
|
const T = {
|
|
1475
|
-
bg: v('--dsw-alias-bg-layer-
|
|
1515
|
+
bg: v('--dsw-alias-bg-layer-2', 'rgba(128,128,128,0.07)'),
|
|
1476
1516
|
bg2: v('--dsw-alias-interactive-bg-hover', 'rgba(128,128,128,0.10)'),
|
|
1477
1517
|
border: v('--dsw-alias-border-l2', 'rgba(128,128,128,0.35)'),
|
|
1478
1518
|
borderStrong: v('--dsw-alias-border-l3', 'rgba(128,128,128,0.5)'),
|
|
@@ -1507,10 +1547,10 @@ window.__ModuleLoader__.load({
|
|
|
1507
1547
|
const CHROME_CSS_ID = 'dsh-remote-chrome'
|
|
1508
1548
|
const CHROME_CSS_TEXT = [
|
|
1509
1549
|
'[data-rw-settings-legacy-icon]{position:relative}[data-rw-settings-legacy-icon]>svg{opacity:0}[data-rw-settings-legacy-icon]::before{content:"";position:absolute;left:12px;top:50%;transform:translateY(-50%);width:16px;height:16px;background:currentColor;mask:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%204h18v12H3zM8%2020h8M12%2016v4M7%208l3%202-3%202M13%2012h4%22%2F%3E%3C%2Fsvg%3E") center/contain no-repeat;-webkit-mask:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%204h18v12H3zM8%2020h8M12%2016v4M7%208l3%202-3%202M13%2012h4%22%2F%3E%3C%2Fsvg%3E") center/contain no-repeat;pointer-events:none}',
|
|
1510
|
-
'.dsh-rw-search-scope{display:flex;gap:8px;align-items:center;margin-top:6px;font-size:11px}.dsh-rw-search-
|
|
1550
|
+
'.dsh-rw-search-scope{display:flex;gap:8px;align-items:center;margin-top:6px;font-size:11px}.dsh-rw-search-detail-body{padding:7px 0 2px;line-height:1.7;color:var(--dsw-alias-label-tertiary,#777)}',
|
|
1511
1551
|
'.dsh-rw-search-controls{margin-top:8px;min-width:0}.dsh-rw-search-panel{display:flex;flex-direction:column;flex:1;min-height:0;min-width:0}.dsh-rw-search-progress{display:flex;align-items:flex-start;gap:8px;padding:7px 10px;border-bottom:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.2));font-size:12px}.dsh-rw-search-progress button{flex-shrink:0;white-space:nowrap}.dsh-rw-search-indicator{width:100%;height:3px;flex-shrink:0;border:0}.dsh-rw-search-results{overflow:auto;flex:1;min-height:0}.dsh-rw-search-result{width:100%;box-sizing:border-box;display:flex;gap:8px;align-items:flex-start;text-align:left;border:0;border-bottom:1px solid rgba(128,128,128,.12);background:transparent;color:inherit;padding:9px 10px;cursor:pointer}.dsh-rw-search-result:hover{background:rgba(128,128,128,.08)}.dsh-rw-search-result:focus-visible{outline:2px solid var(--dsw-alias-button-primary-fill,#2563eb);outline-offset:-2px}',
|
|
1512
1552
|
'.dsh-rw-git{height:100%;min-height:0;display:flex;flex-direction:column;font-size:12px;overflow:hidden;color:inherit}.dsh-rw-git-header{padding:10px;display:flex;flex-direction:column;gap:7px;border-bottom:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.2));flex-shrink:0}.dsh-rw-git-title{display:flex;align-items:center;gap:7px}.dsh-rw-git-title>strong{flex:1}.dsh-rw-git-repo{font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsh-rw-git-hint{font-size:11px;opacity:.7;line-height:1.5}.dsh-rw-git-mode{display:flex;gap:6px}.dsh-rw-git-mode button{padding:4px 8px;white-space:nowrap}.dsh-rw-git-mode button[aria-pressed=true]{font-weight:600;background:rgba(128,128,128,.14)}.dsh-rw-git-header input{box-sizing:border-box;width:100%;font-size:12px}.dsh-rw-git-message{padding:10px;line-height:1.6;overflow-wrap:anywhere}.dsh-rw-git-message button{margin-left:8px}.dsh-rw-git-files{flex:0 1 auto;max-height:34%;overflow:auto;padding:4px;min-height:40px;border-bottom:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.2))}.dsh-rw-git-file{display:flex;gap:7px;align-items:center;width:100%;min-height:30px;padding:5px 8px;border:0;border-radius:4px;background:transparent;color:inherit;cursor:pointer;text-align:left}.dsh-rw-git-file:hover,.dsh-rw-git-file[aria-selected=true]{background:rgba(128,128,128,.13)}.dsh-rw-git-file:focus-visible{outline:2px solid var(--dsw-alias-button-primary-fill,#2563eb);outline-offset:-2px}.dsh-rw-git-file-path{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsh-rw-git-status{flex-shrink:0;font-size:11px;font-family:monospace}.dsh-rw-git-preview{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.dsh-rw-git-preview-title{display:flex;align-items:center;gap:8px;padding:8px 10px}.dsh-rw-git-preview-title>strong{font-size:12px;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsh-rw-git-preview>.dsh-rw-git-hint{padding:0 10px 7px}.dsh-rw-git-diff{flex:1;min-height:0;overflow:auto;font:11px/1.6 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;tab-size:4;padding:4px 0}.dsh-rw-git-diff-line{display:flex;min-width:max-content;white-space:pre}.dsh-rw-git-diff-line>span:last-child{padding-right:12px}.dsh-rw-git-diff-line[data-rw-diff-kind=added]{background:rgba(34,197,94,.11)}.dsh-rw-git-diff-line[data-rw-diff-kind=removed]{background:rgba(239,68,68,.11)}.dsh-rw-git-diff-line[data-rw-diff-kind=hunk]{background:rgba(59,130,246,.1)}.dsh-rw-git-line-number{box-sizing:border-box;flex:0 0 48px;width:48px;padding:0 7px;border:0;background:transparent;color:inherit;opacity:.6;font:inherit;text-align:right;user-select:none}.dsh-rw-git-diff button.dsh-rw-git-line-number{cursor:pointer}.dsh-rw-git-diff button.dsh-rw-git-line-number:hover{opacity:1;text-decoration:underline}',
|
|
1513
|
-
'.dsh-rw-applied-change{border-top:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.2));min-width:0;overflow:hidden}.dsh-rw-change-heading{display:flex;gap:8px;align-items:center;padding:7px 10px;font-size:11px}.dsh-rw-change-heading strong{font-weight:500}.dsh-rw-change-hunk{margin:0 8px 6px}
|
|
1553
|
+
'.dsh-rw-applied-change{border-top:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.2));min-width:0;overflow:hidden}.dsh-rw-change-heading{display:flex;gap:8px;align-items:center;padding:7px 10px;font-size:11px}.dsh-rw-change-heading strong{font-weight:500}.dsh-rw-change-hunk{margin:0 8px 6px}',
|
|
1514
1554
|
'.dsh-rw-btn{transition:background .12s ease,opacity .12s ease,border-color .12s ease}',
|
|
1515
1555
|
'.dsh-rw-btn:hover:not(:disabled){background:rgba(128,128,128,.18)}',
|
|
1516
1556
|
'.dsh-rw-btn:focus-visible{outline:2px solid var(--dsw-alias-button-primary-fill,#2563eb);outline-offset:1px}',
|
|
@@ -1528,10 +1568,14 @@ window.__ModuleLoader__.load({
|
|
|
1528
1568
|
'.dsh-rw-row{border-radius:8px;margin:0 -6px;padding-left:8px;padding-right:8px;transition:background .12s ease}',
|
|
1529
1569
|
'.dsh-rw-row:hover{background:rgba(128,128,128,.14)}',
|
|
1530
1570
|
'.dsh-rw-list-item{transition:background .1s ease}',
|
|
1531
|
-
'.dsh-rw-action{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;flex-shrink:0;border:0;border-radius:5px;background:transparent;color:var(--dsw-alias-label-secondary,#929298);cursor:pointer}',
|
|
1571
|
+
'.dsh-rw-action{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;flex-shrink:0;border:0;border-radius:var(--dsw-radius-sm,5px);background:transparent;color:var(--dsw-alias-label-secondary,#929298);cursor:pointer}',
|
|
1532
1572
|
'.dsh-rw-action:hover:not(:disabled),.dsh-rw-action[aria-pressed=true]{background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.12));color:var(--dsw-alias-label-primary,#e4e4e7)}',
|
|
1533
1573
|
'.dsh-rw-action:focus-visible{outline:2px solid var(--dsw-alias-button-primary-fill,#2563eb);outline-offset:-2px}',
|
|
1534
1574
|
'.dsh-rw-action:disabled{opacity:.4;cursor:default}',
|
|
1575
|
+
'.dsh-rw-select{display:inline-flex;align-items:center;justify-content:space-between;gap:6px;min-width:0;max-width:100%;box-sizing:border-box;border:0;border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-module-platform,rgba(128,128,128,.12));color:var(--dsw-alias-label-primary,#e4e4e7);font:inherit;line-height:1.35;cursor:pointer;text-align:left;transition:background .12s ease}.dsh-rw-select:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.18))}.dsh-rw-select:focus-visible{outline:2px solid var(--dsw-alias-button-primary-fill,#2563eb);outline-offset:1px}.dsh-rw-select:disabled{opacity:.5;cursor:default}.dsh-rw-select-value{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsh-rw-select-chevron{flex:none;color:var(--dsw-alias-label-secondary,#929298)}',
|
|
1576
|
+
'.dsh-rw-select-anchor{min-width:0;max-width:100%}.dsh-rw-search-scope>.dsh-rw-select-anchor{flex:1;min-width:0}.dsh-rw-search-scope>.dsh-rw-select-anchor>.dsh-rw-select{width:100%}.dsh-rw-settings-field>.dsh-rw-select-anchor,.dsh-rw-settings-field>select{justify-self:start;min-width:0}.dsh-rw-settings-field>.dsh-rw-check{justify-self:start}',
|
|
1577
|
+
'.dsh-rw-disclosure{width:100%;min-width:0}.dsh-rw-disclosure-head{display:flex;align-items:center;gap:8px;min-width:0;flex-wrap:wrap}.dsh-rw-disclosure-head[data-open]{margin-bottom:8px}.dsh-rw-disclosure-head>*:not(.dsh-rw-disclosure-row){flex-shrink:0;white-space:nowrap}.dsh-rw-disclosure-row{flex:1 1 auto;display:inline-flex;align-items:center;gap:6px;min-width:0;padding:0;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}.dsh-rw-disclosure-row:hover{opacity:.78}.dsh-rw-disclosure-row:focus-visible{outline:2px solid var(--dsw-alias-button-primary-fill,#2563eb);outline-offset:2px;border-radius:4px}.dsh-rw-disclosure-title{font-size:13px;font-weight:600;color:var(--dsw-alias-label-primary,#e4e4e7)}.dsh-rw-disclosure-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsh-rw-disclosure-chevron,.dsh-rw-disclosure-icon{flex:none;color:var(--dsw-alias-label-tertiary,#929298)}.dsh-rw-disclosure-icon{display:inline-flex}',
|
|
1578
|
+
'.dsh-rw-check{display:inline-flex;align-items:center;gap:8px;font-size:12px;line-height:20px;color:inherit;cursor:pointer}.dsh-rw-check input{width:16px;height:16px;margin:0;flex:none;accent-color:var(--dsw-alias-button-primary-fill,#2563eb);cursor:inherit}',
|
|
1535
1579
|
'.dsh-rw-tree-row:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.10))!important}',
|
|
1536
1580
|
'.dsh-rw-tree-row[aria-selected=true]{background:color-mix(in srgb,var(--dsw-alias-button-primary-fill,#2563eb) 10%,transparent)!important}',
|
|
1537
1581
|
'.dsh-rw-tree-row .dsh-rw-row-meta{opacity:0;transition:opacity .1s}',
|
|
@@ -1568,7 +1612,7 @@ window.__ModuleLoader__.load({
|
|
|
1568
1612
|
'.dsh-rw-settings-tabs{display:flex;gap:20px;position:sticky;top:0;z-index:4;background:var(--dsw-alias-background-primary,#fff);border-bottom:1px solid var(--dsw-alias-border-primary,#ddd);padding-top:6px}',
|
|
1569
1613
|
'.dsh-rw-settings-tabs [role=tab]{background:none;border:0;border-bottom:2px solid transparent;padding:8px 0 12px;cursor:pointer;font:inherit;font-size:12px;color:inherit;opacity:.6;white-space:nowrap}',
|
|
1570
1614
|
'.dsh-rw-settings-tabs [aria-selected=true]{opacity:1;border-bottom-color:currentColor;font-weight:600}',
|
|
1571
|
-
'
|
|
1615
|
+
'[data-rw-settings] button:focus-visible,.dsh-rw-settings-tabs button:focus-visible{outline:2px solid currentColor;outline-offset:3px}',
|
|
1572
1616
|
'.dsh-rw-settings-panel{flex-direction:column;gap:16px;min-width:0}',
|
|
1573
1617
|
'.dsh-rw-settings-card{min-width:0}',
|
|
1574
1618
|
'.dsh-rw-settings-hosts{border:0!important;padding:0!important}',
|
|
@@ -1598,20 +1642,15 @@ window.__ModuleLoader__.load({
|
|
|
1598
1642
|
'.dsh-rw-settings-menu-items button{border:0!important;text-align:left;background:transparent!important;padding:8px 10px!important}',
|
|
1599
1643
|
'.dsh-rw-settings-menu-items button:hover{background:rgba(128,128,128,.1)!important}',
|
|
1600
1644
|
'.dsh-rw-settings .dsh-rw-pill{border-color:transparent!important;background:rgba(128,128,128,.07);color:inherit!important;font-size:10px}',
|
|
1601
|
-
'.dsh-rw-settings-advanced{display:flex;gap:6px;align-items:center;border:0!important;background:transparent!important;text-align:left;padding:8px 0!important}',
|
|
1602
1645
|
'.dsh-rw-settings-editor{border:0!important;padding:0!important}',
|
|
1603
1646
|
'.dsh-rw-settings-editor-heading{display:flex;gap:12px;align-items:center;padding:0 0 4px}',
|
|
1604
1647
|
'.dsh-rw-settings-editor-heading>button{display:flex;gap:4px;align-items:center;border:0!important;padding:4px 0!important;font-size:11px;opacity:.7}',
|
|
1605
1648
|
'.dsh-rw-settings-editor-actions{position:sticky;top:47px;z-index:3;display:flex;justify-content:flex-end;gap:8px;padding:10px 0 14px;border-bottom:1px solid;margin-bottom:16px}',
|
|
1606
1649
|
'.dsh-rw-settings-field{display:grid;grid-template-columns:108px minmax(0,1fr);gap:12px;align-items:center;margin-bottom:14px}',
|
|
1607
1650
|
'.dsh-rw-settings-field input:not([type=checkbox]),.dsh-rw-settings-field select{min-width:0;max-width:100%;box-sizing:border-box}',
|
|
1608
|
-
'.dsh-rw-settings-field input[type=checkbox]{justify-self:start}',
|
|
1609
1651
|
'.dsh-rw-settings-message{padding:9px 12px;border-radius:6px;background:rgba(128,128,128,.06);overflow-wrap:anywhere}',
|
|
1610
|
-
'.dsh-rw-settings-section-heading{flex-wrap:wrap}.dsh-rw-settings-section-heading>.dsh-rw-section-btn{flex:1;min-width:150px;width:auto;line-height:1.6}.dsh-rw-settings-section-heading>.dsh-rw-btn{white-space:nowrap;flex-shrink:0}',
|
|
1611
1652
|
'@media(max-width:600px){[data-shortcut-modal=settings]:has([data-rw-settings]){display:flex!important;flex-direction:column!important;overflow:hidden!important}[data-shortcut-modal=settings]:has([data-rw-settings])>nav{flex:0 0 auto!important;width:100%!important;max-width:none!important;padding:16px 16px 0!important;box-sizing:border-box}[data-shortcut-modal=settings]:has([data-rw-settings])>nav>div:first-child{padding:0!important;margin:0 0 10px!important;min-height:32px}[data-shortcut-modal=settings]:has([data-rw-settings])>nav>div:last-child{display:flex!important;flex-direction:row!important;overflow-x:auto!important;gap:4px;padding-bottom:8px}[data-shortcut-modal=settings]:has([data-rw-settings]) nav button{flex:0 0 auto!important;white-space:nowrap;padding:8px 10px!important}[data-shortcut-modal=settings]:has([data-rw-settings])>nav+div{flex:1!important;min-width:0!important;min-height:0!important;width:100%!important;overflow:auto}[data-shortcut-modal=settings]:has([data-rw-settings])>nav+div>div:first-child{position:absolute!important;top:16px;right:16px;padding:0!important;min-height:30px;z-index:1}[data-shortcut-modal=settings]:has([data-rw-settings])>nav+div>div:last-child{padding:0 16px 16px!important;min-width:0!important}[data-rw-settings]{box-sizing:border-box}.dsh-rw-settings{padding:16px 0!important}}',
|
|
1612
|
-
'@media(max-width:600px){.dsh-rw-settings-section-heading>.dsh-rw-section-btn{flex-basis:100%}}',
|
|
1613
1653
|
'@media(max-width:600px){.dsh-rw-settings{padding:16px;gap:14px}.dsh-rw-settings-tabs{gap:18px}.dsh-rw-settings-field{grid-template-columns:1fr;gap:5px}.dsh-rw-settings-editor [style*="margin-left"]{margin-left:0!important}.dsh-rw-settings-editor [style*="padding-left"]{padding-left:0!important}.dsh-rw-settings-editor-actions{flex-wrap:wrap;top:47px}.dsh-rw-settings-panel>div{min-width:0}.dsh-rw-settings-panel [style*="min-width: 260px"]{min-width:0!important}}',
|
|
1614
|
-
'.dsh-rw-section-btn{width:100%;text-align:left;display:flex;align-items:center;gap:8px;background:transparent;border:none;cursor:pointer;padding:0;color:inherit}',
|
|
1615
1654
|
'@keyframes dsh-rw-in{from{opacity:0;transform:translateY(6px) scale(.98)}to{opacity:1;transform:none}}',
|
|
1616
1655
|
'.dsh-rw-modal-panel{animation:dsh-rw-in .14s ease-out}',
|
|
1617
1656
|
].join('')
|
|
@@ -1703,7 +1742,7 @@ window.__ModuleLoader__.load({
|
|
|
1703
1742
|
},
|
|
1704
1743
|
React.createElement('div', {
|
|
1705
1744
|
className: 'dsh-rw-modal-panel',
|
|
1706
|
-
style: { background: v('--dsw-alias-bg-
|
|
1745
|
+
style: { background: v('--dsw-alias-bg-layer-2', '#1e1e1e'), border: '1px solid ' + T.borderStrong, borderRadius: 10, padding: 14, width: 'min(420px, 92vw)', display: 'flex', flexDirection: 'column', gap: 10, boxShadow: '0 12px 40px rgba(0,0,0,0.4)' },
|
|
1707
1746
|
onClick: (e) => e.stopPropagation(),
|
|
1708
1747
|
},
|
|
1709
1748
|
React.createElement('div', { style: { fontSize: 13, fontWeight: 600, color: T.label } }, title),
|
|
@@ -1944,7 +1983,14 @@ window.__ModuleLoader__.load({
|
|
|
1944
1983
|
const formBaseline = React.useRef(settingsEditorDraft?.baseline || null)
|
|
1945
1984
|
const probeRevision = React.useRef(0)
|
|
1946
1985
|
const [machines, setMachines] = React.useState([])
|
|
1986
|
+
// Which machine the pool is on: the forwards form defaults its host select
|
|
1987
|
+
// to it, marks it as 当前, and uses it to tell the user when a newly added
|
|
1988
|
+
// forward belongs to a different host.
|
|
1989
|
+
const [currentId, setCurrentId] = React.useState('')
|
|
1947
1990
|
const [hostsLoaded, setHostsLoaded] = React.useState(false)
|
|
1991
|
+
// The machine editor also serves NEW records (adopting a ~/.ssh/config
|
|
1992
|
+
// host or a manual machine), so it cannot be keyed on `form.id`.
|
|
1993
|
+
const [formOpen, setFormOpen] = React.useState(() => !!settingsEditorDraft)
|
|
1948
1994
|
const [form, setForm] = React.useState(() => settingsEditorDraft?.form || {
|
|
1949
1995
|
name: '', host: '', port: '22', username: 'root', password: '', privateKeyPath: '',
|
|
1950
1996
|
passphrase: '', workspace: '', hostKeyMode: '', useAgent: false, keyboardInteractive: false,
|
|
@@ -1958,8 +2004,8 @@ window.__ModuleLoader__.load({
|
|
|
1958
2004
|
// between "the plugin remembered my password" and "the plugin lost it".
|
|
1959
2005
|
passwordSet: false, passphraseSet: false, proxyPasswordSet: false,
|
|
1960
2006
|
})
|
|
1961
|
-
React.useEffect(() => { if (
|
|
1962
|
-
const formDirty =
|
|
2007
|
+
React.useEffect(() => { if (formOpen) document.getElementById(settingsId + '-field-n')?.focus?.() }, [formOpen])
|
|
2008
|
+
const formDirty = formOpen && formBaseline.current !== null && JSON.stringify(form) !== formBaseline.current
|
|
1963
2009
|
React.useEffect(() => {
|
|
1964
2010
|
settingsEditorDraft = formDirty ? { form, baseline: formBaseline.current } : null
|
|
1965
2011
|
}, [form, formDirty])
|
|
@@ -1968,7 +2014,9 @@ window.__ModuleLoader__.load({
|
|
|
1968
2014
|
const [err, setErr] = React.useState('')
|
|
1969
2015
|
const [tst, setTst] = React.useState('') // idle | testing | ok | failing
|
|
1970
2016
|
const [forwards, setForwards] = React.useState([])
|
|
1971
|
-
const [fwdForm, setFwdForm] = React.useState({ listenPort: '', targetHost: '127.0.0.1', targetPort: '', direction: 'local', autoStart: false })
|
|
2017
|
+
const [fwdForm, setFwdForm] = React.useState({ listenPort: '', targetHost: '127.0.0.1', targetPort: '', direction: 'local', autoStart: false, machineId: '' })
|
|
2018
|
+
// Which saved definition the form is editing ('' = the form adds a new one).
|
|
2019
|
+
const [fwdEditId, setFwdEditId] = React.useState('')
|
|
1972
2020
|
const [auditLines, setAuditLines] = React.useState([])
|
|
1973
2021
|
// The audit LOG FILE on the host machine: its path plus the outcome of the last
|
|
1974
2022
|
// 打开/显示 attempt. The browser cannot open a file that lives on the host, so
|
|
@@ -2133,7 +2181,7 @@ window.__ModuleLoader__.load({
|
|
|
2133
2181
|
}
|
|
2134
2182
|
|
|
2135
2183
|
const refresh = () => api('GET', '/dsh-remote/machines').then((r) => {
|
|
2136
|
-
setMachines(r.machines || []); setHostsLoaded(true)
|
|
2184
|
+
setMachines(r.machines || []); setCurrentId(String((r && r.currentId) || '')); setHostsLoaded(true)
|
|
2137
2185
|
})
|
|
2138
2186
|
React.useEffect(() => { refresh().catch(error => setErr(String(error.message || error))) }, [])
|
|
2139
2187
|
|
|
@@ -2153,6 +2201,15 @@ window.__ModuleLoader__.load({
|
|
|
2153
2201
|
}
|
|
2154
2202
|
}, [])
|
|
2155
2203
|
|
|
2204
|
+
React.useEffect(() => {
|
|
2205
|
+
setFwdForm((prev) => {
|
|
2206
|
+
if (!machines.length) return prev.machineId ? { ...prev, machineId: '' } : prev
|
|
2207
|
+
if (prev.machineId && machines.some((m) => m.id === prev.machineId)) return prev
|
|
2208
|
+
const next = machines.some((m) => m.id === currentId) ? currentId : machines[0].id
|
|
2209
|
+
return next === prev.machineId ? prev : { ...prev, machineId: next }
|
|
2210
|
+
})
|
|
2211
|
+
}, [machines, currentId])
|
|
2212
|
+
|
|
2156
2213
|
// ── update state ────────────────────────────────────────────────────────
|
|
2157
2214
|
const [upd, setUpd] = React.useState(null) // { current, latest, updateAvailable, updateMode, updatedMarker }
|
|
2158
2215
|
const [updBusy, setUpdBusy] = React.useState(false)
|
|
@@ -2262,7 +2319,8 @@ window.__ModuleLoader__.load({
|
|
|
2262
2319
|
}
|
|
2263
2320
|
|
|
2264
2321
|
const setF = (k) => (ev) => { probeRevision.current++; setTst(''); setForm({ ...form, [k]: ev.target.value }) }
|
|
2265
|
-
const
|
|
2322
|
+
const setV = (k) => (value) => { probeRevision.current++; setTst(''); setForm({ ...form, [k]: value }) }
|
|
2323
|
+
const setB = (k) => (checked) => { probeRevision.current++; setTst(''); setForm({ ...form, [k]: checked === true }) }
|
|
2266
2324
|
// Issue #125: attach rows relay WHY a tunnel is a fresh spawn (or that it
|
|
2267
2325
|
// reuses the resident instance). Declared as a table so the i18n dead-key
|
|
2268
2326
|
// guard sees each status string referenced.
|
|
@@ -2298,6 +2356,7 @@ window.__ModuleLoader__.load({
|
|
|
2298
2356
|
}
|
|
2299
2357
|
formBaseline.current = JSON.stringify(next)
|
|
2300
2358
|
setForm(next)
|
|
2359
|
+
setFormOpen(true)
|
|
2301
2360
|
// 编辑时若该机器用了高级配置(私钥/agent/跳板/钥匙串/系统 OpenSSH 后端),自动展开折叠区
|
|
2302
2361
|
setAdvOpen(!!(m.privateKeyPath || m.useAgent || m.keyboardInteractive || (m.proxy && m.proxy.host) || m.backend === 'openssh' || m.webAttachCommand || m.webAttachDiscoverCommand || (m.credentialBackend && m.credentialBackend !== 'plain')))
|
|
2303
2362
|
}
|
|
@@ -2314,7 +2373,10 @@ window.__ModuleLoader__.load({
|
|
|
2314
2373
|
setProbeGeneration(value => value + 1)
|
|
2315
2374
|
window.setTimeout(() => document.getElementById(focusId)?.focus?.(), 0)
|
|
2316
2375
|
}
|
|
2317
|
-
const clearForm = () =>
|
|
2376
|
+
const clearForm = () => {
|
|
2377
|
+
setFormOpen(false)
|
|
2378
|
+
setForm({ name: '', host: '', port: '22', username: 'root', password: '', privateKeyPath: '', passphrase: '', workspace: '', hostKeyMode: '', useAgent: false, keyboardInteractive: false, encryptPassword: false, proxyHost: '', proxyPort: '22', proxyUser: '', proxyPassword: '', proxyKey: '', backend: 'native', sshBinary: '', webAttachCommand: '', webAttachDiscoverCommand: '', id: '', useSshConfig: false, passwordSet: false, passphraseSet: false, proxyPasswordSet: false })
|
|
2379
|
+
}
|
|
2318
2380
|
const save = (action) => {
|
|
2319
2381
|
if (busy) return
|
|
2320
2382
|
probeRevision.current++
|
|
@@ -2374,6 +2436,9 @@ window.__ModuleLoader__.load({
|
|
|
2374
2436
|
// say so, or the user cannot tell their workspaces came along.
|
|
2375
2437
|
else if (r && r.reboundMirrors) setMsg(tr('settings.saved') + ' — ' + tr('settings.rebound', { n: r.reboundMirrors }))
|
|
2376
2438
|
else setMsg(form.id ? tr('settings.saved') : tr('settings.added'))
|
|
2439
|
+
// The record is saved, but the LIVE pool could not be re-pointed at
|
|
2440
|
+
// the new address — say so, or the next 启动 still dials the old host.
|
|
2441
|
+
if (r && r.poolWarning) setErr(tr('settings.poolRepointFailed', { msg: r.poolWarning }))
|
|
2377
2442
|
setProbeGeneration(value => value + 1)
|
|
2378
2443
|
}).catch((e) => setErr(String((e && e.message) || e))).finally(() => setBusy(false))
|
|
2379
2444
|
}
|
|
@@ -2392,6 +2457,33 @@ window.__ModuleLoader__.load({
|
|
|
2392
2457
|
const uniqueMachines = machines
|
|
2393
2458
|
const discovered = dedupeDiscoveredForSaved(sshHosts || [], machines)
|
|
2394
2459
|
|
|
2460
|
+
// A discovered ~/.ssh/config entry is not a registry record yet; the menu
|
|
2461
|
+
// edits it through the SAME machine form, prefilled as an alias.
|
|
2462
|
+
const discoveredMachine = (h) => {
|
|
2463
|
+
const alias = String(h.alias || h.host)
|
|
2464
|
+
return {
|
|
2465
|
+
name: alias, host: alias, port: Number(h.port) || 22, username: h.user || '',
|
|
2466
|
+
useSshConfig: true, backend: 'openssh',
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
// Open the shared host menu ATTACHED to the `...` button that was pressed.
|
|
2471
|
+
//
|
|
2472
|
+
// DSH 0.2.2-alpha.2 replaced `getAnchorRect` with CSS anchors
|
|
2473
|
+
// (`anchorRef` / `anchorPoint`). An older host ignores the new props, a
|
|
2474
|
+
// newer host ignores the old one, so pass BOTH: before the refactor the
|
|
2475
|
+
// rect was the only way to anchor a body-portaled menu to a host-owned
|
|
2476
|
+
// trigger, and after it the ref is. Passing only the rect (the old code)
|
|
2477
|
+
// left the menu unattached on a current host.
|
|
2478
|
+
const openHostMenu = (event, key, machine, discovered) => {
|
|
2479
|
+
const el = event.currentTarget
|
|
2480
|
+
setSettingsMenu({
|
|
2481
|
+
key, machine, discovered: !!discovered, el,
|
|
2482
|
+
anchorRef: { current: el },
|
|
2483
|
+
getAnchorRect: () => el.getBoundingClientRect(),
|
|
2484
|
+
})
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2395
2487
|
// Keep row order stable while connectivity results arrive.
|
|
2396
2488
|
const sortedMachines = [...uniqueMachines].sort((a, b) => String(a.name || a.host).localeCompare(String(b.name || b.host)))
|
|
2397
2489
|
// Every saved machine id gets its own probe (credentials and backend are
|
|
@@ -2503,31 +2595,113 @@ window.__ModuleLoader__.load({
|
|
|
2503
2595
|
applyFwdAutoStart(fwdNotice.target, true)
|
|
2504
2596
|
setFwdNotice(null)
|
|
2505
2597
|
}
|
|
2598
|
+
const resetFwdForm = () => setFwdForm((form) => ({ listenPort: '', targetHost: '127.0.0.1', targetPort: '', direction: 'local', autoStart: false, machineId: form.machineId }))
|
|
2599
|
+
const fwdFields = () => ({
|
|
2600
|
+
direction: fwdForm.direction,
|
|
2601
|
+
listenPort: Number(fwdForm.listenPort),
|
|
2602
|
+
targetHost: fwdForm.targetHost || '127.0.0.1',
|
|
2603
|
+
targetPort: Number(fwdForm.targetPort) || Number(fwdForm.listenPort),
|
|
2604
|
+
autoStart: !!fwdForm.autoStart,
|
|
2605
|
+
machineId: fwdForm.machineId,
|
|
2606
|
+
})
|
|
2607
|
+
const beginFwdEdit = (f) => {
|
|
2608
|
+
setFwdEditId(f.id); setErr(''); setMsg('')
|
|
2609
|
+
setFwdForm({
|
|
2610
|
+
listenPort: String(f.listenPort ?? ''), targetHost: String(f.targetHost || '127.0.0.1'),
|
|
2611
|
+
targetPort: String(f.targetPort ?? ''), direction: f.direction === 'reverse' ? 'reverse' : 'local',
|
|
2612
|
+
autoStart: !!f.autoStart, machineId: f.machineId || '',
|
|
2613
|
+
})
|
|
2614
|
+
setFwdOpen(true)
|
|
2615
|
+
// With several forwards the form sits below all rows; bring it into view
|
|
2616
|
+
// so the click visibly lands somewhere.
|
|
2617
|
+
window.setTimeout(() => {
|
|
2618
|
+
document.getElementById(settingsId + '-fwd-form')?.scrollIntoView?.({ block: 'nearest', behavior: 'smooth' })
|
|
2619
|
+
}, 0)
|
|
2620
|
+
}
|
|
2621
|
+
const cancelFwdEdit = () => { setFwdEditId(''); setErr(''); resetFwdForm() }
|
|
2506
2622
|
const fwdDefine = () => {
|
|
2507
2623
|
if (!fwdForm.listenPort) return
|
|
2508
|
-
|
|
2509
|
-
|
|
2624
|
+
if (!fwdForm.machineId) { setErr(tr('settings.fwdHostNeeds')); return }
|
|
2625
|
+
const machineId = fwdForm.machineId
|
|
2626
|
+
api('POST', '/dsh-remote/forwards', { action: 'define', ...fwdFields() })
|
|
2627
|
+
.then((r) => {
|
|
2628
|
+
const added = r && r.forward
|
|
2629
|
+
// A running HOST half that predates this field ignores `machineId` and
|
|
2630
|
+
// tags the ACTIVE machine instead — the tunnel would silently belong to
|
|
2631
|
+
// the wrong host. Detect it, undo the definition and say what to do.
|
|
2632
|
+
if (added && added.machineId !== machineId) {
|
|
2633
|
+
api('POST', '/dsh-remote/forwards', { action: 'remove', id: added.id }).then(refreshForwards).catch(() => {})
|
|
2634
|
+
setErr(tr('settings.fwdHostStale'))
|
|
2635
|
+
return
|
|
2636
|
+
}
|
|
2637
|
+
setForwards(r.forwards || [])
|
|
2638
|
+
resetFwdForm()
|
|
2639
|
+
// Defining for a host that is not connected is legitimate (it becomes
|
|
2640
|
+
// startable once that host is), but the row gives no other clue — say
|
|
2641
|
+
// which host the tunnel now belongs to.
|
|
2642
|
+
if (added && added.machineId && added.machineId !== currentId) {
|
|
2643
|
+
const target = machines.find((m) => m.id === added.machineId)
|
|
2644
|
+
setMsg(tr('settings.fwdAddedOther', { name: (target && (target.name || target.host)) || added.machineId }))
|
|
2645
|
+
}
|
|
2646
|
+
})
|
|
2510
2647
|
.catch((e) => setErr(String((e && e.message) || e)))
|
|
2511
2648
|
}
|
|
2649
|
+
// Editing an EXISTING definition, including one that is running. A live
|
|
2650
|
+
// tunnel keeps its old bind until it is torn down, so the client stops it,
|
|
2651
|
+
// patches the record and starts it again — "adjust it and keep it running"
|
|
2652
|
+
// is what the button promises.
|
|
2653
|
+
const fwdSaveEdit = async () => {
|
|
2654
|
+
const id = fwdEditId
|
|
2655
|
+
const target = forwards.find((f) => f.id === id)
|
|
2656
|
+
if (!id || !target) { setFwdEditId(''); resetFwdForm(); return }
|
|
2657
|
+
if (!fwdForm.listenPort) return
|
|
2658
|
+
if (!fwdForm.machineId) { setErr(tr('settings.fwdHostNeeds')); return }
|
|
2659
|
+
const wasActive = !!target.active
|
|
2660
|
+
setFwdBusy((m) => ({ ...m, [id]: true })); setErr(''); setMsg('')
|
|
2661
|
+
const fields = fwdFields()
|
|
2662
|
+
try {
|
|
2663
|
+
if (wasActive) await api('POST', '/dsh-remote/forwards', { action: 'stop', id })
|
|
2664
|
+
const r = await api('POST', '/dsh-remote/forwards', { action: 'update', id, ...fields })
|
|
2665
|
+
const saved = r && r.forward
|
|
2666
|
+
// An older HOST half only knows `autoStart` and ignores the bind
|
|
2667
|
+
// fields — it would answer "ok" while nothing changed. Compare what it
|
|
2668
|
+
// stored with what was asked, put the tunnel back and say so.
|
|
2669
|
+
const applied = saved && saved.direction === fields.direction
|
|
2670
|
+
&& saved.listenPort === fields.listenPort && saved.targetHost === fields.targetHost
|
|
2671
|
+
&& saved.targetPort === fields.targetPort
|
|
2672
|
+
&& (saved.machineId || null) === (fields.machineId || null)
|
|
2673
|
+
if (saved && !applied) {
|
|
2674
|
+
setErr(tr('settings.fwdUpdateStale'))
|
|
2675
|
+
refreshForwards()
|
|
2676
|
+
if (wasActive) api('POST', '/dsh-remote/forwards', { action: 'start', id }).catch(() => {})
|
|
2677
|
+
return
|
|
2678
|
+
}
|
|
2679
|
+
if (Array.isArray(r.forwards)) setForwards(r.forwards)
|
|
2680
|
+
setFwdEditId(''); resetFwdForm(); setMsg(tr('settings.fwdUpdated'))
|
|
2681
|
+
if (wasActive) {
|
|
2682
|
+
const s = await api('POST', '/dsh-remote/forwards', { action: 'start', id })
|
|
2683
|
+
if (Array.isArray(s.forwards)) setForwards(s.forwards)
|
|
2684
|
+
}
|
|
2685
|
+
} catch (e) {
|
|
2686
|
+
setErr(String((e && e.message) || e))
|
|
2687
|
+
refreshForwards()
|
|
2688
|
+
} finally {
|
|
2689
|
+
setFwdBusy((m) => { const next = { ...m }; delete next[id]; return next })
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2512
2692
|
|
|
2513
2693
|
const fieldNote = text => React.createElement('div', { className: 'dsh-rw-settings-field-note', style: { color: T.muted } }, text)
|
|
2514
2694
|
const row = (label, ctrl, k) => {
|
|
2515
2695
|
const id = ctrl.props.id || settingsId + '-field-' + k
|
|
2516
|
-
if (ctrl.
|
|
2696
|
+
if (ctrl.type === RwSelect) return React.createElement('div', { key: k, className: 'dsh-rw-settings-field' }, React.createElement('span', { style: { fontSize: 12, color: T.muted } }, label), React.cloneElement(ctrl, { id, label }))
|
|
2697
|
+
if (ctrl.type === RwCheckbox) return React.createElement('div', { key: k, className: 'dsh-rw-settings-field is-toggle' }, React.createElement('span', { 'aria-hidden': true }), React.cloneElement(ctrl, { id, label }))
|
|
2517
2698
|
return React.createElement('div', { key: k, className: 'dsh-rw-settings-field' },
|
|
2518
2699
|
React.createElement('label', { htmlFor: id, style: { fontSize: 12, color: T.muted } }, label),
|
|
2519
2700
|
React.cloneElement(ctrl, { id }))
|
|
2520
2701
|
}
|
|
2521
2702
|
const pill = (cls, text) => React.createElement('span', { className: 'dsh-rw-pill' + (cls ? ' ' + cls : ''), style: { marginLeft: 4 } }, text)
|
|
2522
|
-
const
|
|
2523
|
-
|
|
2524
|
-
type: 'button', className: 'dsh-rw-section-btn',
|
|
2525
|
-
title: open ? tr('settings.sectionHide') : tr('settings.sectionShow'), 'aria-expanded': open,
|
|
2526
|
-
onClick: () => setOpen(!open),
|
|
2527
|
-
style: { fontSize: 13, fontWeight: 600 },
|
|
2528
|
-
}, React.createElement('span', { style: { opacity: 0.7, width: 12 } }, open ? '▾' : '▸'), title),
|
|
2529
|
-
extra || null,
|
|
2530
|
-
)
|
|
2703
|
+
const sectionIcon = (Icon) => Icon ? React.createElement(Icon, { size: 14 }) : null
|
|
2704
|
+
const sectionToggle = (open, setOpen, title, extra, icon) => disclosureRow({ open, onToggle: () => setOpen(!open), title, icon, accessory: extra || null, titleClassName: 'dsh-rw-disclosure-title' })
|
|
2531
2705
|
|
|
2532
2706
|
// Issue #73: hosts from ~/.ssh/config that are NOT saved yet — they are the
|
|
2533
2707
|
// first thing the page shows, because that is the whole list a VSCode
|
|
@@ -2549,7 +2723,7 @@ window.__ModuleLoader__.load({
|
|
|
2549
2723
|
style: { color: pending ? T.muted : result.ok ? 'var(--dsw-alias-state-success-primary,#25845b)' : 'var(--dsw-alias-state-error-primary,#c44b4b)' },
|
|
2550
2724
|
}, pending ? tr('settings.testing') : result.ok ? tr('settings.reachable') + (result.latencyMs != null ? ' · ' + result.latencyMs + ' ms' : '') : tr('settings.unreachable'))
|
|
2551
2725
|
}
|
|
2552
|
-
const rowResult = key => rowState[key]?.ok === false ? React.createElement(
|
|
2726
|
+
const rowResult = key => rowState[key]?.ok === false ? React.createElement(RwDetails, { className: 'dsh-rw-settings-probe-error', title: tr('settings.probeDetails') }, React.createElement('div', { style: { fontSize: 11, color: T.muted, lineHeight: 1.6, overflowWrap: 'anywhere', paddingTop: 2 } }, rowState[key].text)) : null
|
|
2553
2727
|
|
|
2554
2728
|
return React.createElement('div',
|
|
2555
2729
|
{ className: 'dsh-rw-settings', 'data-rw-settings': true, 'aria-label': tr('settings.title'), style: { color: T.label } },
|
|
@@ -2569,9 +2743,7 @@ window.__ModuleLoader__.load({
|
|
|
2569
2743
|
key: index,
|
|
2570
2744
|
style: { fontSize: 12.5, lineHeight: 1.6, color: index === 0 ? T.label : T.muted },
|
|
2571
2745
|
}, paragraph))),
|
|
2572
|
-
React.createElement('
|
|
2573
|
-
React.createElement('input', { type: 'checkbox', checked: fwdNoticeDontShow, onChange: (e) => setFwdNoticeDontShow(!!e.target.checked) }),
|
|
2574
|
-
tr('settings.fwdAutoNoticeDontShow')),
|
|
2746
|
+
React.createElement('div', { style: { marginTop: 16 } }, React.createElement(RwCheckbox, { checked: fwdNoticeDontShow, onChange: (next) => setFwdNoticeDontShow(next === true), label: tr('settings.fwdAutoNoticeDontShow') })),
|
|
2575
2747
|
React.createElement('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end', marginTop: 16 } },
|
|
2576
2748
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, padding: '4px 14px' }, onClick: () => setFwdNotice(null) }, tr('settings.fwdAutoNoticeCancel')),
|
|
2577
2749
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn dsh-rw-primary', style: { ...primaryBtnS, padding: '4px 14px' }, onClick: confirmFwdNotice }, tr('settings.fwdAutoNoticeConfirm'))))) : null,
|
|
@@ -2584,7 +2756,7 @@ window.__ModuleLoader__.load({
|
|
|
2584
2756
|
msg ? React.createElement('div', { role: 'status', 'aria-live': 'polite', className: 'dsh-rw-settings-message', style: { color: T.muted, fontSize: 12, lineHeight: 1.5 } }, msg) : null,
|
|
2585
2757
|
err ? React.createElement('div', { role: 'alert', className: 'dsh-rw-settings-message', style: { color: T.danger, fontSize: 13, lineHeight: 1.5 } }, err) : null,
|
|
2586
2758
|
React.createElement('div', { id: settingsId + '-hosts', role: 'tabpanel', 'aria-labelledby': settingsId + '-tab-hosts', hidden: settingsTab !== 'hosts', className: 'dsh-rw-settings-panel', style: { display: settingsTab === 'hosts' ? 'flex' : 'none' } },
|
|
2587
|
-
React.createElement('div', { className: 'dsh-rw-settings-card dsh-rw-settings-hosts', hidden:
|
|
2759
|
+
React.createElement('div', { className: 'dsh-rw-settings-card dsh-rw-settings-hosts', hidden: formOpen || !!sshEditor, style: { ...boxS, display: formOpen || sshEditor ? 'none' : undefined } },
|
|
2588
2760
|
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 6, flexWrap: 'wrap' } },
|
|
2589
2761
|
React.createElement('div', { style: { fontSize: 13, fontWeight: 600 } }, tr('settings.pickHost')),
|
|
2590
2762
|
React.createElement('span', { style: { fontSize: 11, opacity: 0.6 } }, tr('settings.hostListSource')),
|
|
@@ -2621,7 +2793,24 @@ window.__ModuleLoader__.load({
|
|
|
2621
2793
|
React.createElement('div', { style: { flex: 1, fontSize: 13, minWidth: 180 } },
|
|
2622
2794
|
React.createElement('div', { className: 'dsh-rw-settings-identity' }, React.createElement('span', { style: { fontWeight: 600 } }, alias), React.createElement('code', { style: { fontSize: 12, opacity: 0.75 } }, target), React.createElement('div', { className: 'dsh-rw-settings-host-flags' }, h.proxyJump ? pill('', tr('settings.badgeProxy')) : null, h.identityFile ? pill('', tr('settings.badgeKey')) : null)),
|
|
2623
2795
|
rowResult(key)),
|
|
2624
|
-
React.createElement('div', { className: 'dsh-rw-settings-host-actions' },
|
|
2796
|
+
React.createElement('div', { className: 'dsh-rw-settings-host-actions' },
|
|
2797
|
+
hostProbe(key),
|
|
2798
|
+
// Same `...` entry as a saved machine, so the row does not
|
|
2799
|
+
// change shape the moment it is adopted. The menu only holds
|
|
2800
|
+
// 编辑 (there is no registry record to delete — the alias
|
|
2801
|
+
// lives in ~/.ssh/config).
|
|
2802
|
+
HostMenu ? React.createElement('button', {
|
|
2803
|
+
type: 'button', className: 'dsh-rw-action',
|
|
2804
|
+
title: tr('settings.adoptAliasHint', { alias }), 'aria-label': tr('settings.adoptAliasHint', { alias }),
|
|
2805
|
+
id: settingsId + '-actions-ssh-' + alias, 'aria-haspopup': 'menu',
|
|
2806
|
+
'aria-expanded': settingsMenu?.key === key,
|
|
2807
|
+
onClick: event => openHostMenu(event, key, discoveredMachine(h), true),
|
|
2808
|
+
}, React.createElement(WorkbenchIcon, { name: 'more' }))
|
|
2809
|
+
: React.createElement('details', { className: 'dsh-rw-settings-menu' },
|
|
2810
|
+
React.createElement('summary', { 'aria-label': tr('settings.adoptAliasHint', { alias }) }, React.createElement(WorkbenchIcon, { name: 'more', size: 16 })),
|
|
2811
|
+
React.createElement('div', { className: 'dsh-rw-settings-menu-items', style: { background: T.bg, borderColor: T.border } },
|
|
2812
|
+
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, onClick: () => startEdit(discoveredMachine(h)) }, tr('settings.edit')))),
|
|
2813
|
+
React.createElement('span', { className: 'dsh-rw-settings-menu-spacer', 'aria-hidden': true })))
|
|
2625
2814
|
})
|
|
2626
2815
|
: (sshError
|
|
2627
2816
|
? React.createElement('div', { style: { fontSize: 11, color: T.danger, lineHeight: 1.6, marginBottom: 6, wordBreak: 'break-all' } },
|
|
@@ -2644,7 +2833,7 @@ window.__ModuleLoader__.load({
|
|
|
2644
2833
|
rowResult('machine:' + m.id)),
|
|
2645
2834
|
React.createElement('div', { className: 'dsh-rw-settings-host-actions' },
|
|
2646
2835
|
hostProbe('machine:' + m.id),
|
|
2647
|
-
HostMenu ? React.createElement('button', { type: 'button', className: 'dsh-rw-action', title: tr('settings.hostActions', { name: m.name || m.host }), 'aria-label': tr('settings.hostActions', { name: m.name || m.host }), id: settingsId + '-actions-' + m.id, 'aria-haspopup': 'menu', 'aria-expanded': settingsMenu?.
|
|
2836
|
+
HostMenu ? React.createElement('button', { type: 'button', className: 'dsh-rw-action', title: tr('settings.hostActions', { name: m.name || m.host }), 'aria-label': tr('settings.hostActions', { name: m.name || m.host }), id: settingsId + '-actions-' + m.id, 'aria-haspopup': 'menu', 'aria-expanded': settingsMenu?.key === 'machine:' + m.id, onClick: event => openHostMenu(event, 'machine:' + m.id, m, false) }, HostEllipsisIcon ? React.createElement(HostEllipsisIcon, { size: 16 }) : React.createElement(WorkbenchIcon, { name: 'more' }))
|
|
2648
2837
|
: React.createElement('details', { className: 'dsh-rw-settings-menu' },
|
|
2649
2838
|
React.createElement('summary', { 'aria-label': tr('settings.hostActions', { name: m.name || m.host }) }, React.createElement(WorkbenchIcon, { name: 'more', size: 16 })),
|
|
2650
2839
|
React.createElement('div', { className: 'dsh-rw-settings-menu-items', style: { background: T.bg, borderColor: T.border } },
|
|
@@ -2653,7 +2842,7 @@ window.__ModuleLoader__.load({
|
|
|
2653
2842
|
!shownMachines.length && !shownDiscovered.length && !hostFilter ? React.createElement('div', { style: { fontSize: 12, color: T.muted } }, tr('settings.noMachines')) : null),
|
|
2654
2843
|
sshEditor ? React.createElement('div', { className: 'dsh-rw-settings-editor', 'data-rw-ssh-editor': true },
|
|
2655
2844
|
React.createElement('div', { className: 'dsh-rw-settings-editor-heading' },
|
|
2656
|
-
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, disabled: sshEditorBusy, onClick: closeSshConfig }, React.createElement(
|
|
2845
|
+
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, disabled: sshEditorBusy, onClick: closeSshConfig }, React.createElement(Chevron, { dir: 'left', size: 14 }), tr('settings.backHosts')),
|
|
2657
2846
|
React.createElement('div', null, React.createElement('strong', null, tr('settings.sshConfigEditorTitle')), React.createElement('div', { style: { fontSize: 11, color: T.muted, overflowWrap: 'anywhere' } }, sshEditor.file))),
|
|
2658
2847
|
React.createElement('div', { className: 'dsh-rw-settings-editor-actions', style: { background: T.bg, borderColor: T.border } },
|
|
2659
2848
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, disabled: sshEditorBusy, onClick: closeSshConfig }, tr('settings.cancelEdit')),
|
|
@@ -2662,10 +2851,10 @@ window.__ModuleLoader__.load({
|
|
|
2662
2851
|
React.createElement('label', { htmlFor: settingsId + '-ssh-text', style: { fontSize: 12, color: T.muted } }, tr('settings.sshConfigEditorHint')),
|
|
2663
2852
|
React.createElement('textarea', { id: settingsId + '-ssh-text', 'aria-label': tr('settings.sshConfigEditorTitle'), spellCheck: false, autoCapitalize: 'off', readOnly: sshEditorBusy, value: sshEditor.text, onChange: event => setSshEditor({ ...sshEditor, text: event.target.value }), onKeyDown: event => { if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 's') { event.preventDefault(); saveSshConfig() } }, style: { ...inputS, width: '100%', boxSizing: 'border-box', minHeight: 320, resize: 'vertical', fontFamily: 'ui-monospace, SFMono-Regular, Consolas, monospace', fontSize: 12, lineHeight: 1.7, whiteSpace: 'pre', tabSize: 2, marginTop: 8 } }),
|
|
2664
2853
|
React.createElement('div', { role: 'status', style: { fontSize: 11, color: T.muted, marginTop: 6 } }, sshEditorDirty ? tr('settings.unsaved') : tr('settings.sshConfigClean'))) : null,
|
|
2665
|
-
|
|
2854
|
+
formOpen ? React.createElement('div', { className: 'dsh-rw-settings-card dsh-rw-settings-editor', style: boxS },
|
|
2666
2855
|
React.createElement('div', { className: 'dsh-rw-settings-editor-heading' },
|
|
2667
|
-
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, onClick: closeEditor, disabled: busy, 'aria-label': tr('settings.backHosts') }, React.createElement(
|
|
2668
|
-
React.createElement('div', { style: { minWidth: 0, flex: 1 } }, React.createElement('strong', {}, form.name || form.host), React.createElement('div', { style: { color: formDirty ? T.warn : T.muted, fontSize: 11 } }, formDirty ? tr('settings.unsaved') : tr('settings.editMachine')))),
|
|
2856
|
+
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, onClick: closeEditor, disabled: busy, 'aria-label': tr('settings.backHosts') }, React.createElement(Chevron, { dir: 'left', size: 14 }), tr('settings.backHosts')),
|
|
2857
|
+
React.createElement('div', { style: { minWidth: 0, flex: 1 } }, React.createElement('strong', {}, form.name || form.host), React.createElement('div', { style: { color: formDirty ? T.warn : T.muted, fontSize: 11 } }, formDirty ? tr('settings.unsaved') : (form.id ? tr('settings.editMachine') : tr('settings.addMachine'))))),
|
|
2669
2858
|
React.createElement('div', { className: 'dsh-rw-settings-editor-actions', style: { background: T.bg, borderColor: T.border } },
|
|
2670
2859
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, onClick: closeEditor, disabled: busy }, tr('settings.cancelEdit')),
|
|
2671
2860
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, onClick: testConn, disabled: busy || !form.host.trim() || tst === 'testing', title: form.host.trim() ? tr('settings.testHint') : tr('settings.testNeedsHost') }, tst === 'testing' ? tr('settings.testing') : tst === 'ok' ? tr('settings.testOk') : tr('settings.testConn')),
|
|
@@ -2673,7 +2862,7 @@ window.__ModuleLoader__.load({
|
|
|
2673
2862
|
React.createElement(React.Fragment, null,
|
|
2674
2863
|
row(tr('settings.name'), React.createElement('input', { className: 'dsh-rw-input', value: form.name, onChange: setF('name'), placeholder: tr('settings.name') + ' (e.g. build-server)', style: inputS }), 'n'),
|
|
2675
2864
|
row(tr('settings.host'), React.createElement('input', { className: 'dsh-rw-input', value: form.host, onChange: setF('host'), placeholder: form.useSshConfig ? tr('settings.sshImport') + ' Host 别名' : 'IP or hostname', style: inputS }), 'h'),
|
|
2676
|
-
row(tr('settings.useSshConfig'), React.createElement(
|
|
2865
|
+
row(tr('settings.useSshConfig'), React.createElement(RwCheckbox, { checked: !!form.useSshConfig, onChange: setB('useSshConfig') }), 'sshc'),
|
|
2677
2866
|
form.useSshConfig ? fieldNote(tr('settings.useSshConfigHint')) : null,
|
|
2678
2867
|
// Issue #50: a literal save also touches ~/.ssh/config (managed
|
|
2679
2868
|
// block) — say so where the choice is made.
|
|
@@ -2718,20 +2907,13 @@ window.__ModuleLoader__.load({
|
|
|
2718
2907
|
tr('settings.noCredentialHint'))
|
|
2719
2908
|
: null,
|
|
2720
2909
|
// 高级配置折叠开关
|
|
2721
|
-
React.createElement('
|
|
2722
|
-
type: 'button',
|
|
2723
|
-
className: 'dsh-rw-btn dsh-rw-settings-advanced', 'aria-expanded': advOpen,
|
|
2724
|
-
onClick: () => setAdvOpen(!advOpen),
|
|
2725
|
-
style: { ...buttonS, width: '100%', marginBottom: advOpen ? 10 : 0, color: advOpen ? T.primary : 'inherit', fontWeight: advOpen ? 600 : 400, borderStyle: 'dashed' },
|
|
2726
|
-
}, React.createElement(WorkbenchIcon, { name: advOpen ? 'down' : 'right', size: 14 }), advOpen ? tr('settings.advCollapse') : tr('settings.advExpand')),
|
|
2910
|
+
React.createElement('div', { style: { marginBottom: advOpen ? 0 : 6 } }, disclosureRow({ open: advOpen, onToggle: () => setAdvOpen(!advOpen), title: advOpen ? tr('settings.advCollapse') : tr('settings.advExpand'), icon: sectionIcon(HostSlidersIcon) })),
|
|
2727
2911
|
advOpen ? React.createElement('div', { key: 'adv', style: { paddingTop: 2 } },
|
|
2728
2912
|
// Issue #51 — transport backend. Placed FIRST in the advanced block
|
|
2729
2913
|
// because it changes what the fields below even mean: with the
|
|
2730
2914
|
// system-OpenSSH backend, host/user/port/key all come from
|
|
2731
2915
|
// ~/.ssh/config and only the machine name (an alias) matters.
|
|
2732
|
-
row(tr('settings.backend'), React.createElement(
|
|
2733
|
-
React.createElement('option', { value: 'native' }, tr('settings.backendNative')),
|
|
2734
|
-
React.createElement('option', { value: 'openssh' }, tr('settings.backendOpenssh'))), 'be'),
|
|
2916
|
+
row(tr('settings.backend'), React.createElement(RwSelect, { value: form.backend || 'native', options: [{ value: 'native', label: tr('settings.backendNative') }, { value: 'openssh', label: tr('settings.backendOpenssh') }], onChange: setV('backend'), label: tr('settings.backend'), style: { maxWidth: 260 } }), 'be'),
|
|
2735
2917
|
(form.backend === 'openssh')
|
|
2736
2918
|
? React.createElement('div', { style: { fontSize: 11, opacity: 0.85, marginBottom: 8, marginLeft: LABEL_W + 12, lineHeight: 1.55 } },
|
|
2737
2919
|
React.createElement('div', null, tr('settings.backendOpensshHint')),
|
|
@@ -2747,18 +2929,11 @@ window.__ModuleLoader__.load({
|
|
|
2747
2929
|
form.passphraseSet
|
|
2748
2930
|
? React.createElement('div', { style: { marginLeft: LABEL_W + 12, marginBottom: 8, fontSize: 11, lineHeight: 1.5, color: T.muted } }, tr('settings.passphraseSavedHint'))
|
|
2749
2931
|
: null,
|
|
2750
|
-
row(tr('settings.hostKeyMode'), React.createElement(
|
|
2751
|
-
React.createElement('option', { value: '' }, tr('settings.hkDefault')),
|
|
2752
|
-
React.createElement('option', { value: 'accept-new' }, tr('settings.hkAccept')),
|
|
2753
|
-
React.createElement('option', { value: 'verify' }, tr('settings.hkVerify')),
|
|
2754
|
-
React.createElement('option', { value: 'off' }, tr('settings.hkOff'))), 'hkm'),
|
|
2932
|
+
row(tr('settings.hostKeyMode'), React.createElement(RwSelect, { value: form.hostKeyMode || '', options: [{ value: '', label: tr('settings.hkDefault') }, { value: 'accept-new', label: tr('settings.hkAccept') }, { value: 'verify', label: tr('settings.hkVerify') }, { value: 'off', label: tr('settings.hkOff') }], onChange: setV('hostKeyMode'), label: tr('settings.hostKeyMode'), style: { maxWidth: 220 } }), 'hkm'),
|
|
2755
2933
|
React.createElement('div', { style: { display: 'flex', gap: 16, paddingLeft: LABEL_W + 12, flexWrap: 'wrap', marginBottom: 8 } },
|
|
2756
|
-
React.createElement(
|
|
2757
|
-
|
|
2758
|
-
React.createElement(
|
|
2759
|
-
React.createElement('input', { type: 'checkbox', checked: form.keyboardInteractive, onChange: setFb('keyboardInteractive') }), tr('settings.keyboardInteractive')),
|
|
2760
|
-
React.createElement('label', { style: { fontSize: 12, display: 'flex', gap: 4, alignItems: 'center' } },
|
|
2761
|
-
React.createElement('input', { type: 'checkbox', checked: form.encryptPassword, onChange: setFb('encryptPassword') }), tr('settings.encryptPassword'))),
|
|
2934
|
+
React.createElement(RwCheckbox, { checked: form.useAgent, onChange: setB('useAgent'), label: tr('settings.agent') }),
|
|
2935
|
+
React.createElement(RwCheckbox, { checked: form.keyboardInteractive, onChange: setB('keyboardInteractive'), label: tr('settings.keyboardInteractive') }),
|
|
2936
|
+
React.createElement(RwCheckbox, { checked: form.encryptPassword, onChange: setB('encryptPassword'), label: tr('settings.encryptPassword') })),
|
|
2762
2937
|
row(tr('settings.proxyHost'), React.createElement('input', { value: form.proxyHost, onChange: setF('proxyHost'), placeholder: 'Route through this host (optional)', style: inputS }), 'ph'),
|
|
2763
2938
|
row(tr('settings.proxyPortUser'), React.createElement('div', { style: { display: 'flex', gap: 6, flex: 1, flexWrap: 'wrap' } },
|
|
2764
2939
|
React.createElement('input', { value: form.proxyPort, onChange: setF('proxyPort'), placeholder: 'Port (22)', style: { ...inputS, minWidth: 90, maxWidth: 120 } }),
|
|
@@ -2780,7 +2955,7 @@ window.__ModuleLoader__.load({
|
|
|
2780
2955
|
) : null),
|
|
2781
2956
|
React.createElement('div', { id: settingsId + '-tools', role: 'tabpanel', 'aria-labelledby': settingsId + '-tab-tools', hidden: settingsTab !== 'tools', className: 'dsh-rw-settings-panel', style: { display: settingsTab === 'tools' ? 'flex' : 'none' } },
|
|
2782
2957
|
React.createElement('div', { style: boxS },
|
|
2783
|
-
sectionToggle(webAttachOpen, setWebAttachOpen, tr('settings.webAttach')),
|
|
2958
|
+
sectionToggle(webAttachOpen, setWebAttachOpen, tr('settings.webAttach'), null, sectionIcon(HostGlobeIcon)),
|
|
2784
2959
|
webAttachOpen ? React.createElement(React.Fragment, null,
|
|
2785
2960
|
React.createElement('div', { style: { opacity: 0.65, fontSize: 11, lineHeight: 1.5, marginBottom: 6 } }, tr('settings.webAttachHint')),
|
|
2786
2961
|
// The URL below carries a one-time login token. It stays on loopback,
|
|
@@ -2822,9 +2997,7 @@ window.__ModuleLoader__.load({
|
|
|
2822
2997
|
disabled: !!webAttachBusy, onClick: () => webAttachAction('close', a.machineId, { stopRemote: true }) }, tr('settings.webAttachCloseStop'))
|
|
2823
2998
|
: null)) : React.createElement('div', { style: { opacity: 0.6, fontSize: 12 } }, tr('settings.webAttachNone')),
|
|
2824
2999
|
React.createElement('div', { style: { display: 'flex', gap: 6, alignItems: 'center', marginTop: 8, flexWrap: 'wrap' } },
|
|
2825
|
-
React.createElement(
|
|
2826
|
-
React.createElement('option', { value: '' }, tr('settings.webAttachMachine') + '…'),
|
|
2827
|
-
machines.map((m) => React.createElement('option', { key: m.id, value: m.id }, `${m.name || m.host} (${m.username}@${m.host})`))),
|
|
3000
|
+
React.createElement(RwSelect, { value: webAttachMachine, options: [{ value: '', label: tr('settings.webAttachMachine') + '…' }, ...machines.map((m) => ({ value: m.id, label: `${m.name || m.host} (${m.username}@${m.host})` }))], onChange: (next) => setWebAttachMachine(next), label: tr('settings.webAttachMachine'), style: { maxWidth: 200 } }),
|
|
2828
3001
|
React.createElement('button', {
|
|
2829
3002
|
type: 'button', className: 'dsh-rw-btn dsh-rw-primary', style: primaryBtnS,
|
|
2830
3003
|
disabled: !!webAttachBusy || !webAttachMachine,
|
|
@@ -2841,17 +3014,30 @@ window.__ModuleLoader__.load({
|
|
|
2841
3014
|
) : null,
|
|
2842
3015
|
),
|
|
2843
3016
|
React.createElement('div', { style: boxS },
|
|
2844
|
-
sectionToggle(fwdOpen, setFwdOpen, tr('settings.forwards')),
|
|
3017
|
+
sectionToggle(fwdOpen, setFwdOpen, tr('settings.forwards'), null, sectionIcon(HostForwardIcon)),
|
|
2845
3018
|
fwdOpen ? React.createElement(React.Fragment, null,
|
|
2846
3019
|
React.createElement('div', { style: { opacity: 0.65, fontSize: 11, lineHeight: 1.5, marginBottom: 8 } }, tr('settings.forwardsHint')),
|
|
2847
3020
|
forwards.length ? forwards.map((f) => {
|
|
2848
3021
|
const busy = !!fwdBusy[f.id]
|
|
2849
|
-
|
|
3022
|
+
const editing = fwdEditId === f.id
|
|
3023
|
+
return React.createElement('div', {
|
|
3024
|
+
key: f.id, className: 'dsh-rw-row', 'data-fwd-editing': editing ? 'true' : undefined,
|
|
3025
|
+
'aria-current': editing ? 'true' : undefined,
|
|
3026
|
+
style: {
|
|
3027
|
+
display: 'flex', gap: 8, rowGap: 4, alignItems: 'center', flexWrap: 'wrap', padding: '6px 8px', margin: '0 -8px', fontSize: 12, fontFamily: 'monospace',
|
|
3028
|
+
// The row the form below is editing must stay identifiable while
|
|
3029
|
+
// the user is typing in fields that hide the original values.
|
|
3030
|
+
borderRadius: 6, transition: 'background .12s ease, box-shadow .12s ease',
|
|
3031
|
+
background: editing ? T.bg2 : undefined,
|
|
3032
|
+
boxShadow: editing ? 'inset 3px 0 0 ' + T.primary : undefined,
|
|
3033
|
+
},
|
|
3034
|
+
},
|
|
2850
3035
|
React.createElement('span', { style: { color: f.active ? T.ok : T.muted } }, f.active ? '●' : '○'),
|
|
2851
3036
|
React.createElement('span', {
|
|
2852
3037
|
title: f.direction === 'reverse' ? tr('settings.fwdDirReverse') : tr('settings.fwdDirLocal'),
|
|
2853
3038
|
style: { flex: '0 0 auto', color: T.muted, opacity: 0.85 },
|
|
2854
3039
|
}, f.direction === 'reverse' ? '-R' : '-L'),
|
|
3040
|
+
editing ? React.createElement('span', { style: { flex: '0 0 auto', fontSize: 10, fontWeight: 600, color: T.onPrimary, background: T.primary, borderRadius: 4, padding: '0 5px', whiteSpace: 'nowrap' } }, tr('settings.fwdEditingBadge')) : null,
|
|
2855
3041
|
React.createElement('span', {
|
|
2856
3042
|
title: tr(f.direction === 'reverse' ? 'settings.fwdReverseHint' : 'settings.fwdLocalHint'),
|
|
2857
3043
|
style: { flex: 1 },
|
|
@@ -2860,24 +3046,18 @@ window.__ModuleLoader__.load({
|
|
|
2860
3046
|
title: tr('settings.fwdLegacyHint'),
|
|
2861
3047
|
style: { fontSize: 10, color: T.warn, border: '1px solid ' + T.border, borderRadius: 4, padding: '0 4px', whiteSpace: 'nowrap' },
|
|
2862
3048
|
}, tr('settings.fwdLegacyBadge')) : null,
|
|
2863
|
-
React.createElement('label', {
|
|
2864
|
-
|
|
2865
|
-
title: tr('settings.fwdAutoHint'),
|
|
2866
|
-
},
|
|
2867
|
-
React.createElement('input', {
|
|
2868
|
-
type: 'checkbox',
|
|
2869
|
-
checked: !!f.autoStart,
|
|
2870
|
-
disabled: busy,
|
|
2871
|
-
'aria-label': tr('settings.fwdAuto'),
|
|
2872
|
-
onChange: (e) => requestFwdAutoStart({ kind: 'row', id: f.id }, !!e.target.checked, f.direction),
|
|
2873
|
-
}),
|
|
2874
|
-
tr('settings.fwdAuto')),
|
|
3049
|
+
React.createElement(RwCheckbox, { checked: !!f.autoStart, disabled: busy, title: tr('settings.fwdAutoHint'), label: tr('settings.fwdAuto'), onChange: (next) => requestFwdAutoStart({ kind: 'row', id: f.id }, next === true, f.direction) }),
|
|
3050
|
+
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', 'data-testid': 'fwd-edit', style: { ...buttonS, padding: '2px 8px' }, disabled: busy, title: tr('settings.fwdEditHint'), onClick: () => beginFwdEdit(f) }, tr('settings.fwdEdit')),
|
|
2875
3051
|
f.active
|
|
2876
3052
|
? React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, padding: '2px 8px' }, disabled: busy, onClick: () => fwdAction('stop', f.id) }, tr('settings.fwdStop'))
|
|
2877
3053
|
: React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, padding: '2px 8px' }, disabled: busy, onClick: () => fwdAction('start', f.id) }, busy ? tr('settings.fwdStarting') : tr('settings.fwdStart')),
|
|
2878
3054
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, padding: '2px 8px' }, disabled: busy, onClick: () => fwdAction('remove', f.id) }, tr('settings.fwdRemove')))
|
|
2879
3055
|
}) : null,
|
|
2880
|
-
React.createElement('div', {
|
|
3056
|
+
React.createElement('div', {
|
|
3057
|
+
// Scroll anchor for 编辑: the form can sit below a long row list.
|
|
3058
|
+
id: settingsId + '-fwd-form',
|
|
3059
|
+
style: { display: 'flex', gap: 6, alignItems: 'center', marginTop: 8, flexWrap: 'wrap' },
|
|
3060
|
+
},
|
|
2881
3061
|
React.createElement('div', {
|
|
2882
3062
|
role: 'group', 'aria-label': tr('settings.forwards'),
|
|
2883
3063
|
style: { display: 'flex', alignItems: 'stretch', flex: '0 0 auto', height: 30, border: '1px solid ' + T.border, borderRadius: T.radius, overflow: 'hidden' },
|
|
@@ -2901,10 +3081,34 @@ window.__ModuleLoader__.load({
|
|
|
2901
3081
|
// the plugin's existing form pattern (.dsh-rw-settings-editor-actions
|
|
2902
3082
|
// right-aligns its primary button), and it keeps 添加转发 from sitting
|
|
2903
3083
|
// alone on a wrapped third line.
|
|
2904
|
-
React.createElement('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, marginTop: 8 } },
|
|
2905
|
-
React.createElement('
|
|
2906
|
-
|
|
2907
|
-
|
|
3084
|
+
React.createElement('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, marginTop: 8, flexWrap: 'wrap' } },
|
|
3085
|
+
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap', minWidth: 0 } },
|
|
3086
|
+
// Which host this tunnel belongs to. Without it the form silently
|
|
3087
|
+
// attached the forward to whatever machine happened to be
|
|
3088
|
+
// connected, so a host that was not connected yet could never be
|
|
3089
|
+
// given one.
|
|
3090
|
+
React.createElement('label', { htmlFor: settingsId + '-fwd-host', style: { fontSize: 12, display: 'flex', gap: 4, alignItems: 'center', whiteSpace: 'nowrap', color: T.muted } }, tr('settings.fwdHost')),
|
|
3091
|
+
React.createElement('select', {
|
|
3092
|
+
id: settingsId + '-fwd-host', className: 'dsh-rw-input', 'data-testid': 'fwd-host',
|
|
3093
|
+
value: fwdForm.machineId,
|
|
3094
|
+
onChange: (e) => setFwdForm({ ...fwdForm, machineId: e.target.value }),
|
|
3095
|
+
disabled: !machines.length,
|
|
3096
|
+
title: tr('settings.fwdHostHint'),
|
|
3097
|
+
'aria-label': tr('settings.fwdHost'),
|
|
3098
|
+
style: { ...inputS, maxWidth: 260, minWidth: 130, padding: '6px 8px' },
|
|
3099
|
+
},
|
|
3100
|
+
!machines.length ? React.createElement('option', { value: '' }, tr('settings.fwdHostEmpty')) : null,
|
|
3101
|
+
machines.map((m) => React.createElement('option', { key: m.id, value: m.id },
|
|
3102
|
+
`${m.name || m.host} (${m.username || 'root'}@${m.host})` + (m.id === currentId ? ' · ' + tr('settings.fwdHostCurrent') : '')))),
|
|
3103
|
+
React.createElement(RwCheckbox, { checked: fwdForm.autoStart, label: tr('settings.fwdAuto'), onChange: (next) => requestFwdAutoStart({ kind: 'form' }, next === true, fwdForm.direction) })),
|
|
3104
|
+
React.createElement('div', { style: { display: 'flex', gap: 6, alignItems: 'center', flexWrap: 'wrap' } },
|
|
3105
|
+
fwdEditId ? React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, onClick: cancelFwdEdit, disabled: !!fwdBusy[fwdEditId] }, tr('settings.fwdCancelEdit')) : null,
|
|
3106
|
+
React.createElement('button', {
|
|
3107
|
+
type: 'button', className: 'dsh-rw-btn dsh-rw-primary', style: primaryBtnS,
|
|
3108
|
+
onClick: () => (fwdEditId ? fwdSaveEdit() : fwdDefine()),
|
|
3109
|
+
disabled: !fwdForm.listenPort || !fwdForm.machineId || !!fwdBusy[fwdEditId],
|
|
3110
|
+
title: !fwdForm.listenPort ? tr('settings.fwdNeedsPort') : !fwdForm.machineId ? tr('settings.fwdHostNeeds') : (fwdEditId ? tr('settings.fwdEditHint') : tr('settings.fwdAddHint')),
|
|
3111
|
+
}, fwdEditId ? tr('settings.fwdSaveChanges') : tr('settings.fwdAdd')))),
|
|
2908
3112
|
React.createElement('div', { style: { opacity: 0.6, fontSize: 11, lineHeight: 1.5, marginTop: 6 } },
|
|
2909
3113
|
tr(fwdForm.direction === 'reverse' ? 'settings.fwdReverseHint' : 'settings.fwdLocalHint')),
|
|
2910
3114
|
) : null,
|
|
@@ -2934,7 +3138,8 @@ window.__ModuleLoader__.load({
|
|
|
2934
3138
|
.then((r) => { if (r && r.file) setAuditFile(String(r.file)); setAuditMsg(tr('settings.auditRevealed', { file: (r && r.file) || auditFile })) })
|
|
2935
3139
|
.catch((err) => setAuditMsg(tr('settings.auditOpenFailed', { msg: String((err && err.message) || err) })))
|
|
2936
3140
|
},
|
|
2937
|
-
}, tr('settings.auditReveal')))
|
|
3141
|
+
}, tr('settings.auditReveal'))),
|
|
3142
|
+
sectionIcon(HostLogIcon)),
|
|
2938
3143
|
auditOpen
|
|
2939
3144
|
? React.createElement(React.Fragment, null,
|
|
2940
3145
|
// The path is always shown: even where the OS cannot open it (headless
|
|
@@ -2954,7 +3159,8 @@ window.__ModuleLoader__.load({
|
|
|
2954
3159
|
React.createElement('button', {
|
|
2955
3160
|
type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, padding: '2px 8px', fontSize: 12, marginLeft: 'auto' },
|
|
2956
3161
|
onClick: (e) => { e.stopPropagation(); loadCleanup() },
|
|
2957
|
-
}, tr('settings.cleanupRefresh'))
|
|
3162
|
+
}, tr('settings.cleanupRefresh')),
|
|
3163
|
+
sectionIcon(HostCleanupIcon)),
|
|
2958
3164
|
cleanupOpen
|
|
2959
3165
|
? (cleanupRows.length
|
|
2960
3166
|
? React.createElement('div', { style: { display: 'flex', flexDirection: 'column', gap: 4 } },
|
|
@@ -3022,9 +3228,8 @@ window.__ModuleLoader__.load({
|
|
|
3022
3228
|
// Host Switch when shipped: its onChange hands back a bare boolean
|
|
3023
3229
|
// and it does not forward unknown props, so the stable test id lives
|
|
3024
3230
|
// on the tight wrapper span. The caption keeps label-like behaviour
|
|
3025
|
-
// (click toggles) so the swap is purely visual.
|
|
3026
|
-
//
|
|
3027
|
-
// element carries each id on either path.
|
|
3231
|
+
// (click toggles) so the swap is purely visual. Every other host gets
|
|
3232
|
+
// the unified checkbox under the same wrapper: one id on either path.
|
|
3028
3233
|
HostSwitch
|
|
3029
3234
|
? React.createElement('span', { style: { display: 'inline-flex', gap: 6, alignItems: 'center', opacity: 0.85 } },
|
|
3030
3235
|
React.createElement('span', { 'data-testid': 'explorer-auto-open', style: { display: 'inline-flex' } },
|
|
@@ -3035,13 +3240,7 @@ window.__ModuleLoader__.load({
|
|
|
3035
3240
|
})),
|
|
3036
3241
|
React.createElement('span', { style: { cursor: 'pointer' }, onClick: () => applyExplorerAutoOpen(!explorerAuto) }, tr('settings.explorerAutoOpen')),
|
|
3037
3242
|
)
|
|
3038
|
-
: React.createElement('
|
|
3039
|
-
React.createElement('input', {
|
|
3040
|
-
type: 'checkbox', checked: explorerAuto, 'data-testid': 'explorer-auto-open',
|
|
3041
|
-
onChange: (e) => applyExplorerAutoOpen(!!(e && e.target && e.target.checked)),
|
|
3042
|
-
}),
|
|
3043
|
-
tr('settings.explorerAutoOpen'),
|
|
3044
|
-
),
|
|
3243
|
+
: React.createElement('span', { 'data-testid': 'explorer-auto-open', style: { display: 'inline-flex', opacity: 0.85 } }, React.createElement(RwCheckbox, { checked: explorerAuto, label: tr('settings.explorerAutoOpen'), onChange: (on) => applyExplorerAutoOpen(on === true) })),
|
|
3045
3244
|
),
|
|
3046
3245
|
upd?.lastReload?.ok === false
|
|
3047
3246
|
? React.createElement('div', { role: 'status', style: { marginTop: 8, fontSize: 12, lineHeight: 1.6, color: T.warn } }, tr('settings.updateReloadFailed', { reason: upd.lastReload.reason || '' }))
|
|
@@ -3063,7 +3262,22 @@ window.__ModuleLoader__.load({
|
|
|
3063
3262
|
React.createElement('a', { href: 'https://github.com/flymysql/dsh-remote/issues/new', target: '_blank', rel: 'noopener noreferrer', style: { color: 'inherit' } }, tr('settings.feedback')),
|
|
3064
3263
|
React.createElement('span', { style: { marginLeft: 'auto', opacity: 0.5 } }, 'dsh-remote v' + CLIENT_VERSION),
|
|
3065
3264
|
),
|
|
3066
|
-
settingsMenu && HostMenu ? React.createElement(HostMenu, {
|
|
3265
|
+
settingsMenu && HostMenu ? React.createElement(HostMenu, {
|
|
3266
|
+
open: true, portal: true,
|
|
3267
|
+
// Anchor the popup to the `...` button itself, right-aligned under it,
|
|
3268
|
+
// and hand focus back to that button when the menu closes.
|
|
3269
|
+
anchor: null, anchorRef: settingsMenu.anchorRef,
|
|
3270
|
+
getAnchorRect: settingsMenu.getAnchorRect,
|
|
3271
|
+
returnFocus: () => settingsMenu.el,
|
|
3272
|
+
align: 'end', side: 'bottom',
|
|
3273
|
+
// A discovered alias has no registry record to delete: 编辑 is the only
|
|
3274
|
+
// action it can offer, exactly like the saved rows' first item.
|
|
3275
|
+
items: settingsMenu.discovered
|
|
3276
|
+
? [ { id: 'edit', label: tr('settings.edit') } ]
|
|
3277
|
+
: [ { id: 'edit', label: tr('settings.edit') }, { id: 'delete', label: tr('settings.delete'), danger: true } ],
|
|
3278
|
+
onClose: () => setSettingsMenu(null),
|
|
3279
|
+
onSelect: id => { const menu = settingsMenu; setSettingsMenu(null); if (id === 'edit') startEdit(menu.machine); else if (id === 'delete') del(menu.machine.id) },
|
|
3280
|
+
}) : null)
|
|
3067
3281
|
}
|
|
3068
3282
|
|
|
3069
3283
|
// ── Unified picker (fill the directory-flow holes) ───────────────────
|
|
@@ -3130,7 +3344,7 @@ window.__ModuleLoader__.load({
|
|
|
3130
3344
|
React.createElement('div', { style: { fontWeight: 600 } }, cancelled ? error : tr('project.failed')),
|
|
3131
3345
|
!cancelled ? React.createElement(React.Fragment, null,
|
|
3132
3346
|
React.createElement('div', {}, tr(key)),
|
|
3133
|
-
React.createElement('
|
|
3347
|
+
React.createElement('div', { style: { marginTop: 4 } }, React.createElement(RwDetails, { title: tr('project.details') }, React.createElement('div', { style: { whiteSpace: 'pre-wrap', fontFamily: 'monospace', paddingTop: 6 } }, error)))) : null)
|
|
3134
3348
|
}
|
|
3135
3349
|
|
|
3136
3350
|
// Shared project-first entry inside both native directory-flow seats.
|
|
@@ -3183,7 +3397,7 @@ window.__ModuleLoader__.load({
|
|
|
3183
3397
|
React.createElement('span', { style: { display: 'flex', flexDirection: 'column', gap: 3, minWidth: 0, flex: 1 } },
|
|
3184
3398
|
React.createElement('span', { style: { fontSize: 13, fontWeight: 600, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, title),
|
|
3185
3399
|
React.createElement('span', { style: { fontSize: 11, color: T.muted, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, subtitle)),
|
|
3186
|
-
React.createElement('span', { 'aria-hidden': true, style: { color: T.muted } }, '
|
|
3400
|
+
React.createElement('span', { 'aria-hidden': true, style: { color: T.muted, display: 'inline-flex', flexShrink: 0 } }, React.createElement(Chevron, { dir: 'right', size: 12 })))
|
|
3187
3401
|
const heading = (text) => React.createElement('div', { style: { padding: '10px 12px 4px', fontSize: 11, fontWeight: 600, color: T.muted } }, text)
|
|
3188
3402
|
return React.createElement('div', { style: { display: 'flex', flexDirection: 'column', minHeight: 0, gap: 8 } },
|
|
3189
3403
|
React.createElement('input', { className: 'dsh-rw-input', 'data-modal-autofocus': true, 'aria-label': tr('project.search'), placeholder: tr('project.search'), value: query, disabled: busy || !!opening,
|
|
@@ -3747,7 +3961,7 @@ window.__ModuleLoader__.load({
|
|
|
3747
3961
|
if (!crumbs.length) return React.createElement('span', null, '/')
|
|
3748
3962
|
const out = []
|
|
3749
3963
|
crumbs.forEach((c, i) => {
|
|
3750
|
-
if (i > 0) out.push(React.createElement('span', { key: 'sep' + i, style: { color: T.muted } }, '
|
|
3964
|
+
if (i > 0) out.push(React.createElement('span', { key: 'sep' + i, style: { color: T.muted, display: 'inline-flex', flexShrink: 0 } }, React.createElement(Chevron, { dir: 'right', size: 12 })))
|
|
3751
3965
|
out.push(React.createElement('span', {
|
|
3752
3966
|
key: c.path || i,
|
|
3753
3967
|
title: c.path,
|
|
@@ -3770,12 +3984,12 @@ window.__ModuleLoader__.load({
|
|
|
3770
3984
|
onMouseDown: localBackdrop.onMouseDown,
|
|
3771
3985
|
onClick: (e) => { if (localBackdrop.onClick(e)) setLocalPop(null) },
|
|
3772
3986
|
},
|
|
3773
|
-
React.createElement('div', { style: { background: v('--dsw-alias-bg-
|
|
3987
|
+
React.createElement('div', { style: { background: v('--dsw-alias-bg-layer-2', '#1e1e1e'), border: '1px solid ' + T.borderStrong, borderRadius: 10, boxShadow: '0 10px 40px rgba(0,0,0,0.5)', width: 'min(560px, 94vw)', minWidth: 320, display: 'flex', flexDirection: 'column', maxHeight: 'min(460px, 84vh)', overflow: 'hidden' }, onClick: (e) => e.stopPropagation() },
|
|
3774
3988
|
React.createElement('div', { style: { display: 'flex', gap: 6, alignItems: 'center', padding: '8px 12px', borderBottom: '1px solid ' + T.border } },
|
|
3775
|
-
React.createElement('button', { style: { ...buttonS, padding: '3px 10px' }, onClick: () => parent && loadLocal(parent), disabled: !parent || loading, title: parent || '' }, tr('picker.back')),
|
|
3989
|
+
React.createElement('button', { style: { ...buttonS, padding: '3px 10px', display: 'inline-flex', alignItems: 'center', gap: 4 }, onClick: () => parent && loadLocal(parent), disabled: !parent || loading, title: parent || '' }, React.createElement(Chevron, { dir: 'up', size: 12 }), tr('picker.back')),
|
|
3776
3990
|
cur.home ? React.createElement('button', { style: { ...buttonS, padding: '3px 8px' }, onClick: () => loadLocal(cur.home), disabled: loading, title: tr('picker.goHome') }, tr('picker.homeBtn')) : null,
|
|
3777
3991
|
React.createElement('div', { style: { fontSize: 11, opacity: 0.75, fontFamily: 'monospace', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', flex: 1 } }, localCrumbs(cur)),
|
|
3778
|
-
React.createElement(
|
|
3992
|
+
React.createElement(CloseButton, { label: tr('picker.closeBtn'), onClick: () => setLocalPop(null) }),
|
|
3779
3993
|
),
|
|
3780
3994
|
// 盘符切换行(Windows 无统一根目录,browse 面包屑到不了其他盘)。
|
|
3781
3995
|
(cur.drives && cur.drives.length > 1) ? React.createElement('div', { style: { display: 'flex', gap: 4, flexWrap: 'wrap', padding: '6px 12px', borderBottom: '1px solid ' + T.border } },
|
|
@@ -3822,12 +4036,12 @@ window.__ModuleLoader__.load({
|
|
|
3822
4036
|
}
|
|
3823
4037
|
const last = levels[levels.length - 1]
|
|
3824
4038
|
const entries = last.all || []
|
|
3825
|
-
return React.createElement('div', { 'data-rw-directory-browser': true, style: { border: '1px solid ' + T.borderStrong, borderRadius: 8, background: v('--dsw-alias-bg-
|
|
4039
|
+
return React.createElement('div', { 'data-rw-directory-browser': true, style: { border: '1px solid ' + T.borderStrong, borderRadius: 8, background: v('--dsw-alias-bg-layer-2', '#1e1e1e'), display: 'flex', flexDirection: 'column', flex: '1 1 0', minHeight: 0, overflow: 'hidden' } },
|
|
3826
4040
|
React.createElement('div', { style: { display: 'flex', gap: 6, alignItems: 'center', flexShrink: 0, padding: '6px 10px', borderBottom: '1px solid ' + T.border } },
|
|
3827
|
-
React.createElement('button', { style: { ...buttonS, padding: '2px 8px' }, onClick: goUp, disabled: loading || (levels.length <= 1 && !parentOf(last.path)) }, tr('picker.back')),
|
|
4041
|
+
React.createElement('button', { style: { ...buttonS, padding: '2px 8px', display: 'inline-flex', alignItems: 'center', gap: 4 }, onClick: goUp, disabled: loading || (levels.length <= 1 && !parentOf(last.path)) }, React.createElement(Chevron, { dir: 'up', size: 12 }), tr('picker.back')),
|
|
3828
4042
|
React.createElement('div', { style: { fontSize: 11, opacity: 0.75, fontFamily: 'monospace', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', flex: 1 } }, breadcrumb(!!machineId, last.path, win, (p) => { if (loading) return; const cut = (levels || []).findIndex((lv) => lv.path === p); if (cut >= 0) setLevels(levels.slice(0, cut + 1)); else loadLevels(machineId, p, 0) })),
|
|
3829
4043
|
React.createElement('button', { style: { ...buttonS, padding: '2px 8px' }, onClick: mkdirHere }, tr('picker.newDir')),
|
|
3830
|
-
React.createElement(
|
|
4044
|
+
React.createElement(CloseButton, { label: tr('picker.closeBtn'), onClick: () => setPopOpen(false) }),
|
|
3831
4045
|
),
|
|
3832
4046
|
React.createElement('div', { 'data-rw-directory-list': true, role: 'region', 'aria-label': tr('picker.browse'), style: { flex: 1, minHeight: 0, overflowY: 'auto', overflowX: 'hidden' } },
|
|
3833
4047
|
loading ? React.createElement('div', { style: { opacity: 0.7, padding: 12 } }, tr('picker.loading'))
|
|
@@ -3937,7 +4151,7 @@ window.__ModuleLoader__.load({
|
|
|
3937
4151
|
React.createElement('div', { ref: pickerLayerRef, tabIndex: -1, role: 'dialog', 'aria-modal': true, 'aria-labelledby': suggestListId + '-title', 'data-rw-dir-picker': true, className: 'dsh-rw-modal-panel', style: { background: v('--dsw-alias-bg-layer-1', '#18181b'), color: T.label, border: '1px solid ' + T.borderStrong, borderRadius: 12, boxShadow: '0 12px 48px rgba(0,0,0,0.5)', width: 'min(720px, 94vw)', height: popOpen && tab === 'remote' ? 'min(760px, calc(100dvh - 32px))' : undefined, maxHeight: 'min(760px, calc(100dvh - 32px))', display: 'flex', flexDirection: 'column', padding: 16, boxSizing: 'border-box' }, onClick: (e) => e.stopPropagation() },
|
|
3938
4152
|
React.createElement('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 10 } },
|
|
3939
4153
|
React.createElement('div', { id: suggestListId + '-title', style: { fontSize: 15, fontWeight: 650 } }, tr('picker.title')),
|
|
3940
|
-
React.createElement(
|
|
4154
|
+
React.createElement(CloseButton, { label: tr('picker.close'), onClick: closePicker, disabled: !!externalBusy }),
|
|
3941
4155
|
),
|
|
3942
4156
|
// 本机/远程 switch: host SegmentedTabs when the bundle ships one
|
|
3943
4157
|
// (sliding-indicator tablist, roving tabindex and arrow-key navigation
|
|
@@ -3980,7 +4194,7 @@ window.__ModuleLoader__.load({
|
|
|
3980
4194
|
onProject: (m, p) => { setMachineId(m.id); setRecent(m.recentWorkspaces || []); setPath(p); setChoosingProject(false); commitPath(p, m.id) },
|
|
3981
4195
|
})
|
|
3982
4196
|
: React.createElement('div', { 'data-rw-picker-remote': true, style: { display: 'flex', flexDirection: 'column', flex: popOpen ? '1 1 0' : '0 1 auto', gap: 8, minHeight: 0, overflowY: popOpen ? 'hidden' : 'auto' } },
|
|
3983
|
-
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', disabled: busy, style: { ...buttonS, alignSelf: 'flex-start', fontSize: 12 }, onClick: () => { killSuggestions(); resetPickerFetchState(); setPath(''); setChoosingProject(true) } },
|
|
4197
|
+
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', disabled: busy, style: { ...buttonS, alignSelf: 'flex-start', fontSize: 12, display: 'inline-flex', alignItems: 'center', gap: 4 }, onClick: () => { killSuggestions(); resetPickerFetchState(); setPath(''); setChoosingProject(true) } }, React.createElement(Chevron, { dir: 'left', size: 12 }), tr('project.back')),
|
|
3984
4198
|
React.createElement('div', { style: { display: 'flex', gap: 6, alignItems: 'center' } },
|
|
3985
4199
|
React.createElement('label', { style: { fontSize: 12, opacity: 0.8, whiteSpace: 'nowrap' } }, tr('picker.remoteMachine')),
|
|
3986
4200
|
React.createElement('div', { ref: ddRef, style: { position: 'relative', display: 'inline-block' } },
|
|
@@ -3988,7 +4202,7 @@ window.__ModuleLoader__.load({
|
|
|
3988
4202
|
(machines.find((m) => m.id === machineId) || {}).name || (machineId ? '…' : tr('picker.chooseMachine')),
|
|
3989
4203
|
),
|
|
3990
4204
|
mOpen
|
|
3991
|
-
? React.createElement('div', { style: { position: 'absolute', top: '100%', left: 0, zIndex: 1000, marginTop: 2, minWidth: 300, maxHeight: 260, overflow: 'auto', background: v('--dsw-alias-bg-
|
|
4205
|
+
? React.createElement('div', { style: { position: 'absolute', top: '100%', left: 0, zIndex: 1000, marginTop: 2, minWidth: 300, maxHeight: 260, overflow: 'auto', background: v('--dsw-alias-bg-layer-2', '#1f1f23'), color: T.label, border: '1px solid ' + T.border, borderRadius: T.radius, padding: 4 } },
|
|
3992
4206
|
machines.length
|
|
3993
4207
|
? machines.map((m) => React.createElement('div', { key: m.id, className: 'dsh-rw-list-item', onClick: () => { setMachineId(m.id); setRecent(m.recentWorkspaces || []); setLevels(null); setPath(''); setMOpen(false); resetPickerFetchState(); killSuggestions(); setLoading(false); setErr(''); if (m.id) loadLevels(m.id, '', 0) }, style: { padding: '6px 8px', borderRadius: 4, cursor: 'pointer', color: m.id === machineId ? T.ok : 'inherit' } }, m.name + ' (' + m.username + '@' + m.host + ':' + m.port + ')'))
|
|
3994
4208
|
: React.createElement('div', { style: { padding: 6, opacity: 0.6 } }, tr('picker.noMachines')),
|
|
@@ -4041,7 +4255,7 @@ window.__ModuleLoader__.load({
|
|
|
4041
4255
|
// never move the dialog or sit beneath the workspace action.
|
|
4042
4256
|
!popOpen ? React.createElement('div', { className: 'dsh-rw-suggestions', style: { position: 'relative', height: 'min(180px, 25vh)', marginTop: 8, border: '1px solid ' + T.border, borderRadius: 8, background: T.bg } },
|
|
4043
4257
|
(suggestOpen && suggest.length)
|
|
4044
|
-
? React.createElement('div', { id: suggestListId, role: 'listbox', 'aria-label': tr('picker.pathPlaceholder'), style: { position: 'absolute', top: 0, bottom: 0, left: 0, right: 0, zIndex: 60,
|
|
4258
|
+
? React.createElement('div', { id: suggestListId, role: 'listbox', 'aria-label': tr('picker.pathPlaceholder'), style: { position: 'absolute', top: 0, bottom: 0, left: 0, right: 0, zIndex: 60, color: T.label, borderRadius: 8, maxHeight: 200, overflowY: 'auto' } },
|
|
4045
4259
|
// Issue #52 defect 1, local belt-and-braces: swallow the
|
|
4046
4260
|
// gesture so no ancestor (least of all the backdrop) can
|
|
4047
4261
|
// observe a click that began on a suggestion.
|
|
@@ -4732,7 +4946,7 @@ window.__ModuleLoader__.load({
|
|
|
4732
4946
|
}
|
|
4733
4947
|
return { open, pending, error }
|
|
4734
4948
|
}
|
|
4735
|
-
function WorkbenchIcon({ name, size = 16 }) {
|
|
4949
|
+
function WorkbenchIcon({ name, size = 16, className }) {
|
|
4736
4950
|
const paths = {
|
|
4737
4951
|
remote: 'M2 3h12v8H2zM6 14h4M8 11v3m-3-7 2 2-2 2m4 0h2',
|
|
4738
4952
|
terminal: 'm3 4 4 4-4 4m6 0h4',
|
|
@@ -4746,16 +4960,63 @@ window.__ModuleLoader__.load({
|
|
|
4746
4960
|
folder: 'M2 4h5l2 2h5v7H2z',
|
|
4747
4961
|
file: 'M4 2h5l3 3v9H4zM9 2v4h3',
|
|
4748
4962
|
down: 'm5 6 3 3 3-3',
|
|
4963
|
+
up: 'm5 10 3-3 3 3',
|
|
4749
4964
|
right: 'm6 4 4 4-4 4',
|
|
4750
4965
|
left: 'm10 4-4 4 4 4',
|
|
4751
4966
|
more: 'M3 8h.01M8 8h.01M13 8h.01',
|
|
4752
4967
|
}
|
|
4753
|
-
return React.createElement('svg', { width: size, height: size, viewBox: '0 0 16 16', fill: 'none', stroke: 'currentColor', strokeWidth: 1.25, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true, style: { flexShrink: 0 } }, React.createElement('path', { d: paths[name] || paths.file }))
|
|
4968
|
+
return React.createElement('svg', { width: size, height: size, viewBox: '0 0 16 16', fill: 'none', stroke: 'currentColor', strokeWidth: 1.25, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true, className, style: { flexShrink: 0 } }, React.createElement('path', { d: paths[name] || paths.file }))
|
|
4754
4969
|
}
|
|
4755
4970
|
function WorkbenchAction({ icon, label, onClick, disabled, pressed }) {
|
|
4756
4971
|
return React.createElement('button', { type: 'button', className: 'dsh-rw-action', title: label, 'aria-label': label, 'aria-pressed': pressed, disabled, onClick }, React.createElement(WorkbenchIcon, { name: icon }))
|
|
4757
4972
|
}
|
|
4758
4973
|
|
|
4974
|
+
function CloseButton({ label, onClick, disabled, title, size = 14 }) {
|
|
4975
|
+
return React.createElement('button', { type: 'button', className: 'dsh-rw-action', 'aria-label': label, title: title === undefined ? label : title, disabled, onClick },
|
|
4976
|
+
HostCloseIcon ? React.createElement(HostCloseIcon, { size }) : React.createElement(WorkbenchIcon, { name: 'close', size: size + 2 }))
|
|
4977
|
+
}
|
|
4978
|
+
function Chevron({ dir = 'right', size = 14, className }) {
|
|
4979
|
+
const host = dir === 'down' ? HostChevronDownIcon : dir === 'up' ? HostChevronUpIcon : dir === 'left' ? HostChevronLeftIcon : HostChevronRightIcon
|
|
4980
|
+
return host ? React.createElement(host, { size, className }) : React.createElement(WorkbenchIcon, { name: dir, size: size + 2, className })
|
|
4981
|
+
}
|
|
4982
|
+
function RwCheckbox({ checked, onChange, label, disabled, title, className }) {
|
|
4983
|
+
if (HostCheckbox) return React.createElement(HostCheckbox, { checked: !!checked, onChange, label, disabled, title, className })
|
|
4984
|
+
return React.createElement('label', { className: 'dsh-rw-check' + (className ? ' ' + className : ''), title }, React.createElement('input', { type: 'checkbox', checked: !!checked, disabled, onChange: (event) => onChange(event.target.checked) }), label)
|
|
4985
|
+
}
|
|
4986
|
+
function disclosureRow({ open, onToggle, title, icon, accessory, className, titleClassName }) {
|
|
4987
|
+
return React.createElement('div', { className: 'dsh-rw-disclosure-head' + (className ? ' ' + className : ''), 'data-open': open || undefined },
|
|
4988
|
+
React.createElement('button', { type: 'button', className: 'dsh-rw-disclosure-row' + (titleClassName ? ' ' + titleClassName : ''), 'aria-expanded': open, onClick: onToggle },
|
|
4989
|
+
React.createElement(Chevron, { dir: open ? 'down' : 'right', size: 14, className: 'dsh-rw-disclosure-chevron' }),
|
|
4990
|
+
icon ? React.createElement('span', { className: 'dsh-rw-disclosure-icon' }, icon) : null,
|
|
4991
|
+
React.createElement('span', { className: 'dsh-rw-disclosure-label' }, title)),
|
|
4992
|
+
accessory || null)
|
|
4993
|
+
}
|
|
4994
|
+
function RwDisclosure({ open, onToggle, title, icon, accessory, children, className, titleClassName }) {
|
|
4995
|
+
return React.createElement('div', { className: 'dsh-rw-disclosure' + (className ? ' ' + className : '') },
|
|
4996
|
+
disclosureRow({ open, onToggle, title, icon, accessory, titleClassName }), open && children ? children : null)
|
|
4997
|
+
}
|
|
4998
|
+
function RwDetails({ title, accessory, children, className, defaultOpen = false, icon, titleClassName }) {
|
|
4999
|
+
const [open, setOpen] = React.useState(defaultOpen)
|
|
5000
|
+
return React.createElement(RwDisclosure, { open, onToggle: () => setOpen(!open), title, icon, accessory, className, titleClassName }, children)
|
|
5001
|
+
}
|
|
5002
|
+
function RwSelect({ id, label, value, options, onChange, disabled, size = 'md', style, align = 'end', title, className }) {
|
|
5003
|
+
const [open, setOpen] = React.useState(false)
|
|
5004
|
+
const compact = size === 'sm'
|
|
5005
|
+
const current = options.find(option => option.value === value)
|
|
5006
|
+
const text = current ? current.label : (value || '')
|
|
5007
|
+
const triggerStyle = { ...(compact ? { height: 26, padding: '0 8px', gap: 4, fontSize: 11 } : { height: 32, padding: '0 12px', gap: 6, fontSize: 13 }), ...style }
|
|
5008
|
+
const cls = 'dsh-rw-select' + (className ? ' ' + className : '')
|
|
5009
|
+
if (!HostMenu) return React.createElement('select', { id, value, disabled, title: title === undefined ? label : title, 'aria-label': label, className: cls, onChange: (event) => onChange(event.target.value), style: triggerStyle },
|
|
5010
|
+
options.map(option => React.createElement('option', { key: option.value, value: option.value }, option.label)))
|
|
5011
|
+
return React.createElement(HostMenu, {
|
|
5012
|
+
open, onClose: () => setOpen(false), portal: true, align, selectedId: value,
|
|
5013
|
+
className: 'dsh-rw-select-anchor', items: options.map(option => ({ id: option.value, label: option.label })),
|
|
5014
|
+
onSelect: (next) => { setOpen(false); if (next !== value) onChange(next) },
|
|
5015
|
+
anchor: React.createElement('button', { id, type: 'button', className: cls, disabled, title: title === undefined ? text : title, 'aria-label': label, 'aria-haspopup': 'menu', 'aria-expanded': open, onClick: (event) => { event.preventDefault(); event.stopPropagation(); setOpen(v => !v) }, style: triggerStyle },
|
|
5016
|
+
React.createElement('span', { className: 'dsh-rw-select-value' }, text),
|
|
5017
|
+
React.createElement(Chevron, { dir: 'down', size: compact ? 12 : 14, className: 'dsh-rw-select-chevron' })),
|
|
5018
|
+
})
|
|
5019
|
+
}
|
|
4759
5020
|
// Tree-style remote file explorer. Data is listed live from the remote host
|
|
4760
5021
|
// over /dsh-remote/ls, rooted at this session's remote workspace dir.
|
|
4761
5022
|
function RemoteWorkspaceSearch(props) {
|
|
@@ -4807,16 +5068,12 @@ window.__ModuleLoader__.load({
|
|
|
4807
5068
|
}
|
|
4808
5069
|
return React.createElement('section', { className: 'dsh-rw-search-panel', 'aria-label': tr('workspaceSearch.results'), 'aria-busy': running },
|
|
4809
5070
|
React.createElement('div', { className: 'dsh-rw-search-progress' },
|
|
4810
|
-
React.createElement('
|
|
4811
|
-
React.createElement('
|
|
4812
|
-
React.createElement('
|
|
4813
|
-
React.createElement('
|
|
4814
|
-
React.createElement('
|
|
4815
|
-
|
|
4816
|
-
React.createElement('div', { className: 'dsh-rw-search-detail-body' },
|
|
4817
|
-
React.createElement('div', {}, tr('workspaceSearch.progress', { dirs: current.scannedDirs || 0, files: current.scannedFiles || 0, results: current.results.length, seconds: ((current.elapsedMs || 0) / 1000).toFixed(1) })),
|
|
4818
|
-
current.skipped || current.errors ? React.createElement('div', {}, tr('workspaceSearch.skipped', { skipped: current.skipped || 0, errors: current.errors || 0 })) : null,
|
|
4819
|
-
current.currentPath ? React.createElement('div', { className: 'dsh-rw-path', title: current.currentPath }, current.currentPath) : null)),
|
|
5071
|
+
React.createElement('div', { role: 'status', 'aria-live': 'polite', style: { flex: 1, minWidth: 0 } },
|
|
5072
|
+
React.createElement(RwDetails, { className: 'dsh-rw-search-details', title: [tr(statusKey), tr('workspaceSearch.matches', { n: current.results.length }), running ? tr('workspaceSearch.scanned', { n: (current.scannedDirs || 0) + (current.scannedFiles || 0) }) : null].filter(Boolean).join(' · ') },
|
|
5073
|
+
React.createElement('div', { className: 'dsh-rw-search-detail-body' },
|
|
5074
|
+
React.createElement('div', {}, tr('workspaceSearch.progress', { dirs: current.scannedDirs || 0, files: current.scannedFiles || 0, results: current.results.length, seconds: ((current.elapsedMs || 0) / 1000).toFixed(1) })),
|
|
5075
|
+
current.skipped || current.errors ? React.createElement('div', {}, tr('workspaceSearch.skipped', { skipped: current.skipped || 0, errors: current.errors || 0 })) : null,
|
|
5076
|
+
current.currentPath ? React.createElement('div', { className: 'dsh-rw-path', title: current.currentPath }, current.currentPath) : null))),
|
|
4820
5077
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, fontSize: 11, padding: '3px 7px' }, onClick: () => running ? stopRef.current?.() : setRetry(value => value + 1) }, tr(running ? 'workspaceSearch.stop' : 'workspaceSearch.retry'))),
|
|
4821
5078
|
current.error ? React.createElement('div', { role: 'alert', style: { padding: '8px 10px', fontSize: 12, color: T.danger, overflowWrap: 'anywhere' } }, current.error) : null,
|
|
4822
5079
|
current.status === 'partial' ? React.createElement('div', { style: { padding: '6px 10px', fontSize: 11, color: T.warn } }, tr('workspaceSearch.partialHint')) : null,
|
|
@@ -4857,6 +5114,7 @@ window.__ModuleLoader__.load({
|
|
|
4857
5114
|
const [searchMode, setSearchMode] = React.useState('names')
|
|
4858
5115
|
const [searchIgnored, setSearchIgnored] = React.useState(false)
|
|
4859
5116
|
const [searchCase, setSearchCase] = React.useState(false)
|
|
5117
|
+
const [searchOptionsOpen, setSearchOptionsOpen] = React.useState(false)
|
|
4860
5118
|
const [searchRetry, setSearchRetry] = React.useState(0)
|
|
4861
5119
|
const revealPending = React.useRef(null)
|
|
4862
5120
|
const filterRef = React.useRef(null)
|
|
@@ -5035,7 +5293,7 @@ window.__ModuleLoader__.load({
|
|
|
5035
5293
|
const host = document.createElement('div')
|
|
5036
5294
|
host.style.cssText = 'position:fixed;z-index:999999;pointer-events:auto'
|
|
5037
5295
|
const box = document.createElement('div')
|
|
5038
|
-
box.style.cssText = 'position:fixed;left:' + menu.x + 'px;top:' + menu.y + 'px;z-index:999999;background:var(--dsw-alias-bg-
|
|
5296
|
+
box.style.cssText = 'position:fixed;left:' + menu.x + 'px;top:' + menu.y + 'px;z-index:999999;background:var(--dsw-alias-bg-layer-2,#1f1f23);border:1px solid var(--dsw-alias-border-l3,rgba(128,128,128,0.5));border-radius:8px;padding:4px;box-shadow:0 8px 24px rgba(0,0,0,0.4);min-width:170px;font-family:system-ui,sans-serif;color:var(--dsw-alias-label-primary,#e4e4e7)'
|
|
5039
5297
|
const mkItem = (label, danger, fn) => {
|
|
5040
5298
|
const d = document.createElement('div')
|
|
5041
5299
|
d.textContent = label
|
|
@@ -5212,7 +5470,7 @@ window.__ModuleLoader__.load({
|
|
|
5212
5470
|
style: base,
|
|
5213
5471
|
title: entry.path,
|
|
5214
5472
|
},
|
|
5215
|
-
React.createElement('span', { className: 'dsh-rw-tree-chevron' }, React.createElement(
|
|
5473
|
+
React.createElement('span', { className: 'dsh-rw-tree-chevron' }, React.createElement(Chevron, { dir: isOpen ? 'down' : 'right', size: 12 })),
|
|
5216
5474
|
React.createElement('span', { style: { flexShrink: 0, color: T.label, display: 'inline-flex' } }, IconFolder(isOpen)),
|
|
5217
5475
|
React.createElement('span', { style: { overflow: 'hidden', textOverflow: 'ellipsis', flex: 1, fontWeight: 500 } }, entry.name),
|
|
5218
5476
|
copiedMark(entry.path),
|
|
@@ -5296,13 +5554,16 @@ window.__ModuleLoader__.load({
|
|
|
5296
5554
|
filterOpen ? React.createElement('div', { className: 'dsh-rw-search-controls' },
|
|
5297
5555
|
React.createElement('input', { ref: filterRef, type: 'search', className: 'dsh-rw-input', 'aria-label': tr('workspaceSearch.query'), placeholder: tr('workspaceSearch.placeholder'), value: filter, onChange: e => setFilter(e.target.value), onKeyDown: e => { if (e.isComposing) return; if (e.key === 'Escape') { e.stopPropagation(); setFilter(''); setFilterOpen(false) } else if (e.key === 'Enter') { e.preventDefault(); setSearchRetry(value => value + 1) } }, style: { ...inputS, boxSizing: 'border-box', width: '100%', fontSize: 12 } }),
|
|
5298
5556
|
React.createElement('div', { className: 'dsh-rw-search-scope' },
|
|
5299
|
-
React.createElement(
|
|
5300
|
-
React.createElement('
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
React.createElement('
|
|
5305
|
-
React.createElement('
|
|
5557
|
+
React.createElement(RwSelect, { value: searchMode, options: ['names', 'files', 'directories', 'content'].map(value => ({ value, label: tr(({ names: 'workspaceSearch.names', files: 'workspaceSearch.files', directories: 'workspaceSearch.directories', content: 'workspaceSearch.content' })[value]) })), onChange: (next) => setSearchMode(next), label: tr('workspaceSearch.mode'), size: 'sm', style: { flex: 1, minWidth: 0 } }),
|
|
5558
|
+
HostMenu ? React.createElement(HostMenu, { open: searchOptionsOpen, onClose: () => setSearchOptionsOpen(false), portal: true, align: 'end', selectedIds: [searchCase ? 'case' : null, searchIgnored ? 'ignored' : null].filter(Boolean),
|
|
5559
|
+
items: [{ id: 'case', label: tr('workspaceSearch.caseSensitive') }, { id: 'ignored', label: React.createElement('span', { title: tr('workspaceSearch.ignoreHint') }, tr('workspaceSearch.includeIgnored')) }],
|
|
5560
|
+
onSelect: (id) => { if (id === 'case') setSearchCase(value => !value); else setSearchIgnored(value => !value) },
|
|
5561
|
+
anchor: React.createElement('button', { type: 'button', className: 'dsh-rw-select', 'aria-haspopup': 'menu', 'aria-expanded': searchOptionsOpen, 'aria-label': tr('workspaceSearch.options'), onClick: () => setSearchOptionsOpen(value => !value), style: { height: 26, padding: '0 8px', gap: 4, fontSize: 11, flex: 'none' } },
|
|
5562
|
+
React.createElement('span', { className: 'dsh-rw-select-value' }, searchCase || searchIgnored ? tr('workspaceSearch.activeOptions', { n: Number(searchCase) + Number(searchIgnored) }) : tr('workspaceSearch.options')),
|
|
5563
|
+
React.createElement(Chevron, { dir: 'down', size: 12, className: 'dsh-rw-select-chevron' })) })
|
|
5564
|
+
: React.createElement('div', { style: { display: 'flex', gap: 10, alignItems: 'center', flexShrink: 0 } },
|
|
5565
|
+
React.createElement(RwCheckbox, { checked: searchCase, onChange: setSearchCase, label: tr('workspaceSearch.caseSensitive') }),
|
|
5566
|
+
React.createElement(RwCheckbox, { checked: searchIgnored, onChange: setSearchIgnored, title: tr('workspaceSearch.ignoreHint'), label: tr('workspaceSearch.includeIgnored') })))) : null,
|
|
5306
5567
|
),
|
|
5307
5568
|
connectionState === 'interrupted' && root ? React.createElement('div', { role: 'status', style: { padding: '6px 10px', display: 'flex', gap: 6, fontSize: 11, color: T.warn, background: T.bg } },
|
|
5308
5569
|
React.createElement('span', { style: { flex: 1 } }, tr('explorer.connection.interrupted')),
|
|
@@ -5324,7 +5585,7 @@ window.__ModuleLoader__.load({
|
|
|
5324
5585
|
style: { display: 'flex', alignItems: 'center', gap: 6, padding: '5px 8px', paddingLeft: 6, borderRadius: 5, cursor: 'pointer', fontSize: 13, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: T.label, fontWeight: 600 },
|
|
5325
5586
|
title: root,
|
|
5326
5587
|
},
|
|
5327
|
-
React.createElement('span', { className: 'dsh-rw-tree-chevron' }, React.createElement(
|
|
5588
|
+
React.createElement('span', { className: 'dsh-rw-tree-chevron' }, React.createElement(Chevron, { dir: rootOpen ? 'down' : 'right', size: 12 })),
|
|
5328
5589
|
React.createElement('span', { style: { flexShrink: 0, color: T.label, display: 'inline-flex' } }, IconFolder(rootOpen)),
|
|
5329
5590
|
React.createElement('span', { style: { overflow: 'hidden', textOverflow: 'ellipsis', flex: 1 } }, rootName || root),
|
|
5330
5591
|
),
|
|
@@ -5339,7 +5600,13 @@ window.__ModuleLoader__.load({
|
|
|
5339
5600
|
menu && HostMenu ? React.createElement(HostMenu, {
|
|
5340
5601
|
open: true,
|
|
5341
5602
|
portal: true,
|
|
5603
|
+
// Pointer menu: a current host takes client coordinates (`anchorPoint`),
|
|
5604
|
+
// an older one the equivalent zero-size rect. `contextual` adds the
|
|
5605
|
+
// standard cursor clearance.
|
|
5606
|
+
anchor: null,
|
|
5607
|
+
anchorPoint: { x: menu.x, y: menu.y },
|
|
5342
5608
|
getAnchorRect: () => ({ left: menu.x, top: menu.y, right: menu.x, bottom: menu.y, width: 0, height: 0 }),
|
|
5609
|
+
contextual: true,
|
|
5343
5610
|
items: [
|
|
5344
5611
|
{ id: 'open', label: menu.isDir ? tr('explorer.menuExpand') : tr('explorer.menuOpen') },
|
|
5345
5612
|
...(!localWorkspaceSession(sessionId) ? [{ id: 'download', label: tr('explorer.menuDownload') }] : []),
|
|
@@ -6268,9 +6535,11 @@ window.__ModuleLoader__.load({
|
|
|
6268
6535
|
} catch { return '' }
|
|
6269
6536
|
}
|
|
6270
6537
|
// The shipped workspace-files command opens kind "files". Route that
|
|
6271
|
-
// intent before navigation, using the captured session's binding.
|
|
6272
|
-
//
|
|
6273
|
-
//
|
|
6538
|
+
// intent before navigation, using the captured session's binding. Only
|
|
6539
|
+
// sessions bound to a mirror can use this explorer: a plain local project
|
|
6540
|
+
// keeps the host's own explorer, which offers reveal/open-with, upload,
|
|
6541
|
+
// create and archive actions this one does not implement. Unknown roots
|
|
6542
|
+
// and other kinds retain the host's original routing.
|
|
6274
6543
|
function routeWorkspaceFiles(sidebar) {
|
|
6275
6544
|
const originals = new Map(), pending = new Map()
|
|
6276
6545
|
let disposed = false
|
|
@@ -6290,7 +6559,7 @@ window.__ModuleLoader__.load({
|
|
|
6290
6559
|
if (sessionIndex == null && sidebar.mounted?.getSnapshot?.() !== sessionId) return
|
|
6291
6560
|
const remote = mirrorForCwd(sessionCwdFor(sessionId), MIRRORS.list)
|
|
6292
6561
|
const next = args.slice()
|
|
6293
|
-
next[kindIndex] = remote
|
|
6562
|
+
next[kindIndex] = remote ? NATIVE_EXPLORER : kind
|
|
6294
6563
|
return Reflect.apply(original, owner, next)
|
|
6295
6564
|
}
|
|
6296
6565
|
if (MIRRORS.loaded) return open()
|
|
@@ -6703,8 +6972,7 @@ window.__ModuleLoader__.load({
|
|
|
6703
6972
|
React.createElement('span', { style: { color: T.ok } }, '+' + (change.additions || 0)), ' ', React.createElement('span', { style: { color: T.danger } }, '−' + (change.deletions || 0))) : null),
|
|
6704
6973
|
change.diffs.length ? NativeDiffBlock
|
|
6705
6974
|
? React.createElement(NativeDiffBlock, { diffs: change.diffs, labels, maxLines: 12 })
|
|
6706
|
-
: React.createElement('div', {}, change.diffs.map((diff, index) => React.createElement(
|
|
6707
|
-
React.createElement('summary', {}, tr('change.hunk', { n: index + 1 })),
|
|
6975
|
+
: React.createElement('div', {}, change.diffs.map((diff, index) => React.createElement(RwDetails, { key: index, defaultOpen: index === 0, className: 'dsh-rw-change-hunk', title: tr('change.hunk', { n: index + 1 }) },
|
|
6708
6976
|
React.createElement('div', { style: { color: T.muted, padding: '3px 10px', fontSize: 11 } }, tr('agent.before')),
|
|
6709
6977
|
React.createElement('pre', { className: 'dsh-rw-agent-output', style: { color: T.danger, background: 'rgba(239,68,68,.06)' } }, diff.oldText ?? ''),
|
|
6710
6978
|
React.createElement('div', { style: { color: T.muted, padding: '3px 10px', fontSize: 11 } }, tr('agent.after')),
|
|
@@ -6747,7 +7015,7 @@ window.__ModuleLoader__.load({
|
|
|
6747
7015
|
}
|
|
6748
7016
|
return React.createElement('section', { className: 'dsh-rw-agent-card', 'data-rw-agent-status': view.status, 'data-rw-agent-tool': props.toolName, style: { borderColor: attention ? T.danger : T.border, color: T.label } },
|
|
6749
7017
|
React.createElement('button', { type: 'button', className: 'dsh-rw-agent-header', 'aria-expanded': !!open, 'aria-controls': bodyId, onClick: () => { setTouched(true); setOpen(!open) }, title: summary },
|
|
6750
|
-
React.createElement(
|
|
7018
|
+
React.createElement(Chevron, { dir: open ? 'down' : 'right', size: 12 }),
|
|
6751
7019
|
React.createElement(WorkbenchIcon, { name: props.toolName === 'rw_exec' ? 'terminal' : props.toolName === 'rw_search' ? 'search' : 'file' }),
|
|
6752
7020
|
React.createElement('strong', { style: { flexShrink: 0, fontWeight: 500 } }, title),
|
|
6753
7021
|
React.createElement('span', { className: 'dsh-rw-agent-summary', style: { color: T.muted } }, summary),
|