@gluztm/dsh-guard 2.4.0 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +38 -40
- package/README.md +38 -44
- package/bin/dsh-guard.mjs +112 -47
- package/lib/client.js +1679 -451
- package/lib/index.mjs +220 -40
- package/lib/inspector.mjs +1480 -424
- package/package.json +3 -2
- package/screenshots.json +7 -0
package/lib/client.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Client half of @gluztm/dsh-guard — Cross-platform
|
|
2
|
+
* Client half of @gluztm/dsh-guard — Cross-platform DSH profile manager,
|
|
3
|
+
* plugin/MCP switchboard, one-way .credentials.yaml writer, llm-pi-ai inspector,
|
|
4
|
+
* and local config snapshot & diff rollback panel for DeepSeek Harness.
|
|
3
5
|
*
|
|
4
|
-
* Strictly zero-secret-leak:
|
|
5
|
-
*
|
|
6
|
+
* Strictly zero-secret-leak: never reads, displays, or transmits plaintext secret values.
|
|
7
|
+
* Uses only React.createElement, useState, useEffect, and Component for universal ModuleLoader compatibility.
|
|
6
8
|
*/
|
|
7
9
|
window.__ModuleLoader__.load({
|
|
8
10
|
id: '@gluztm/dsh-guard',
|
|
@@ -12,138 +14,274 @@ window.__ModuleLoader__.load({
|
|
|
12
14
|
|
|
13
15
|
const SIDE_ID = 'dsh-guard'
|
|
14
16
|
const API_BASE = 'api/dsh-guard'
|
|
15
|
-
const STYLE_ID = 'dsh-guard-panel-styles'
|
|
16
|
-
const
|
|
17
|
+
const STYLE_ID = 'dsh-guard-panel-styles-v242'
|
|
18
|
+
const VERSION = '2.4.2'
|
|
19
|
+
const REPO_FALLBACK = 'https://github.com/gluztm/DSHGuard'
|
|
20
|
+
const RELEASE_FALLBACK = 'https://github.com/gluztm/DSHGuard/releases/tag/2.4.2'
|
|
21
|
+
const INSTALLER_FALLBACK = 'https://github.com/gluztm/DSHGuard/releases/download/2.4.2/DSHGuard-Setup-2.4.2.exe'
|
|
17
22
|
|
|
18
23
|
const COPY = {
|
|
19
24
|
zh: {
|
|
20
|
-
brand: 'DSH
|
|
21
|
-
subtitle: '
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
brand: 'DSH 守护伴生',
|
|
26
|
+
subtitle: '插件启停 · 凭据盲写 · 配置快照',
|
|
27
|
+
guideDesc: '内置管理插件/MCP 开关、断链修复、单向写入 .credentials.yaml 与本地 YAML 配置快照。',
|
|
28
|
+
versionPill: `v${VERSION}`,
|
|
29
|
+
refresh: '刷新',
|
|
30
|
+
refreshing: '同步中',
|
|
24
31
|
langSwitch: 'EN',
|
|
25
|
-
healthy: '
|
|
26
|
-
unhealthy: (n) =>
|
|
27
|
-
loading: '
|
|
32
|
+
healthy: '配置健康',
|
|
33
|
+
unhealthy: (n) => `${n} 项待处理`,
|
|
34
|
+
loading: '正在读取双轨配置、模型提供商、密钥状态与快照…',
|
|
28
35
|
retry: '重试',
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
36
|
+
checkedAt: (t) => `同步于 ${t}`,
|
|
37
|
+
openDesktopBtn: '打开桌面端',
|
|
38
|
+
launchingBtn: '正在拉起…',
|
|
39
|
+
tabOverview: '总览',
|
|
40
|
+
tabPlugins: '插件',
|
|
41
|
+
tabCreds: '凭据',
|
|
42
|
+
tabSnapshots: '快照',
|
|
43
|
+
kpiHealth: '配置健康',
|
|
44
|
+
kpiHealthOk: '一致',
|
|
45
|
+
kpiHealthWarn: (n) => `${n} 项`,
|
|
46
|
+
kpiExt: '插件 / MCP',
|
|
47
|
+
kpiCreds: '密钥 / 提供商',
|
|
48
|
+
kpiSnaps: '配置快照',
|
|
49
|
+
secProfiles: '双轨运行档案',
|
|
50
|
+
webTrack: 'Web 端',
|
|
51
|
+
desktopTrack: '桌面端',
|
|
52
|
+
present: '已就绪',
|
|
53
|
+
absent: '未初始化',
|
|
54
|
+
depsLabel: '总依赖',
|
|
55
|
+
thirdPartyLabel: '第三方',
|
|
56
|
+
mcpLabel: 'MCP 服务',
|
|
57
|
+
disabledLabel: '已禁用',
|
|
58
|
+
brokenLabel: '断链数',
|
|
59
|
+
repairLinksBtn: '一键修复断链',
|
|
60
|
+
repairingBtn: '修复中…',
|
|
61
|
+
allHealthyTitle: 'Web 与桌面端档案健康且无断裂软链接',
|
|
62
|
+
allHealthySub: '当前插件依赖、MCP 补丁与双轨配置均已对齐,可在上方切换标签管理插件开关、单向写入密钥或创建本地快照。',
|
|
63
|
+
quickSnapWeb: '备份 Web 配置',
|
|
64
|
+
quickGoPlugins: '管理插件开关',
|
|
65
|
+
warningsTitle: '巡检提示',
|
|
66
|
+
searchPlaceholder: '搜索插件包名、loader ID 或 MCP 服务名…',
|
|
67
|
+
mcpSectionTitle: 'MCP 服务开关',
|
|
68
|
+
mcpEmpty: '当前档案尚未配置 MCP 服务。',
|
|
69
|
+
pluginsSectionTitle: '已安装插件',
|
|
70
|
+
pluginsEmpty: '未匹配到插件条目。',
|
|
71
|
+
badgeCore: '核心保护',
|
|
72
|
+
badgeSelf: '当前伴生',
|
|
73
|
+
badgeEnabled: '已启用',
|
|
74
|
+
badgeDisabled: '已禁用',
|
|
75
|
+
badgeAllCount: (shown, total) => `${shown} / ${total}`,
|
|
76
|
+
boundaryPluginsSummary: '能力边界说明:为什么插件全新安装/卸载与强杀锁死进程不在此完成?',
|
|
77
|
+
boundaryPluginsP1: '本插件运行于当前 DSH Node 宿主进程内部:在运行时热删除或重装 node_modules 可能导致已加载模块撕裂锁死;同时为遵循插件最小权限安全红线,本插件不会从远端拉取二进制安装包或托管宿主进程生命周期。',
|
|
78
|
+
boundaryPluginsP2: '在伴生插件内,你可直接安全启停第三方插件与 MCP 服务(每次改动均会自动备份),并一键修复断裂依赖链接;完整增删插件、校验压缩包安装及进程外强启停由独立原生桌面端承担。',
|
|
79
|
+
boundaryCredsSummary: '能力边界说明:为什么不在此回显/导出明文密钥或提供 Windows DPAPI 加密库?',
|
|
80
|
+
boundaryCredsP1: '安全合规要求持有前端请求能力的插件不得反向读取并回显真实 API 密钥。本插件采用「只核验键名 + 单向覆盖写入 .credentials.yaml」机制,所有明文仅从输入框单向落盘(0o600),响应报文绝不返回密钥字符。',
|
|
81
|
+
boundaryCredsP2: '硬件绑定的 Windows DPAPI 凭据保险箱加密以及跨 CC Switch 等工具链批量迁移属于系统原生能力,仅独立的 Windows 原生桌面端具备。',
|
|
82
|
+
boundarySnapsSummary: '能力边界说明:为什么配置快照仅恢复 YAML/JSON 配对文件而不覆盖整包扩展?',
|
|
83
|
+
boundarySnapsP1: '伴生插件可在不干扰宿主运行的前提下,安全完成 cordis.patch.yml、cordis.yml、package.json 与 settings.yaml 的实时 SHA256 比对、备份与白名单一键回滚(自动排除 .credentials.yaml)。',
|
|
84
|
+
boundarySnapsP2: '涵盖 node_modules 整包 ZIP 回溯与主程序崩溃后的带外拉起恢复必须脱离宿主进程执行,仅在独立原生桌面端提供。',
|
|
85
|
+
desktopWinLink: `下载 Windows 原生桌面端 v${VERSION} ↗`,
|
|
86
|
+
desktopReleaseLink: '查看 GitHub Releases ↗',
|
|
87
|
+
desktopNonWinNote: '注:原生桌面端目前仅提供 Windows 安装包;当前平台的启停开关、单向写密钥与配置回滚已全部内置于伴生插件。',
|
|
88
|
+
providersTitle: '模型提供商 (llm-pi-ai)',
|
|
89
|
+
providersEmpty: '尚未在 cordis.patch.yml 中发现 llm-pi-ai 提供商配置。',
|
|
90
|
+
modelsUnit: '个模型',
|
|
91
|
+
keyReady: '密钥就绪',
|
|
92
|
+
keyMissing: '缺密钥',
|
|
93
|
+
setKeyBtn: '设置密钥',
|
|
94
|
+
updateKeyBtn: '更新密钥',
|
|
95
|
+
cancelBtn: '取消',
|
|
96
|
+
keyPlaceholder: '输入 API Key(单向盲写,保存后立即清空,绝不回显)',
|
|
97
|
+
writeKeyBtn: '写入 .credentials.yaml',
|
|
98
|
+
writingKeyBtn: '写入中…',
|
|
99
|
+
addKeyToggle: '+ 新增自定义环境变量密钥',
|
|
100
|
+
envNameLabel: '环境变量名 (如 DEEPSEEK_API_KEY)',
|
|
101
|
+
credsAuditTitle: '.credentials.yaml 键名状态审计',
|
|
102
|
+
credsAuditSub: '仅展示键名是否存在及保护标记(绝不读取或传输密钥字符)。',
|
|
103
|
+
credProtected: '受保护 OAuth',
|
|
104
|
+
credPresent: '已写入',
|
|
105
|
+
credEnvOnly: '仅环境变量',
|
|
106
|
+
credsEmpty: '当前尚未创建 .credentials.yaml 或 refs 下尚无键值。',
|
|
107
|
+
snapCreateWeb: '+ 备份 Web 配置',
|
|
108
|
+
snapCreateDesktop: '+ 备份桌面端配置',
|
|
109
|
+
snapCreating: '备份中…',
|
|
110
|
+
snapSourcePlugin: '插件快照',
|
|
111
|
+
snapSourceDesktop: '桌面端快照',
|
|
112
|
+
snapSame: '与磁盘一致',
|
|
113
|
+
snapDiff: (n) => `${n} 处已变更`,
|
|
114
|
+
snapFilesToggle: (n) => `查看 ${n} 个文件比对明细`,
|
|
115
|
+
snapRestoreBtn: '恢复此配置快照',
|
|
116
|
+
snapRestoring: '恢复中…',
|
|
117
|
+
snapNoFiles: '该快照暂无可比对配置文件',
|
|
118
|
+
snapDesktopOnlyTip: '桌面端全量包产物需在桌面端还原',
|
|
119
|
+
fileSame: '一致',
|
|
120
|
+
fileModified: '与现行配置不同',
|
|
121
|
+
fileMissing: '磁盘已删除',
|
|
122
|
+
fileUnknown: '仅记录',
|
|
123
|
+
snapshotsEmpty: '暂无本地配置快照',
|
|
124
|
+
snapshotsEmptyDesc: '点击上方备份按钮,或在修改插件开关时自动留存一份配置档案。',
|
|
125
|
+
footerNote: `@gluztm/dsh-guard v${VERSION}`,
|
|
126
|
+
footerHome: 'GitHub',
|
|
61
127
|
},
|
|
62
128
|
en: {
|
|
63
|
-
brand: '
|
|
64
|
-
subtitle: '
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
129
|
+
brand: 'DSH Companion',
|
|
130
|
+
subtitle: 'Plugins · Blind-Write Creds · Snapshots',
|
|
131
|
+
guideDesc: 'Manage plugins & MCP toggles, repair broken links, blind-write .credentials.yaml refs, and restore YAML config snapshots.',
|
|
132
|
+
versionPill: `v${VERSION}`,
|
|
133
|
+
refresh: 'Refresh',
|
|
134
|
+
refreshing: 'Syncing',
|
|
135
|
+
langSwitch: '中文',
|
|
136
|
+
healthy: 'Healthy',
|
|
137
|
+
unhealthy: (n) => `${n} item${n > 1 ? 's' : ''}`,
|
|
138
|
+
loading: 'Loading profiles, providers, credential keys, and snapshots…',
|
|
71
139
|
retry: 'Retry',
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
140
|
+
checkedAt: (t) => `Synced ${t}`,
|
|
141
|
+
openDesktopBtn: 'Open Desktop',
|
|
142
|
+
launchingBtn: 'Launching…',
|
|
143
|
+
tabOverview: 'Overview',
|
|
144
|
+
tabPlugins: 'Plugins',
|
|
145
|
+
tabCreds: 'Credentials',
|
|
146
|
+
tabSnapshots: 'Snapshots',
|
|
147
|
+
kpiHealth: 'Health',
|
|
148
|
+
kpiHealthOk: 'Synced',
|
|
149
|
+
kpiHealthWarn: (n) => `${n} alert`,
|
|
150
|
+
kpiExt: 'Plugins / MCP',
|
|
151
|
+
kpiCreds: 'Keys / Providers',
|
|
152
|
+
kpiSnaps: 'Snapshots',
|
|
153
|
+
secProfiles: 'Profile Tracks',
|
|
154
|
+
webTrack: 'Web Profile',
|
|
155
|
+
desktopTrack: 'Desktop Profile',
|
|
156
|
+
present: 'Ready',
|
|
157
|
+
absent: 'Absent',
|
|
158
|
+
depsLabel: 'Deps',
|
|
159
|
+
thirdPartyLabel: '3rd-party',
|
|
160
|
+
mcpLabel: 'MCP',
|
|
161
|
+
disabledLabel: 'Disabled',
|
|
162
|
+
brokenLabel: 'Broken Links',
|
|
163
|
+
repairLinksBtn: 'Repair Broken Links',
|
|
164
|
+
repairingBtn: 'Repairing…',
|
|
165
|
+
allHealthyTitle: 'Web & Desktop configs are healthy with no broken links',
|
|
166
|
+
allHealthySub: 'Dependencies, MCP entries, and Cordis patches look clean. Switch tabs above to toggle extensions, set API keys one-way, or manage snapshots.',
|
|
167
|
+
quickSnapWeb: 'Backup Web Config',
|
|
168
|
+
quickGoPlugins: 'Manage Plugins',
|
|
169
|
+
warningsTitle: 'Diagnostics',
|
|
170
|
+
searchPlaceholder: 'Filter package name, loader ID, or MCP server…',
|
|
171
|
+
mcpSectionTitle: 'MCP Servers',
|
|
172
|
+
mcpEmpty: 'No MCP entries configured in this profile.',
|
|
173
|
+
pluginsSectionTitle: 'Installed Plugins',
|
|
174
|
+
pluginsEmpty: 'No matching plugins.',
|
|
175
|
+
badgeCore: 'Core',
|
|
176
|
+
badgeSelf: 'Self',
|
|
177
|
+
badgeEnabled: 'On',
|
|
178
|
+
badgeDisabled: 'Off',
|
|
179
|
+
badgeAllCount: (shown, total) => `${shown} / ${total}`,
|
|
180
|
+
boundaryPluginsSummary: 'Capability boundary: why fresh package install & force process control live outside this plugin',
|
|
181
|
+
boundaryPluginsP1: 'This plugin shares the live DSH Node process: mutating node_modules via npm install at runtime can lock or tear active modules, and companion plugins intentionally lack remote binary execution and host watchdog rights.',
|
|
182
|
+
boundaryPluginsP2: 'Safe plugin & MCP toggling (with automatic pre-change snapshots) and broken symlink repair work right here; full install/uninstall lifecycle and process supervision belong to the native desktop supervisor.',
|
|
183
|
+
boundaryCredsSummary: 'Security boundary: why plaintext key readback & Windows DPAPI vault live outside this plugin',
|
|
184
|
+
boundaryCredsP1: 'By security policy, Web UI plugins must never reverse-read and display plaintext secrets. This tab enforces strict one-way blind-write directly into .credentials.yaml refs: while showing only key presence.',
|
|
185
|
+
boundaryCredsP2: 'Hardware-backed Windows DPAPI encryption vaults and CC Switch cross-tool migrations rely on native Windows security APIs unavailable inside a cross-platform DSH plugin.',
|
|
186
|
+
boundarySnapsSummary: 'Runtime boundary: why snapshots restore YAML/JSON configs rather than full node_modules bundles',
|
|
187
|
+
boundarySnapsP1: 'Within the running DSH process, this tab safely computes live SHA256 diffs, creates snapshots, and performs whitelist rollback of cordis.patch.yml, cordis.yml, package.json, and settings.yaml (excluding secrets).',
|
|
188
|
+
boundarySnapsP2: 'Full extension bundle ZIP replacement and out-of-band crash recovery require shutting down or restarting the DSH process from an external native binary.',
|
|
189
|
+
desktopWinLink: `Download Windows Desktop v${VERSION} ↗`,
|
|
190
|
+
desktopReleaseLink: 'GitHub Releases ↗',
|
|
191
|
+
desktopNonWinNote: 'Note: The native desktop shell is Windows-only; in-plugin toggling, blind-write credentials, and config rollback work natively on this OS.',
|
|
192
|
+
providersTitle: 'Model Providers (llm-pi-ai)',
|
|
193
|
+
providersEmpty: 'No llm-pi-ai provider entries found in cordis.patch.yml.',
|
|
194
|
+
modelsUnit: 'models',
|
|
195
|
+
keyReady: 'Key Ready',
|
|
196
|
+
keyMissing: 'Missing Key',
|
|
197
|
+
setKeyBtn: 'Set Key',
|
|
198
|
+
updateKeyBtn: 'Update Key',
|
|
199
|
+
cancelBtn: 'Cancel',
|
|
200
|
+
keyPlaceholder: 'Paste API key (one-way write only; cleared & never echoed)',
|
|
201
|
+
writeKeyBtn: 'Save to .credentials.yaml',
|
|
202
|
+
writingKeyBtn: 'Saving…',
|
|
203
|
+
addKeyToggle: '+ Add custom env ref key',
|
|
204
|
+
envNameLabel: 'Env Var Name (e.g. DEEPSEEK_API_KEY)',
|
|
205
|
+
credsAuditTitle: '.credentials.yaml Key Presence Audit',
|
|
206
|
+
credsAuditSub: 'Verifies key readiness and protected OAuth flags without reading secret values.',
|
|
207
|
+
credProtected: 'Protected OAuth',
|
|
208
|
+
credPresent: 'Configured',
|
|
209
|
+
credEnvOnly: 'Env Only',
|
|
210
|
+
credsEmpty: 'No .credentials.yaml entries found yet.',
|
|
211
|
+
snapCreateWeb: '+ Backup Web Config',
|
|
212
|
+
snapCreateDesktop: '+ Backup Desktop Config',
|
|
213
|
+
snapCreating: 'Backing up…',
|
|
214
|
+
snapSourcePlugin: 'Plugin',
|
|
215
|
+
snapSourceDesktop: 'Desktop',
|
|
216
|
+
snapSame: 'Matches Disk',
|
|
217
|
+
snapDiff: (n) => `${n} modified`,
|
|
218
|
+
snapFilesToggle: (n) => `Inspect ${n} file diff(s)`,
|
|
219
|
+
snapRestoreBtn: 'Restore Config Files',
|
|
220
|
+
snapRestoring: 'Restoring…',
|
|
221
|
+
snapNoFiles: 'No comparable config files in this snapshot',
|
|
222
|
+
snapDesktopOnlyTip: 'Desktop binary archives require the native desktop app',
|
|
223
|
+
fileSame: 'Same',
|
|
224
|
+
fileModified: 'Changed on disk',
|
|
225
|
+
fileMissing: 'Deleted on disk',
|
|
226
|
+
fileUnknown: 'Recorded',
|
|
227
|
+
snapshotsEmpty: 'No configuration snapshots yet',
|
|
228
|
+
snapshotsEmptyDesc: 'Create a manual backup above or toggle a plugin to automatically preserve a snapshot.',
|
|
229
|
+
footerNote: `@gluztm/dsh-guard v${VERSION}`,
|
|
230
|
+
footerHome: 'GitHub',
|
|
104
231
|
},
|
|
105
232
|
}
|
|
106
233
|
|
|
107
234
|
const CSS = `
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
--dshg-
|
|
113
|
-
--dshg-
|
|
114
|
-
--dshg-
|
|
115
|
-
--dshg-
|
|
116
|
-
--dshg-
|
|
117
|
-
--dshg-
|
|
118
|
-
|
|
119
|
-
|
|
235
|
+
@keyframes dshg-spin { to { transform: rotate(360deg); } }
|
|
236
|
+
@keyframes dshg-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
|
|
237
|
+
|
|
238
|
+
.dshg-wrap {
|
|
239
|
+
--dshg-bg: var(--dsw-alias-bg-container, transparent);
|
|
240
|
+
--dshg-card: var(--dsw-alias-card-fill, var(--dsw-alias-bg-elevated, rgba(127, 127, 127, 0.06)));
|
|
241
|
+
--dshg-card-hover: var(--dsw-alias-card-fill-hover, var(--dsw-alias-fill-secondary, rgba(127, 127, 127, 0.1)));
|
|
242
|
+
--dshg-fill: var(--dsw-alias-fill-l1, var(--dsw-alias-fill-tertiary, rgba(127, 127, 127, 0.12)));
|
|
243
|
+
--dshg-fill-subtle: var(--dsw-alias-bg-layer-2, var(--dsw-alias-fill-quaternary, rgba(127, 127, 127, 0.04)));
|
|
244
|
+
--dshg-border: var(--dsw-alias-border-l1, var(--dsw-alias-border-secondary, rgba(127, 127, 127, 0.18)));
|
|
245
|
+
--dshg-border-strong: var(--dsw-alias-border-l2, var(--dsw-alias-border-primary, rgba(127, 127, 127, 0.32)));
|
|
246
|
+
--dshg-text: var(--dsw-alias-label-primary, var(--dsw-alias-text-primary, inherit));
|
|
247
|
+
--dshg-text-2: var(--dsw-alias-label-secondary, var(--dsw-alias-text-secondary, rgba(127, 127, 127, 0.92)));
|
|
248
|
+
--dshg-text-3: var(--dsw-alias-label-tertiary, var(--dsw-alias-text-tertiary, rgba(127, 127, 127, 0.7)));
|
|
249
|
+
--dshg-accent: var(--dsw-alias-brand-primary, var(--dsw-alias-color-primary, #2563eb));
|
|
250
|
+
--dshg-accent-soft: rgba(59, 130, 246, 0.11);
|
|
251
|
+
--dshg-accent-border: rgba(59, 130, 246, 0.28);
|
|
252
|
+
--dshg-ok-soft: rgba(16, 185, 129, 0.12);
|
|
253
|
+
--dshg-ok-border: rgba(16, 185, 129, 0.28);
|
|
254
|
+
--dshg-warn-soft: rgba(245, 158, 11, 0.12);
|
|
255
|
+
--dshg-warn-border: rgba(245, 158, 11, 0.3);
|
|
120
256
|
display: flex;
|
|
121
257
|
flex-direction: column;
|
|
122
|
-
gap:
|
|
123
|
-
padding: 12px;
|
|
258
|
+
gap: 11px;
|
|
124
259
|
height: 100%;
|
|
260
|
+
min-height: 0;
|
|
261
|
+
padding: 12px 14px 16px;
|
|
125
262
|
box-sizing: border-box;
|
|
126
263
|
overflow-y: auto;
|
|
264
|
+
background: var(--dshg-bg);
|
|
265
|
+
color: var(--dshg-text);
|
|
266
|
+
font-family: inherit;
|
|
267
|
+
font-size: 13px;
|
|
268
|
+
line-height: 1.45;
|
|
127
269
|
}
|
|
128
|
-
.dshg-
|
|
129
|
-
max-width:
|
|
270
|
+
.dshg-wrap[data-variant="main"] {
|
|
271
|
+
max-width: 960px;
|
|
130
272
|
margin: 0 auto;
|
|
131
|
-
padding:
|
|
273
|
+
padding: 22px 26px 32px;
|
|
132
274
|
}
|
|
133
|
-
.dshg-
|
|
134
|
-
border: 1px solid var(--dshg-border);
|
|
135
|
-
background: var(--dshg-card);
|
|
136
|
-
border-radius: 12px;
|
|
137
|
-
padding: 11px 12px;
|
|
275
|
+
.dshg-tab-body {
|
|
138
276
|
display: flex;
|
|
139
277
|
flex-direction: column;
|
|
140
|
-
gap:
|
|
278
|
+
gap: 10px;
|
|
141
279
|
}
|
|
142
280
|
.dshg-header {
|
|
143
281
|
display: flex;
|
|
144
282
|
align-items: center;
|
|
145
283
|
justify-content: space-between;
|
|
146
|
-
gap:
|
|
284
|
+
gap: 10px;
|
|
147
285
|
flex-wrap: wrap;
|
|
148
286
|
}
|
|
149
287
|
.dshg-brand {
|
|
@@ -152,28 +290,49 @@ window.__ModuleLoader__.load({
|
|
|
152
290
|
gap: 9px;
|
|
153
291
|
min-width: 0;
|
|
154
292
|
}
|
|
155
|
-
.dshg-logo
|
|
156
|
-
width:
|
|
157
|
-
height:
|
|
293
|
+
.dshg-logo {
|
|
294
|
+
width: 30px;
|
|
295
|
+
height: 30px;
|
|
158
296
|
border-radius: 9px;
|
|
159
|
-
display:
|
|
297
|
+
display: flex;
|
|
160
298
|
align-items: center;
|
|
161
299
|
justify-content: center;
|
|
162
|
-
background: linear-gradient(135deg,
|
|
163
|
-
|
|
164
|
-
color: #3b82f6;
|
|
300
|
+
background: linear-gradient(135deg, var(--dshg-accent), #6366f1);
|
|
301
|
+
color: #ffffff;
|
|
165
302
|
flex-shrink: 0;
|
|
303
|
+
box-shadow: 0 2px 7px rgba(59, 130, 246, 0.24);
|
|
304
|
+
}
|
|
305
|
+
.dshg-title-box {
|
|
306
|
+
display: flex;
|
|
307
|
+
flex-direction: column;
|
|
308
|
+
min-width: 0;
|
|
309
|
+
}
|
|
310
|
+
.dshg-title-row {
|
|
311
|
+
display: flex;
|
|
312
|
+
align-items: center;
|
|
313
|
+
gap: 6px;
|
|
166
314
|
}
|
|
167
315
|
.dshg-title {
|
|
168
|
-
font-size:
|
|
316
|
+
font-size: 14px;
|
|
169
317
|
font-weight: 650;
|
|
170
|
-
line-height: 1.2;
|
|
171
318
|
letter-spacing: -0.01em;
|
|
319
|
+
white-space: nowrap;
|
|
320
|
+
}
|
|
321
|
+
.dshg-ver {
|
|
322
|
+
font-size: 10.5px;
|
|
323
|
+
font-weight: 500;
|
|
324
|
+
padding: 1px 6px;
|
|
325
|
+
border-radius: 99px;
|
|
326
|
+
background: var(--dshg-fill);
|
|
327
|
+
color: var(--dshg-text-2);
|
|
328
|
+
border: 1px solid var(--dshg-border);
|
|
172
329
|
}
|
|
173
330
|
.dshg-sub {
|
|
174
331
|
font-size: 11px;
|
|
175
|
-
color: var(--dshg-text-
|
|
176
|
-
|
|
332
|
+
color: var(--dshg-text-3);
|
|
333
|
+
white-space: nowrap;
|
|
334
|
+
overflow: hidden;
|
|
335
|
+
text-overflow: ellipsis;
|
|
177
336
|
}
|
|
178
337
|
.dshg-actions {
|
|
179
338
|
display: flex;
|
|
@@ -182,68 +341,89 @@ window.__ModuleLoader__.load({
|
|
|
182
341
|
flex-shrink: 0;
|
|
183
342
|
}
|
|
184
343
|
.dshg-btn {
|
|
344
|
+
appearance: none;
|
|
185
345
|
display: inline-flex;
|
|
186
346
|
align-items: center;
|
|
187
347
|
justify-content: center;
|
|
188
348
|
gap: 5px;
|
|
189
|
-
height:
|
|
190
|
-
padding: 0
|
|
349
|
+
height: 28px;
|
|
350
|
+
padding: 0 10px;
|
|
191
351
|
border-radius: 8px;
|
|
192
352
|
border: 1px solid var(--dshg-border);
|
|
193
353
|
background: var(--dshg-card);
|
|
194
354
|
color: var(--dshg-text);
|
|
355
|
+
font-family: inherit;
|
|
195
356
|
font-size: 11.5px;
|
|
196
357
|
font-weight: 500;
|
|
197
358
|
cursor: pointer;
|
|
198
|
-
transition: background 0.15s ease, border-color 0.15s ease;
|
|
359
|
+
transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
|
|
199
360
|
text-decoration: none;
|
|
200
361
|
box-sizing: border-box;
|
|
362
|
+
white-space: nowrap;
|
|
201
363
|
}
|
|
202
364
|
.dshg-btn:hover:not(:disabled) {
|
|
203
365
|
background: var(--dshg-card-hover);
|
|
204
366
|
border-color: var(--dshg-border-strong);
|
|
205
367
|
}
|
|
206
368
|
.dshg-btn:disabled {
|
|
207
|
-
opacity: 0.
|
|
369
|
+
opacity: 0.52;
|
|
208
370
|
cursor: default;
|
|
209
371
|
}
|
|
372
|
+
.dshg-btn-icon {
|
|
373
|
+
width: 28px;
|
|
374
|
+
padding: 0;
|
|
375
|
+
}
|
|
210
376
|
.dshg-btn-primary {
|
|
211
377
|
background: var(--dshg-accent);
|
|
212
378
|
border-color: transparent;
|
|
213
379
|
color: #ffffff;
|
|
214
|
-
height: 31px;
|
|
215
|
-
padding: 0 12px;
|
|
216
380
|
font-weight: 600;
|
|
217
|
-
width: 100%;
|
|
218
381
|
}
|
|
219
382
|
.dshg-btn-primary:hover:not(:disabled) {
|
|
220
383
|
background: var(--dshg-accent);
|
|
221
|
-
|
|
384
|
+
border-color: transparent;
|
|
385
|
+
opacity: 0.92;
|
|
386
|
+
}
|
|
387
|
+
.dshg-btn-sm {
|
|
388
|
+
height: 24px;
|
|
389
|
+
padding: 0 8px;
|
|
390
|
+
font-size: 11px;
|
|
391
|
+
border-radius: 6px;
|
|
392
|
+
}
|
|
393
|
+
.dshg-spin {
|
|
394
|
+
animation: dshg-spin 0.9s linear infinite;
|
|
222
395
|
}
|
|
223
396
|
.dshg-badge {
|
|
224
397
|
display: inline-flex;
|
|
225
398
|
align-items: center;
|
|
226
399
|
gap: 5px;
|
|
227
|
-
padding:
|
|
400
|
+
padding: 2px 8px;
|
|
228
401
|
border-radius: 99px;
|
|
229
402
|
font-size: 11px;
|
|
230
|
-
font-weight:
|
|
403
|
+
font-weight: 500;
|
|
231
404
|
border: 1px solid transparent;
|
|
232
405
|
width: fit-content;
|
|
233
406
|
}
|
|
407
|
+
.dshg-dot {
|
|
408
|
+
width: 6px;
|
|
409
|
+
height: 6px;
|
|
410
|
+
border-radius: 50%;
|
|
411
|
+
background: currentColor;
|
|
412
|
+
animation: dshg-pulse 2.2s ease-in-out infinite;
|
|
413
|
+
}
|
|
234
414
|
.dshg-badge[data-tone="ok"] {
|
|
235
|
-
background:
|
|
236
|
-
border-color:
|
|
237
|
-
color: #
|
|
415
|
+
background: var(--dshg-ok-soft);
|
|
416
|
+
border-color: var(--dshg-ok-border);
|
|
417
|
+
color: #10b981;
|
|
238
418
|
}
|
|
239
419
|
.dshg-badge[data-tone="warn"] {
|
|
240
|
-
background:
|
|
241
|
-
border-color:
|
|
242
|
-
color: #
|
|
420
|
+
background: var(--dshg-warn-soft);
|
|
421
|
+
border-color: var(--dshg-warn-border);
|
|
422
|
+
color: #d97706;
|
|
243
423
|
}
|
|
244
424
|
.dshg-badge[data-tone="blue"] {
|
|
245
|
-
background:
|
|
246
|
-
border-color:
|
|
425
|
+
background: var(--dshg-accent-soft);
|
|
426
|
+
border-color: var(--dshg-accent-border);
|
|
247
427
|
color: #3b82f6;
|
|
248
428
|
}
|
|
249
429
|
.dshg-badge[data-tone="muted"] {
|
|
@@ -251,19 +431,111 @@ window.__ModuleLoader__.load({
|
|
|
251
431
|
border-color: var(--dshg-border);
|
|
252
432
|
color: var(--dshg-text-2);
|
|
253
433
|
}
|
|
434
|
+
.dshg-kpi-strip {
|
|
435
|
+
display: grid;
|
|
436
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
437
|
+
gap: 6px;
|
|
438
|
+
}
|
|
439
|
+
.dshg-wrap[data-variant="main"] .dshg-kpi-strip {
|
|
440
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
441
|
+
}
|
|
442
|
+
.dshg-kpi {
|
|
443
|
+
border: 1px solid var(--dshg-border);
|
|
444
|
+
background: var(--dshg-card);
|
|
445
|
+
border-radius: 10px;
|
|
446
|
+
padding: 8px 10px;
|
|
447
|
+
display: flex;
|
|
448
|
+
flex-direction: column;
|
|
449
|
+
gap: 2px;
|
|
450
|
+
text-align: left;
|
|
451
|
+
cursor: pointer;
|
|
452
|
+
color: inherit;
|
|
453
|
+
transition: border-color 0.15s ease, background 0.15s ease;
|
|
454
|
+
}
|
|
455
|
+
.dshg-kpi:hover {
|
|
456
|
+
background: var(--dshg-card-hover);
|
|
457
|
+
border-color: var(--dshg-border-strong);
|
|
458
|
+
}
|
|
459
|
+
.dshg-kpi[data-active="true"] {
|
|
460
|
+
border-color: var(--dshg-accent-border);
|
|
461
|
+
background: var(--dshg-accent-soft);
|
|
462
|
+
}
|
|
463
|
+
.dshg-kpi-label {
|
|
464
|
+
font-size: 11px;
|
|
465
|
+
color: var(--dshg-text-3);
|
|
466
|
+
}
|
|
467
|
+
.dshg-kpi-val {
|
|
468
|
+
font-size: 14.5px;
|
|
469
|
+
font-weight: 650;
|
|
470
|
+
letter-spacing: -0.02em;
|
|
471
|
+
}
|
|
472
|
+
.dshg-seg {
|
|
473
|
+
display: grid;
|
|
474
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
475
|
+
gap: 3px;
|
|
476
|
+
padding: 3px;
|
|
477
|
+
border-radius: 10px;
|
|
478
|
+
background: var(--dshg-fill-subtle);
|
|
479
|
+
border: 1px solid var(--dshg-border);
|
|
480
|
+
}
|
|
481
|
+
.dshg-seg-2 {
|
|
482
|
+
display: inline-grid;
|
|
483
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
484
|
+
gap: 3px;
|
|
485
|
+
padding: 2px;
|
|
486
|
+
border-radius: 8px;
|
|
487
|
+
background: var(--dshg-fill-subtle);
|
|
488
|
+
border: 1px solid var(--dshg-border);
|
|
489
|
+
}
|
|
490
|
+
.dshg-seg-btn {
|
|
491
|
+
appearance: none;
|
|
492
|
+
border: none;
|
|
493
|
+
background: transparent;
|
|
494
|
+
color: var(--dshg-text-2);
|
|
495
|
+
font-family: inherit;
|
|
496
|
+
font-size: 11.5px;
|
|
497
|
+
font-weight: 500;
|
|
498
|
+
padding: 5px 4px;
|
|
499
|
+
border-radius: 7px;
|
|
500
|
+
cursor: pointer;
|
|
501
|
+
display: inline-flex;
|
|
502
|
+
align-items: center;
|
|
503
|
+
justify-content: center;
|
|
504
|
+
gap: 4px;
|
|
505
|
+
transition: background 0.15s ease, color 0.15s ease;
|
|
506
|
+
}
|
|
507
|
+
.dshg-seg-btn[data-active="true"] {
|
|
508
|
+
background: var(--dshg-card-hover);
|
|
509
|
+
color: var(--dshg-text);
|
|
510
|
+
font-weight: 600;
|
|
511
|
+
}
|
|
512
|
+
.dshg-card {
|
|
513
|
+
border: 1px solid var(--dshg-border);
|
|
514
|
+
background: var(--dshg-card);
|
|
515
|
+
border-radius: 11px;
|
|
516
|
+
padding: 11px 12px;
|
|
517
|
+
display: flex;
|
|
518
|
+
flex-direction: column;
|
|
519
|
+
gap: 9px;
|
|
520
|
+
}
|
|
254
521
|
.dshg-sec-head {
|
|
255
522
|
display: flex;
|
|
256
523
|
align-items: center;
|
|
257
524
|
justify-content: space-between;
|
|
258
525
|
gap: 8px;
|
|
259
|
-
font-size:
|
|
526
|
+
font-size: 12px;
|
|
260
527
|
font-weight: 600;
|
|
528
|
+
color: var(--dshg-text);
|
|
529
|
+
}
|
|
530
|
+
.dshg-sec-sub {
|
|
531
|
+
font-size: 11px;
|
|
261
532
|
color: var(--dshg-text-2);
|
|
533
|
+
line-height: 1.45;
|
|
262
534
|
}
|
|
263
535
|
.dshg-profile-grid {
|
|
264
536
|
display: grid;
|
|
265
|
-
grid-template-columns: repeat(auto-fit, minmax(
|
|
266
|
-
gap:
|
|
537
|
+
grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
|
|
538
|
+
gap: 7px;
|
|
267
539
|
}
|
|
268
540
|
.dshg-subcard {
|
|
269
541
|
border: 1px solid var(--dshg-border);
|
|
@@ -271,8 +543,8 @@ window.__ModuleLoader__.load({
|
|
|
271
543
|
padding: 9px 10px;
|
|
272
544
|
display: flex;
|
|
273
545
|
flex-direction: column;
|
|
274
|
-
gap:
|
|
275
|
-
background:
|
|
546
|
+
gap: 5px;
|
|
547
|
+
background: var(--dshg-fill-subtle);
|
|
276
548
|
}
|
|
277
549
|
.dshg-row {
|
|
278
550
|
display: flex;
|
|
@@ -281,56 +553,223 @@ window.__ModuleLoader__.load({
|
|
|
281
553
|
gap: 6px;
|
|
282
554
|
font-size: 11.5px;
|
|
283
555
|
}
|
|
284
|
-
.dshg-
|
|
556
|
+
.dshg-toolbar {
|
|
285
557
|
display: flex;
|
|
558
|
+
align-items: center;
|
|
559
|
+
justify-content: space-between;
|
|
560
|
+
gap: 8px;
|
|
286
561
|
flex-wrap: wrap;
|
|
287
|
-
gap: 5px;
|
|
288
562
|
}
|
|
289
|
-
.dshg-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
563
|
+
.dshg-search-wrap {
|
|
564
|
+
position: relative;
|
|
565
|
+
flex: 1 1 160px;
|
|
566
|
+
min-width: 140px;
|
|
567
|
+
}
|
|
568
|
+
.dshg-search-ico {
|
|
569
|
+
position: absolute;
|
|
570
|
+
left: 9px;
|
|
571
|
+
top: 50%;
|
|
572
|
+
transform: translateY(-50%);
|
|
573
|
+
color: var(--dshg-text-3);
|
|
574
|
+
pointer-events: none;
|
|
575
|
+
}
|
|
576
|
+
.dshg-input {
|
|
577
|
+
width: 100%;
|
|
578
|
+
height: 29px;
|
|
579
|
+
box-sizing: border-box;
|
|
580
|
+
border-radius: 8px;
|
|
294
581
|
border: 1px solid var(--dshg-border);
|
|
295
|
-
background: var(--dshg-fill);
|
|
582
|
+
background: var(--dshg-fill-subtle);
|
|
296
583
|
color: var(--dshg-text);
|
|
297
|
-
|
|
584
|
+
font-family: inherit;
|
|
585
|
+
font-size: 11.5px;
|
|
586
|
+
padding: 0 9px;
|
|
587
|
+
outline: none;
|
|
588
|
+
transition: border-color 0.15s ease, background 0.15s ease;
|
|
298
589
|
}
|
|
299
|
-
.dshg-
|
|
300
|
-
|
|
301
|
-
border-color: rgba(34, 197, 94, 0.32);
|
|
302
|
-
color: #22c55e;
|
|
590
|
+
.dshg-input.with-ico {
|
|
591
|
+
padding-left: 28px;
|
|
303
592
|
}
|
|
304
|
-
.dshg-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
color: #f59e0b;
|
|
593
|
+
.dshg-input:focus {
|
|
594
|
+
border-color: var(--dshg-accent);
|
|
595
|
+
background: var(--dshg-card);
|
|
308
596
|
}
|
|
309
|
-
.dshg-
|
|
597
|
+
.dshg-list {
|
|
310
598
|
display: flex;
|
|
311
599
|
flex-direction: column;
|
|
312
600
|
gap: 6px;
|
|
313
601
|
}
|
|
314
|
-
.dshg-
|
|
602
|
+
.dshg-item {
|
|
315
603
|
border: 1px solid var(--dshg-border);
|
|
316
|
-
|
|
317
|
-
|
|
604
|
+
background: var(--dshg-fill-subtle);
|
|
605
|
+
border-radius: 9px;
|
|
606
|
+
padding: 8px 10px;
|
|
318
607
|
display: flex;
|
|
319
608
|
flex-direction: column;
|
|
320
|
-
gap:
|
|
321
|
-
|
|
609
|
+
gap: 6px;
|
|
610
|
+
}
|
|
611
|
+
.dshg-item-row {
|
|
612
|
+
display: flex;
|
|
613
|
+
align-items: center;
|
|
614
|
+
justify-content: space-between;
|
|
615
|
+
gap: 8px;
|
|
616
|
+
}
|
|
617
|
+
.dshg-item-main {
|
|
618
|
+
min-width: 0;
|
|
619
|
+
flex: 1;
|
|
620
|
+
display: flex;
|
|
621
|
+
flex-direction: column;
|
|
622
|
+
gap: 2px;
|
|
623
|
+
}
|
|
624
|
+
.dshg-item-title {
|
|
625
|
+
display: flex;
|
|
626
|
+
align-items: center;
|
|
627
|
+
gap: 6px;
|
|
628
|
+
flex-wrap: wrap;
|
|
629
|
+
font-size: 12px;
|
|
630
|
+
font-weight: 600;
|
|
631
|
+
word-break: break-word;
|
|
322
632
|
}
|
|
323
633
|
.dshg-mono {
|
|
324
634
|
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
325
635
|
font-size: 11px;
|
|
326
636
|
word-break: break-all;
|
|
637
|
+
color: var(--dshg-text-2);
|
|
638
|
+
}
|
|
639
|
+
.dshg-switch {
|
|
640
|
+
position: relative;
|
|
641
|
+
width: 34px;
|
|
642
|
+
height: 19px;
|
|
643
|
+
border-radius: 99px;
|
|
644
|
+
border: 1px solid var(--dshg-border-strong);
|
|
645
|
+
background: var(--dshg-fill);
|
|
646
|
+
cursor: pointer;
|
|
647
|
+
padding: 0;
|
|
648
|
+
flex-shrink: 0;
|
|
649
|
+
transition: background 0.16s ease, border-color 0.16s ease;
|
|
650
|
+
}
|
|
651
|
+
.dshg-switch[data-on="true"] {
|
|
652
|
+
background: #10b981;
|
|
653
|
+
border-color: #10b981;
|
|
654
|
+
}
|
|
655
|
+
.dshg-switch:disabled {
|
|
656
|
+
opacity: 0.45;
|
|
657
|
+
cursor: default;
|
|
658
|
+
}
|
|
659
|
+
.dshg-switch-thumb {
|
|
660
|
+
position: absolute;
|
|
661
|
+
top: 2px;
|
|
662
|
+
left: 2px;
|
|
663
|
+
width: 13px;
|
|
664
|
+
height: 13px;
|
|
665
|
+
border-radius: 50%;
|
|
666
|
+
background: #ffffff;
|
|
667
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
|
|
668
|
+
transition: transform 0.16s ease;
|
|
669
|
+
}
|
|
670
|
+
.dshg-switch[data-on="true"] .dshg-switch-thumb {
|
|
671
|
+
transform: translateX(15px);
|
|
672
|
+
}
|
|
673
|
+
.dshg-drawer {
|
|
674
|
+
border-top: 1px solid var(--dshg-border);
|
|
675
|
+
padding-top: 8px;
|
|
676
|
+
display: flex;
|
|
677
|
+
flex-direction: column;
|
|
678
|
+
gap: 6px;
|
|
679
|
+
}
|
|
680
|
+
.dshg-drawer-row {
|
|
681
|
+
display: flex;
|
|
682
|
+
gap: 6px;
|
|
683
|
+
align-items: center;
|
|
684
|
+
}
|
|
685
|
+
.dshg-pills {
|
|
686
|
+
display: flex;
|
|
687
|
+
flex-wrap: wrap;
|
|
688
|
+
gap: 4px;
|
|
689
|
+
}
|
|
690
|
+
.dshg-pill {
|
|
691
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
692
|
+
font-size: 10.5px;
|
|
693
|
+
padding: 1.5px 6px;
|
|
694
|
+
border-radius: 5px;
|
|
695
|
+
border: 1px solid var(--dshg-border);
|
|
696
|
+
background: var(--dshg-fill);
|
|
697
|
+
color: var(--dshg-text-2);
|
|
698
|
+
word-break: break-all;
|
|
699
|
+
}
|
|
700
|
+
.dshg-boundary {
|
|
701
|
+
border: 1px solid var(--dshg-border);
|
|
702
|
+
border-radius: 10px;
|
|
703
|
+
background: var(--dshg-fill-subtle);
|
|
704
|
+
overflow: hidden;
|
|
705
|
+
}
|
|
706
|
+
.dshg-boundary > summary {
|
|
707
|
+
list-style: none;
|
|
708
|
+
cursor: pointer;
|
|
709
|
+
padding: 8px 11px;
|
|
710
|
+
font-size: 11px;
|
|
711
|
+
font-weight: 500;
|
|
712
|
+
color: var(--dshg-text-2);
|
|
713
|
+
display: flex;
|
|
714
|
+
align-items: center;
|
|
715
|
+
justify-content: space-between;
|
|
716
|
+
gap: 8px;
|
|
717
|
+
user-select: none;
|
|
718
|
+
}
|
|
719
|
+
.dshg-boundary > summary::-webkit-details-marker {
|
|
720
|
+
display: none;
|
|
721
|
+
}
|
|
722
|
+
.dshg-boundary[open] > summary {
|
|
723
|
+
border-bottom: 1px solid var(--dshg-border);
|
|
724
|
+
color: var(--dshg-text);
|
|
725
|
+
}
|
|
726
|
+
.dshg-boundary-body {
|
|
727
|
+
padding: 9px 11px;
|
|
728
|
+
display: flex;
|
|
729
|
+
flex-direction: column;
|
|
730
|
+
gap: 6px;
|
|
731
|
+
font-size: 11px;
|
|
732
|
+
line-height: 1.5;
|
|
733
|
+
color: var(--dshg-text-2);
|
|
734
|
+
}
|
|
735
|
+
.dshg-boundary-links {
|
|
736
|
+
display: flex;
|
|
737
|
+
flex-wrap: wrap;
|
|
738
|
+
gap: 8px;
|
|
739
|
+
margin-top: 2px;
|
|
740
|
+
}
|
|
741
|
+
.dshg-boundary-links a {
|
|
742
|
+
font-size: 11px;
|
|
743
|
+
color: var(--dshg-accent);
|
|
744
|
+
text-decoration: none;
|
|
745
|
+
font-weight: 500;
|
|
746
|
+
}
|
|
747
|
+
.dshg-boundary-links a:hover {
|
|
748
|
+
text-decoration: underline;
|
|
749
|
+
}
|
|
750
|
+
.dshg-track-dot {
|
|
751
|
+
width: 7px;
|
|
752
|
+
height: 7px;
|
|
753
|
+
border-radius: 50%;
|
|
754
|
+
flex-shrink: 0;
|
|
755
|
+
}
|
|
756
|
+
.dshg-empty {
|
|
757
|
+
border: 1px dashed var(--dshg-border-strong);
|
|
758
|
+
border-radius: 10px;
|
|
759
|
+
padding: 15px 12px;
|
|
760
|
+
display: flex;
|
|
761
|
+
flex-direction: column;
|
|
762
|
+
align-items: center;
|
|
763
|
+
text-align: center;
|
|
764
|
+
gap: 6px;
|
|
765
|
+
color: var(--dshg-text-2);
|
|
327
766
|
}
|
|
328
767
|
.dshg-notice {
|
|
329
768
|
padding: 8px 10px;
|
|
330
769
|
border-radius: 9px;
|
|
331
770
|
font-size: 11.5px;
|
|
332
|
-
border: 1px solid
|
|
333
|
-
background:
|
|
771
|
+
border: 1px solid var(--dshg-accent-border);
|
|
772
|
+
background: var(--dshg-accent-soft);
|
|
334
773
|
color: var(--dshg-text);
|
|
335
774
|
}
|
|
336
775
|
.dshg-error {
|
|
@@ -338,9 +777,26 @@ window.__ModuleLoader__.load({
|
|
|
338
777
|
border-radius: 9px;
|
|
339
778
|
font-size: 11.5px;
|
|
340
779
|
border: 1px solid rgba(239, 68, 68, 0.4);
|
|
341
|
-
background: rgba(239, 68, 68, 0.
|
|
780
|
+
background: rgba(239, 68, 68, 0.11);
|
|
342
781
|
color: #f87171;
|
|
343
782
|
}
|
|
783
|
+
.dshg-footer {
|
|
784
|
+
display: flex;
|
|
785
|
+
align-items: center;
|
|
786
|
+
justify-content: space-between;
|
|
787
|
+
gap: 8px;
|
|
788
|
+
padding: 2px 4px 4px;
|
|
789
|
+
font-size: 11px;
|
|
790
|
+
color: var(--dshg-text-3);
|
|
791
|
+
}
|
|
792
|
+
.dshg-footer a {
|
|
793
|
+
color: var(--dshg-text-2);
|
|
794
|
+
text-decoration: none;
|
|
795
|
+
}
|
|
796
|
+
.dshg-footer a:hover {
|
|
797
|
+
color: var(--dshg-text);
|
|
798
|
+
text-decoration: underline;
|
|
799
|
+
}
|
|
344
800
|
`
|
|
345
801
|
|
|
346
802
|
function ensureStyles() {
|
|
@@ -354,12 +810,21 @@ window.__ModuleLoader__.load({
|
|
|
354
810
|
|
|
355
811
|
const store = {
|
|
356
812
|
lang: 'zh',
|
|
813
|
+
tab: 'overview',
|
|
814
|
+
pluginProfile: 'web',
|
|
815
|
+
search: '',
|
|
357
816
|
loading: false,
|
|
358
|
-
|
|
817
|
+
busyKey: '',
|
|
359
818
|
error: '',
|
|
360
819
|
notice: '',
|
|
361
820
|
data: null,
|
|
362
821
|
checkedAt: 0,
|
|
822
|
+
editProviderKey: '',
|
|
823
|
+
draftSecret: '',
|
|
824
|
+
showAddKey: false,
|
|
825
|
+
newKeyName: '',
|
|
826
|
+
newKeySecret: '',
|
|
827
|
+
expandedSnaps: {},
|
|
363
828
|
}
|
|
364
829
|
|
|
365
830
|
const listeners = new Set()
|
|
@@ -369,7 +834,7 @@ window.__ModuleLoader__.load({
|
|
|
369
834
|
try {
|
|
370
835
|
listener()
|
|
371
836
|
} catch {
|
|
372
|
-
// Ignore
|
|
837
|
+
// Ignore unmounted subscriber errors cleanly.
|
|
373
838
|
}
|
|
374
839
|
}
|
|
375
840
|
}
|
|
@@ -380,74 +845,69 @@ window.__ModuleLoader__.load({
|
|
|
380
845
|
}
|
|
381
846
|
|
|
382
847
|
function useStore() {
|
|
383
|
-
const [,
|
|
848
|
+
const [, setTick] = React.useState(0)
|
|
384
849
|
React.useEffect(() => {
|
|
385
|
-
const
|
|
386
|
-
listeners.add(
|
|
387
|
-
return () => listeners.delete(
|
|
850
|
+
const listener = () => setTick((v) => v + 1)
|
|
851
|
+
listeners.add(listener)
|
|
852
|
+
return () => listeners.delete(listener)
|
|
388
853
|
}, [])
|
|
389
854
|
return store
|
|
390
855
|
}
|
|
391
856
|
|
|
392
|
-
async function fetchOverview() {
|
|
393
|
-
if (store.loading
|
|
857
|
+
async function fetchOverview(force = false) {
|
|
858
|
+
if (store.loading && !force) return
|
|
394
859
|
patch({ loading: true, error: '' })
|
|
395
860
|
try {
|
|
396
|
-
const res = await fetch(`${API_BASE}/overview`, {
|
|
397
|
-
cache: 'no-store',
|
|
398
|
-
credentials: 'same-origin',
|
|
399
|
-
headers: { accept: 'application/json' },
|
|
400
|
-
})
|
|
861
|
+
const res = await fetch(`${API_BASE}/overview`, { credentials: 'same-origin' })
|
|
401
862
|
const json = await res.json()
|
|
402
|
-
if (!res.ok || !json || json.ok
|
|
863
|
+
if (!res.ok || !json || !json.ok) {
|
|
403
864
|
throw new Error((json && json.error) || `HTTP ${res.status}`)
|
|
404
865
|
}
|
|
405
866
|
patch({
|
|
867
|
+
loading: false,
|
|
406
868
|
data: json,
|
|
407
869
|
checkedAt: json.checkedAt || Date.now(),
|
|
408
|
-
error: '',
|
|
409
870
|
})
|
|
410
871
|
} catch (err) {
|
|
411
|
-
patch({
|
|
412
|
-
|
|
413
|
-
|
|
872
|
+
patch({
|
|
873
|
+
loading: false,
|
|
874
|
+
error: err && err.message ? String(err.message) : 'Failed to load companion state',
|
|
875
|
+
})
|
|
414
876
|
}
|
|
415
877
|
}
|
|
416
878
|
|
|
417
|
-
async function
|
|
418
|
-
|
|
419
|
-
patch({ launching: true, notice: '', error: '' })
|
|
879
|
+
async function postAction(endpoint, payload, busyId, successMsgBuilder) {
|
|
880
|
+
patch({ busyKey: busyId, error: '', notice: '' })
|
|
420
881
|
try {
|
|
421
|
-
const res = await fetch(`${API_BASE}
|
|
882
|
+
const res = await fetch(`${API_BASE}${endpoint}`, {
|
|
422
883
|
method: 'POST',
|
|
423
|
-
cache: 'no-store',
|
|
424
884
|
credentials: 'same-origin',
|
|
425
|
-
headers: {
|
|
885
|
+
headers: { 'content-type': 'application/json' },
|
|
886
|
+
body: JSON.stringify(payload || {}),
|
|
426
887
|
})
|
|
427
888
|
const json = await res.json()
|
|
428
889
|
if (!res.ok || !json || json.ok === false) {
|
|
429
|
-
throw new Error((json && json.error) || `HTTP ${res.status}`)
|
|
890
|
+
throw new Error((json && (json.error || json.message)) || `HTTP ${res.status}`)
|
|
430
891
|
}
|
|
431
|
-
|
|
892
|
+
const msg = typeof successMsgBuilder === 'function' ? successMsgBuilder(json) : ''
|
|
893
|
+
patch({ busyKey: '', notice: msg || '' })
|
|
894
|
+
await fetchOverview(true)
|
|
895
|
+
return json
|
|
432
896
|
} catch (err) {
|
|
433
|
-
patch({
|
|
434
|
-
|
|
435
|
-
|
|
897
|
+
patch({
|
|
898
|
+
busyKey: '',
|
|
899
|
+
error: err && err.message ? String(err.message) : 'Action failed',
|
|
900
|
+
})
|
|
901
|
+
return null
|
|
436
902
|
}
|
|
437
903
|
}
|
|
438
904
|
|
|
439
|
-
function
|
|
440
|
-
|
|
441
|
-
const d = new Date(value)
|
|
442
|
-
if (Number.isNaN(d.getTime())) return String(value)
|
|
443
|
-
const p = (n) => String(n).padStart(2, '0')
|
|
444
|
-
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`
|
|
905
|
+
async function launchGuardDesktop() {
|
|
906
|
+
await postAction('/open', {}, 'open-desktop', (json) => json.message || '')
|
|
445
907
|
}
|
|
446
908
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
const size = props && typeof props.size === 'number' && props.size > 0 ? props.size : 17
|
|
450
|
-
const active = Boolean(props && props.active)
|
|
909
|
+
function SvgIcon(props) {
|
|
910
|
+
const size = props.size || 15
|
|
451
911
|
return h(
|
|
452
912
|
'svg',
|
|
453
913
|
{
|
|
@@ -456,16 +916,78 @@ window.__ModuleLoader__.load({
|
|
|
456
916
|
viewBox: '0 0 24 24',
|
|
457
917
|
fill: 'none',
|
|
458
918
|
stroke: 'currentColor',
|
|
459
|
-
strokeWidth:
|
|
919
|
+
strokeWidth: 2,
|
|
460
920
|
strokeLinecap: 'round',
|
|
461
921
|
strokeLinejoin: 'round',
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
style: { display: 'block' },
|
|
922
|
+
className: props.className || undefined,
|
|
923
|
+
'aria-hidden': 'true',
|
|
465
924
|
},
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
925
|
+
props.children,
|
|
926
|
+
)
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
function GuardIcon(props) {
|
|
930
|
+
return h(
|
|
931
|
+
SvgIcon,
|
|
932
|
+
props,
|
|
933
|
+
h('path', { d: 'M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z' }),
|
|
934
|
+
h('path', { d: 'm9 12 2 2 4-4' }),
|
|
935
|
+
)
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
function RefreshIcon(props) {
|
|
939
|
+
return h(
|
|
940
|
+
SvgIcon,
|
|
941
|
+
props,
|
|
942
|
+
h('path', { d: 'M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8' }),
|
|
943
|
+
h('path', { d: 'M3 3v5h5' }),
|
|
944
|
+
h('path', { d: 'M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16' }),
|
|
945
|
+
h('path', { d: 'M16 16h5v5' }),
|
|
946
|
+
)
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
function SearchIcon(props) {
|
|
950
|
+
return h(
|
|
951
|
+
SvgIcon,
|
|
952
|
+
props,
|
|
953
|
+
h('circle', { cx: 11, cy: 11, r: 7 }),
|
|
954
|
+
h('path', { d: 'm20 20-3.5-3.5' }),
|
|
955
|
+
)
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
function ChevronIcon(props) {
|
|
959
|
+
return h(
|
|
960
|
+
SvgIcon,
|
|
961
|
+
{ size: props.size || 13 },
|
|
962
|
+
h('path', { d: 'm6 9 6 6 6-6' }),
|
|
963
|
+
)
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
function ExternalIcon(props) {
|
|
967
|
+
return h(
|
|
968
|
+
SvgIcon,
|
|
969
|
+
props,
|
|
970
|
+
h('path', { d: 'M15 3h6v6' }),
|
|
971
|
+
h('path', { d: 'M10 14 21 3' }),
|
|
972
|
+
h('path', { d: 'M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6' }),
|
|
973
|
+
)
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
function CheckCircleIcon(props) {
|
|
977
|
+
return h(
|
|
978
|
+
SvgIcon,
|
|
979
|
+
props,
|
|
980
|
+
h('circle', { cx: 12, cy: 12, r: 9 }),
|
|
981
|
+
h('path', { d: 'm9 12 2 2 4-4' }),
|
|
982
|
+
)
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
function LockIcon(props) {
|
|
986
|
+
return h(
|
|
987
|
+
SvgIcon,
|
|
988
|
+
props,
|
|
989
|
+
h('rect', { x: 4, y: 11, width: 16, height: 10, rx: 2 }),
|
|
990
|
+
h('path', { d: 'M7 11V7a5 5 0 0 1 10 0v4' }),
|
|
469
991
|
)
|
|
470
992
|
}
|
|
471
993
|
|
|
@@ -479,30 +1001,13 @@ window.__ModuleLoader__.load({
|
|
|
479
1001
|
}
|
|
480
1002
|
render() {
|
|
481
1003
|
if (this.state.error) {
|
|
482
|
-
const t = COPY[store.lang] || COPY.zh
|
|
483
1004
|
return h(
|
|
484
1005
|
'div',
|
|
485
|
-
{ className: 'dshg-
|
|
1006
|
+
{ className: 'dshg-wrap' },
|
|
486
1007
|
h(
|
|
487
1008
|
'div',
|
|
488
|
-
{ className: 'dshg-
|
|
489
|
-
|
|
490
|
-
h(
|
|
491
|
-
'div',
|
|
492
|
-
{ style: { fontSize: 11.5, color: 'var(--dshg-text-2)' } },
|
|
493
|
-
String((this.state.error && this.state.error.message) || this.state.error),
|
|
494
|
-
),
|
|
495
|
-
h(
|
|
496
|
-
'button',
|
|
497
|
-
{
|
|
498
|
-
className: 'dshg-btn',
|
|
499
|
-
onClick: () => {
|
|
500
|
-
this.setState({ error: null })
|
|
501
|
-
void fetchOverview()
|
|
502
|
-
},
|
|
503
|
-
},
|
|
504
|
-
t.retry,
|
|
505
|
-
),
|
|
1009
|
+
{ className: 'dshg-error' },
|
|
1010
|
+
`DSH Companion Error: ${String(this.state.error.message || this.state.error)}`,
|
|
506
1011
|
),
|
|
507
1012
|
)
|
|
508
1013
|
}
|
|
@@ -510,292 +1015,1015 @@ window.__ModuleLoader__.load({
|
|
|
510
1015
|
}
|
|
511
1016
|
}
|
|
512
1017
|
|
|
513
|
-
function
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
)
|
|
1018
|
+
function formatTimeShort(value) {
|
|
1019
|
+
if (!value) return '--'
|
|
1020
|
+
try {
|
|
1021
|
+
const d = typeof value === 'number' ? new Date(value) : new Date(String(value))
|
|
1022
|
+
if (Number.isNaN(d.getTime())) return String(value).slice(0, 16)
|
|
1023
|
+
const now = new Date()
|
|
1024
|
+
const sameDay =
|
|
1025
|
+
d.getFullYear() === now.getFullYear() &&
|
|
1026
|
+
d.getMonth() === now.getMonth() &&
|
|
1027
|
+
d.getDate() === now.getDate()
|
|
1028
|
+
const hh = String(d.getHours()).padStart(2, '0')
|
|
1029
|
+
const mm = String(d.getMinutes()).padStart(2, '0')
|
|
1030
|
+
if (sameDay) return `${hh}:${mm}`
|
|
1031
|
+
return `${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')} ${hh}:${mm}`
|
|
1032
|
+
} catch {
|
|
1033
|
+
return String(value).slice(0, 16)
|
|
529
1034
|
}
|
|
1035
|
+
}
|
|
530
1036
|
|
|
531
|
-
|
|
532
|
-
const
|
|
533
|
-
? t.patchMissing
|
|
534
|
-
: patch.syntaxOk
|
|
535
|
-
? t.patchOk(patch.disabledCount || 0)
|
|
536
|
-
: t.patchErr(patch.error || 'YAML')
|
|
537
|
-
const patchTone = patch.exists && !patch.syntaxOk ? 'warn' : 'ok'
|
|
538
|
-
|
|
1037
|
+
function BoundaryDisclosure(props) {
|
|
1038
|
+
const { summary, p1, p2, isWin, installerUrl, releaseUrl, t } = props
|
|
539
1039
|
return h(
|
|
540
|
-
'
|
|
541
|
-
{ className: 'dshg-
|
|
1040
|
+
'details',
|
|
1041
|
+
{ className: 'dshg-boundary' },
|
|
1042
|
+
h(
|
|
1043
|
+
'summary',
|
|
1044
|
+
null,
|
|
1045
|
+
h('span', null, summary),
|
|
1046
|
+
h(ChevronIcon, { size: 13 }),
|
|
1047
|
+
),
|
|
542
1048
|
h(
|
|
543
1049
|
'div',
|
|
544
|
-
{ className: 'dshg-
|
|
545
|
-
h('
|
|
546
|
-
h(
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
1050
|
+
{ className: 'dshg-boundary-body' },
|
|
1051
|
+
h('div', null, p1),
|
|
1052
|
+
h('div', null, p2),
|
|
1053
|
+
isWin
|
|
1054
|
+
? h(
|
|
1055
|
+
'div',
|
|
1056
|
+
{ className: 'dshg-boundary-links' },
|
|
1057
|
+
h(
|
|
1058
|
+
'a',
|
|
1059
|
+
{ href: installerUrl, target: '_blank', rel: 'noopener noreferrer' },
|
|
1060
|
+
t.desktopWinLink,
|
|
1061
|
+
),
|
|
1062
|
+
h(
|
|
1063
|
+
'a',
|
|
1064
|
+
{ href: releaseUrl, target: '_blank', rel: 'noopener noreferrer' },
|
|
1065
|
+
t.desktopReleaseLink,
|
|
1066
|
+
),
|
|
1067
|
+
)
|
|
1068
|
+
: h('div', { style: { opacity: 0.85 } }, t.desktopNonWinNote),
|
|
551
1069
|
),
|
|
552
|
-
h('div', { className: 'dshg-badge', 'data-tone': patchTone }, patchText),
|
|
553
|
-
!profile.packageJsonOk
|
|
554
|
-
? h('div', { style: { fontSize: 11, color: '#f59e0b' } }, t.pkgErr)
|
|
555
|
-
: null,
|
|
556
|
-
Array.isArray(profile.missingInDeps) && profile.missingInDeps.length > 0
|
|
557
|
-
? h(
|
|
558
|
-
'div',
|
|
559
|
-
{ className: 'dshg-pills' },
|
|
560
|
-
h('span', { style: { fontSize: 10.5, color: '#f59e0b' } }, `${t.missingInDeps}:`),
|
|
561
|
-
...profile.missingInDeps.map((pkg) => h('span', { key: pkg, className: 'dshg-pill', 'data-tone': 'warn' }, pkg)),
|
|
562
|
-
)
|
|
563
|
-
: null,
|
|
564
|
-
Array.isArray(profile.unregisteredDeps) && profile.unregisteredDeps.length > 0
|
|
565
|
-
? h(
|
|
566
|
-
'div',
|
|
567
|
-
{ className: 'dshg-pills' },
|
|
568
|
-
h('span', { style: { fontSize: 10.5, color: '#f59e0b' } }, `${t.unregisteredDeps}:`),
|
|
569
|
-
...profile.unregisteredDeps.map((pkg) => h('span', { key: pkg, className: 'dshg-pill', 'data-tone': 'warn' }, pkg)),
|
|
570
|
-
)
|
|
571
|
-
: null,
|
|
572
1070
|
)
|
|
573
1071
|
}
|
|
574
1072
|
|
|
575
|
-
function
|
|
576
|
-
const
|
|
577
|
-
|
|
1073
|
+
function ToggleSwitch(props) {
|
|
1074
|
+
const { on, disabled, busy, onToggle, title } = props
|
|
1075
|
+
return h(
|
|
1076
|
+
'button',
|
|
1077
|
+
{
|
|
1078
|
+
type: 'button',
|
|
1079
|
+
role: 'switch',
|
|
1080
|
+
'aria-checked': Boolean(on),
|
|
1081
|
+
'aria-label': title,
|
|
1082
|
+
className: 'dshg-switch',
|
|
1083
|
+
'data-on': Boolean(on) ? 'true' : 'false',
|
|
1084
|
+
disabled: Boolean(disabled || busy),
|
|
1085
|
+
onClick: onToggle,
|
|
1086
|
+
},
|
|
1087
|
+
h('span', { className: 'dshg-switch-thumb' }),
|
|
1088
|
+
)
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
function GuardPanelInner(props) {
|
|
1092
|
+
ensureStyles()
|
|
1093
|
+
const state = useStore()
|
|
1094
|
+
const t = COPY[state.lang] || COPY.zh
|
|
578
1095
|
|
|
579
1096
|
React.useEffect(() => {
|
|
580
|
-
ensureStyles()
|
|
581
1097
|
if (!store.data && !store.loading) {
|
|
582
|
-
|
|
1098
|
+
fetchOverview(false)
|
|
583
1099
|
}
|
|
584
1100
|
}, [])
|
|
585
1101
|
|
|
586
|
-
const data =
|
|
587
|
-
const health = data && data.health
|
|
588
|
-
const snapshots = data && data.snapshots
|
|
589
|
-
const
|
|
590
|
-
const
|
|
591
|
-
const
|
|
592
|
-
const
|
|
593
|
-
const
|
|
594
|
-
const snapList = snapshots && Array.isArray(snapshots.snapshots) ? snapshots.snapshots : []
|
|
1102
|
+
const data = state.data
|
|
1103
|
+
const health = (data && data.health) || null
|
|
1104
|
+
const snapshots = (data && data.snapshots) || (health && health.snapshots) || { total: 0, snapshots: [] }
|
|
1105
|
+
const guard = (health && health.guard) || { installed: false }
|
|
1106
|
+
const isWin = ((data && data.platform) || (health && health.platform) || '') === 'win32'
|
|
1107
|
+
const installerUrl = (data && data.installerUrl) || INSTALLER_FALLBACK
|
|
1108
|
+
const releaseUrl = (data && data.releaseUrl) || RELEASE_FALLBACK
|
|
1109
|
+
const repoUrl = (data && data.repoUrl) || REPO_FALLBACK
|
|
595
1110
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
1111
|
+
const webProfile = (health && health.profiles && health.profiles.web) || {
|
|
1112
|
+
exists: false, totalDependencies: 0, thirdPartyCount: 0, mcpCount: 0, disabledEntryCount: 0, brokenLinkCount: 0,
|
|
1113
|
+
}
|
|
1114
|
+
const deskProfile = (health && health.profiles && health.profiles.desktop) || {
|
|
1115
|
+
exists: false, totalDependencies: 0, thirdPartyCount: 0, mcpCount: 0, disabledEntryCount: 0, brokenLinkCount: 0,
|
|
1116
|
+
}
|
|
1117
|
+
const credentials = (health && health.credentials) || { present: false, count: 0, keys: [] }
|
|
1118
|
+
const providers = Array.isArray(health && health.providers) ? health.providers : []
|
|
1119
|
+
const issues = Array.isArray(health && health.issues) ? health.issues : []
|
|
1120
|
+
const healthy = health ? Boolean(health.healthy) : true
|
|
1121
|
+
|
|
1122
|
+
const activeExtProfile = state.pluginProfile === 'desktop' ? 'desktop' : 'web'
|
|
1123
|
+
const extTrack = (health && health.extensions && health.extensions[activeExtProfile]) || {
|
|
1124
|
+
plugins: [], mcpServers: [],
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
const query = state.search.trim().toLowerCase()
|
|
1128
|
+
const filteredMcps = extTrack.mcpServers.filter((m) =>
|
|
1129
|
+
!query ||
|
|
1130
|
+
String(m.serverName || '').toLowerCase().includes(query) ||
|
|
1131
|
+
String(m.id || '').toLowerCase().includes(query),
|
|
1132
|
+
)
|
|
1133
|
+
const filteredPlugins = extTrack.plugins.filter((p) =>
|
|
1134
|
+
!query ||
|
|
1135
|
+
String(p.name || '').toLowerCase().includes(query) ||
|
|
1136
|
+
String(p.primaryId || '').toLowerCase().includes(query),
|
|
1137
|
+
)
|
|
1138
|
+
|
|
1139
|
+
const totalExtCount = (webProfile.thirdPartyCount || 0) + (webProfile.mcpCount || 0)
|
|
1140
|
+
const credsSummaryVal = `${credentials.count || 0} / ${providers.length}`
|
|
1141
|
+
const totalBrokenLinks = (webProfile.brokenLinkCount || 0) + (deskProfile.brokenLinkCount || 0)
|
|
1142
|
+
|
|
1143
|
+
const renderOverviewTab = () =>
|
|
600
1144
|
h(
|
|
601
1145
|
'div',
|
|
602
|
-
{ className: 'dshg-
|
|
1146
|
+
{ className: 'dshg-tab-body' },
|
|
1147
|
+
totalBrokenLinks > 0
|
|
1148
|
+
? h(
|
|
1149
|
+
'div',
|
|
1150
|
+
{ className: 'dshg-card', style: { borderColor: 'var(--dshg-warn-border)' } },
|
|
1151
|
+
h(
|
|
1152
|
+
'div',
|
|
1153
|
+
{ className: 'dshg-sec-head' },
|
|
1154
|
+
h('span', null, `${t.brokenLabel} (${totalBrokenLinks})`),
|
|
1155
|
+
h(
|
|
1156
|
+
'div',
|
|
1157
|
+
{ className: 'dshg-actions' },
|
|
1158
|
+
webProfile.brokenLinkCount > 0
|
|
1159
|
+
? h(
|
|
1160
|
+
'button',
|
|
1161
|
+
{
|
|
1162
|
+
type: 'button',
|
|
1163
|
+
className: 'dshg-btn dshg-btn-primary dshg-btn-sm',
|
|
1164
|
+
disabled: Boolean(state.busyKey),
|
|
1165
|
+
onClick: () =>
|
|
1166
|
+
postAction(
|
|
1167
|
+
'/repair-links',
|
|
1168
|
+
{ target: 'web' },
|
|
1169
|
+
'repair-web',
|
|
1170
|
+
(res) => `Web 断链处理完成:修复 ${res.repairedCount},未解析 ${res.unresolvableCount}`,
|
|
1171
|
+
),
|
|
1172
|
+
},
|
|
1173
|
+
state.busyKey === 'repair-web' ? t.repairingBtn : `${t.repairLinksBtn} (Web)`,
|
|
1174
|
+
)
|
|
1175
|
+
: null,
|
|
1176
|
+
deskProfile.brokenLinkCount > 0
|
|
1177
|
+
? h(
|
|
1178
|
+
'button',
|
|
1179
|
+
{
|
|
1180
|
+
type: 'button',
|
|
1181
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
1182
|
+
disabled: Boolean(state.busyKey),
|
|
1183
|
+
onClick: () =>
|
|
1184
|
+
postAction(
|
|
1185
|
+
'/repair-links',
|
|
1186
|
+
{ target: 'desktop' },
|
|
1187
|
+
'repair-desk',
|
|
1188
|
+
(res) => `桌面端断链处理完成:修复 ${res.repairedCount},未解析 ${res.unresolvableCount}`,
|
|
1189
|
+
),
|
|
1190
|
+
},
|
|
1191
|
+
state.busyKey === 'repair-desk' ? t.repairingBtn : `${t.repairLinksBtn} (Desktop)`,
|
|
1192
|
+
)
|
|
1193
|
+
: null,
|
|
1194
|
+
),
|
|
1195
|
+
),
|
|
1196
|
+
h(
|
|
1197
|
+
'div',
|
|
1198
|
+
{ className: 'dshg-pills' },
|
|
1199
|
+
...[...(webProfile.brokenLinks || []), ...(deskProfile.brokenLinks || [])].map((b, i) =>
|
|
1200
|
+
h('span', { key: `${b.name}-${i}`, className: 'dshg-pill' }, b.name),
|
|
1201
|
+
),
|
|
1202
|
+
),
|
|
1203
|
+
)
|
|
1204
|
+
: null,
|
|
1205
|
+
|
|
603
1206
|
h(
|
|
604
1207
|
'div',
|
|
605
|
-
{ className: 'dshg-
|
|
1208
|
+
{ className: 'dshg-card' },
|
|
606
1209
|
h(
|
|
607
1210
|
'div',
|
|
608
|
-
{ className: 'dshg-
|
|
609
|
-
h('
|
|
610
|
-
h(
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
1211
|
+
{ className: 'dshg-sec-head' },
|
|
1212
|
+
h('span', null, t.secProfiles),
|
|
1213
|
+
h('span', { className: 'dshg-badge', 'data-tone': healthy ? 'ok' : 'warn' }, healthy ? t.healthy : t.unhealthy(issues.length)),
|
|
1214
|
+
),
|
|
1215
|
+
h(
|
|
1216
|
+
'div',
|
|
1217
|
+
{ className: 'dshg-profile-grid' },
|
|
1218
|
+
...[
|
|
1219
|
+
{ label: t.webTrack, p: webProfile },
|
|
1220
|
+
{ label: t.desktopTrack, p: deskProfile },
|
|
1221
|
+
].map(({ label, p }) =>
|
|
1222
|
+
h(
|
|
1223
|
+
'div',
|
|
1224
|
+
{ key: label, className: 'dshg-subcard' },
|
|
1225
|
+
h(
|
|
1226
|
+
'div',
|
|
1227
|
+
{ className: 'dshg-row' },
|
|
1228
|
+
h('strong', null, label),
|
|
1229
|
+
h('span', { className: 'dshg-badge', 'data-tone': p.exists ? 'ok' : 'muted' }, p.exists ? t.present : t.absent),
|
|
1230
|
+
),
|
|
1231
|
+
h('div', { className: 'dshg-row' }, h('span', { style: { color: 'var(--dshg-text-3)' } }, t.depsLabel), h('span', { className: 'dshg-mono' }, String(p.totalDependencies))),
|
|
1232
|
+
h('div', { className: 'dshg-row' }, h('span', { style: { color: 'var(--dshg-text-3)' } }, t.thirdPartyLabel), h('span', { className: 'dshg-mono' }, String(p.thirdPartyCount))),
|
|
1233
|
+
h('div', { className: 'dshg-row' }, h('span', { style: { color: 'var(--dshg-text-3)' } }, t.mcpLabel), h('span', { className: 'dshg-mono' }, String(p.mcpCount || 0))),
|
|
1234
|
+
h('div', { className: 'dshg-row' }, h('span', { style: { color: 'var(--dshg-text-3)' } }, t.disabledLabel), h('span', { className: 'dshg-mono' }, String(p.disabledEntryCount || 0))),
|
|
1235
|
+
),
|
|
615
1236
|
),
|
|
616
1237
|
),
|
|
1238
|
+
),
|
|
1239
|
+
|
|
1240
|
+
issues.length > 0
|
|
1241
|
+
? h(
|
|
1242
|
+
'div',
|
|
1243
|
+
{ className: 'dshg-card' },
|
|
1244
|
+
h('div', { className: 'dshg-sec-head' }, h('span', null, t.warningsTitle)),
|
|
1245
|
+
h(
|
|
1246
|
+
'div',
|
|
1247
|
+
{ className: 'dshg-list' },
|
|
1248
|
+
...issues.map((msg, idx) =>
|
|
1249
|
+
h('div', { key: idx, className: 'dshg-item', style: { fontSize: 11.5 } }, msg),
|
|
1250
|
+
),
|
|
1251
|
+
),
|
|
1252
|
+
)
|
|
1253
|
+
: h(
|
|
1254
|
+
'div',
|
|
1255
|
+
{ className: 'dshg-card' },
|
|
1256
|
+
h(
|
|
1257
|
+
'div',
|
|
1258
|
+
{ className: 'dshg-item-row' },
|
|
1259
|
+
h(
|
|
1260
|
+
'div',
|
|
1261
|
+
{ className: 'dshg-item-main' },
|
|
1262
|
+
h(
|
|
1263
|
+
'div',
|
|
1264
|
+
{ className: 'dshg-item-title' },
|
|
1265
|
+
h(CheckCircleIcon, { size: 14, className: undefined }),
|
|
1266
|
+
h('span', null, t.allHealthyTitle),
|
|
1267
|
+
),
|
|
1268
|
+
h('div', { className: 'dshg-sec-sub' }, t.allHealthySub),
|
|
1269
|
+
),
|
|
1270
|
+
),
|
|
1271
|
+
h(
|
|
1272
|
+
'div',
|
|
1273
|
+
{ className: 'dshg-actions', style: { flexWrap: 'wrap' } },
|
|
1274
|
+
h(
|
|
1275
|
+
'button',
|
|
1276
|
+
{
|
|
1277
|
+
type: 'button',
|
|
1278
|
+
className: 'dshg-btn dshg-btn-primary dshg-btn-sm',
|
|
1279
|
+
disabled: Boolean(state.busyKey),
|
|
1280
|
+
onClick: () =>
|
|
1281
|
+
postAction(
|
|
1282
|
+
'/snapshots/create',
|
|
1283
|
+
{ target: 'web', reason: '总览快捷备份' },
|
|
1284
|
+
'quick-snap',
|
|
1285
|
+
(res) => `已创建快照 ${res.snapshot.id}`,
|
|
1286
|
+
),
|
|
1287
|
+
},
|
|
1288
|
+
state.busyKey === 'quick-snap' ? t.snapCreating : t.quickSnapWeb,
|
|
1289
|
+
),
|
|
1290
|
+
h(
|
|
1291
|
+
'button',
|
|
1292
|
+
{
|
|
1293
|
+
type: 'button',
|
|
1294
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
1295
|
+
onClick: () => patch({ tab: 'plugins' }),
|
|
1296
|
+
},
|
|
1297
|
+
t.quickGoPlugins,
|
|
1298
|
+
),
|
|
1299
|
+
),
|
|
1300
|
+
),
|
|
1301
|
+
)
|
|
1302
|
+
|
|
1303
|
+
const renderPluginsTab = () =>
|
|
1304
|
+
h(
|
|
1305
|
+
'div',
|
|
1306
|
+
{ className: 'dshg-tab-body' },
|
|
1307
|
+
h(
|
|
1308
|
+
'div',
|
|
1309
|
+
{ className: 'dshg-toolbar' },
|
|
617
1310
|
h(
|
|
618
1311
|
'div',
|
|
619
|
-
{ className: 'dshg-
|
|
1312
|
+
{ className: 'dshg-seg-2' },
|
|
620
1313
|
h(
|
|
621
1314
|
'button',
|
|
622
1315
|
{
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
1316
|
+
type: 'button',
|
|
1317
|
+
className: 'dshg-seg-btn',
|
|
1318
|
+
'data-active': activeExtProfile === 'web' ? 'true' : 'false',
|
|
1319
|
+
onClick: () => patch({ pluginProfile: 'web' }),
|
|
626
1320
|
},
|
|
627
|
-
|
|
1321
|
+
t.webTrack,
|
|
628
1322
|
),
|
|
629
1323
|
h(
|
|
630
1324
|
'button',
|
|
631
1325
|
{
|
|
632
|
-
|
|
633
|
-
|
|
1326
|
+
type: 'button',
|
|
1327
|
+
className: 'dshg-seg-btn',
|
|
1328
|
+
'data-active': activeExtProfile === 'desktop' ? 'true' : 'false',
|
|
1329
|
+
onClick: () => patch({ pluginProfile: 'desktop' }),
|
|
634
1330
|
},
|
|
635
|
-
t.
|
|
1331
|
+
t.desktopTrack,
|
|
636
1332
|
),
|
|
637
1333
|
),
|
|
1334
|
+
h(
|
|
1335
|
+
'div',
|
|
1336
|
+
{ className: 'dshg-search-wrap' },
|
|
1337
|
+
h('span', { className: 'dshg-search-ico' }, h(SearchIcon, { size: 13 })),
|
|
1338
|
+
h('input', {
|
|
1339
|
+
type: 'search',
|
|
1340
|
+
className: 'dshg-input with-ico',
|
|
1341
|
+
value: state.search,
|
|
1342
|
+
placeholder: t.searchPlaceholder,
|
|
1343
|
+
onChange: (e) => patch({ search: e.target.value }),
|
|
1344
|
+
}),
|
|
1345
|
+
),
|
|
638
1346
|
),
|
|
639
|
-
health
|
|
640
|
-
? h(
|
|
641
|
-
'div',
|
|
642
|
-
{ className: 'dshg-row' },
|
|
643
|
-
h(
|
|
644
|
-
'span',
|
|
645
|
-
{ className: 'dshg-badge', 'data-tone': health.healthy ? 'ok' : 'warn' },
|
|
646
|
-
health.healthy ? `✓ ${t.healthy}` : `⚠ ${t.unhealthy(health.issuesCount || 0)}`,
|
|
647
|
-
),
|
|
648
|
-
snap.checkedAt
|
|
649
|
-
? h('span', { style: { fontSize: 10.5, color: 'var(--dshg-text-3)' } }, t.checkedAt(formatShortTime(snap.checkedAt)))
|
|
650
|
-
: null,
|
|
651
|
-
)
|
|
652
|
-
: null,
|
|
653
|
-
),
|
|
654
|
-
|
|
655
|
-
snap.error ? h('div', { className: 'dshg-error' }, snap.error) : null,
|
|
656
|
-
snap.notice ? h('div', { className: 'dshg-notice' }, snap.notice) : null,
|
|
657
1347
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
1348
|
+
h(
|
|
1349
|
+
'div',
|
|
1350
|
+
{ className: 'dshg-card' },
|
|
1351
|
+
h(
|
|
1352
|
+
'div',
|
|
1353
|
+
{ className: 'dshg-sec-head' },
|
|
1354
|
+
h('span', null, t.mcpSectionTitle),
|
|
1355
|
+
h('span', { className: 'dshg-badge', 'data-tone': 'blue' }, String(filteredMcps.length)),
|
|
1356
|
+
),
|
|
1357
|
+
filteredMcps.length > 0
|
|
1358
|
+
? h(
|
|
1359
|
+
'div',
|
|
1360
|
+
{ className: 'dshg-list' },
|
|
1361
|
+
...filteredMcps.map((m) =>
|
|
1362
|
+
h(
|
|
1363
|
+
'div',
|
|
1364
|
+
{ key: m.id, className: 'dshg-item' },
|
|
1365
|
+
h(
|
|
1366
|
+
'div',
|
|
1367
|
+
{ className: 'dshg-item-row' },
|
|
1368
|
+
h(
|
|
1369
|
+
'div',
|
|
1370
|
+
{ className: 'dshg-item-main' },
|
|
1371
|
+
h(
|
|
1372
|
+
'div',
|
|
1373
|
+
{ className: 'dshg-item-title' },
|
|
1374
|
+
h('span', null, m.serverName),
|
|
1375
|
+
h('span', { className: 'dshg-pill' }, m.transport),
|
|
1376
|
+
),
|
|
1377
|
+
h('div', { className: 'dshg-mono' }, m.command || m.url || m.id),
|
|
1378
|
+
),
|
|
1379
|
+
h(ToggleSwitch, {
|
|
1380
|
+
on: m.enabled,
|
|
1381
|
+
busy: state.busyKey === `toggle-${m.id}`,
|
|
1382
|
+
title: m.serverName,
|
|
1383
|
+
onToggle: () =>
|
|
1384
|
+
postAction(
|
|
1385
|
+
'/toggle-entry',
|
|
1386
|
+
{ target: activeExtProfile, id: m.id, disabled: m.enabled },
|
|
1387
|
+
`toggle-${m.id}`,
|
|
1388
|
+
(res) => res.restartHint,
|
|
1389
|
+
),
|
|
1390
|
+
}),
|
|
1391
|
+
),
|
|
1392
|
+
),
|
|
1393
|
+
),
|
|
1394
|
+
)
|
|
1395
|
+
: h('div', { className: 'dshg-sec-sub' }, t.mcpEmpty),
|
|
1396
|
+
),
|
|
661
1397
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
1398
|
+
h(
|
|
1399
|
+
'div',
|
|
1400
|
+
{ className: 'dshg-card' },
|
|
1401
|
+
h(
|
|
665
1402
|
'div',
|
|
666
|
-
{ className: 'dshg-
|
|
667
|
-
h('
|
|
668
|
-
h(
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
1403
|
+
{ className: 'dshg-sec-head' },
|
|
1404
|
+
h('span', null, t.pluginsSectionTitle),
|
|
1405
|
+
h('span', { className: 'dshg-badge', 'data-tone': 'muted' }, t.badgeAllCount(filteredPlugins.length, extTrack.plugins.length)),
|
|
1406
|
+
),
|
|
1407
|
+
filteredPlugins.length > 0
|
|
1408
|
+
? h(
|
|
1409
|
+
'div',
|
|
1410
|
+
{ className: 'dshg-list' },
|
|
1411
|
+
...filteredPlugins.map((p) =>
|
|
1412
|
+
h(
|
|
1413
|
+
'div',
|
|
1414
|
+
{ key: p.name, className: 'dshg-item' },
|
|
1415
|
+
h(
|
|
1416
|
+
'div',
|
|
1417
|
+
{ className: 'dshg-item-row' },
|
|
1418
|
+
h(
|
|
1419
|
+
'div',
|
|
1420
|
+
{ className: 'dshg-item-main' },
|
|
1421
|
+
h(
|
|
1422
|
+
'div',
|
|
1423
|
+
{ className: 'dshg-item-title' },
|
|
1424
|
+
h('span', null, p.name),
|
|
1425
|
+
p.isSelf
|
|
1426
|
+
? h('span', { className: 'dshg-badge', 'data-tone': 'blue' }, t.badgeSelf)
|
|
1427
|
+
: p.isCore
|
|
1428
|
+
? h('span', { className: 'dshg-badge', 'data-tone': 'muted' }, t.badgeCore)
|
|
1429
|
+
: h('span', { className: 'dshg-badge', 'data-tone': p.enabled ? 'ok' : 'warn' }, p.enabled ? t.badgeEnabled : t.badgeDisabled),
|
|
1430
|
+
),
|
|
1431
|
+
h('div', { className: 'dshg-mono' }, `${p.primaryId}${p.version ? ` · v${p.version}` : ''}`),
|
|
1432
|
+
),
|
|
1433
|
+
h(ToggleSwitch, {
|
|
1434
|
+
on: p.enabled,
|
|
1435
|
+
disabled: !p.canToggle,
|
|
1436
|
+
busy: state.busyKey === `toggle-${p.primaryId}`,
|
|
1437
|
+
title: p.name,
|
|
1438
|
+
onToggle: () =>
|
|
1439
|
+
postAction(
|
|
1440
|
+
'/toggle-entry',
|
|
1441
|
+
{ target: activeExtProfile, id: p.primaryId, disabled: p.enabled },
|
|
1442
|
+
`toggle-${p.primaryId}`,
|
|
1443
|
+
(res) => res.restartHint,
|
|
1444
|
+
),
|
|
1445
|
+
}),
|
|
1446
|
+
),
|
|
1447
|
+
),
|
|
1448
|
+
),
|
|
1449
|
+
)
|
|
1450
|
+
: h('div', { className: 'dshg-sec-sub' }, t.pluginsEmpty),
|
|
1451
|
+
),
|
|
675
1452
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
1453
|
+
h(BoundaryDisclosure, {
|
|
1454
|
+
summary: t.boundaryPluginsSummary,
|
|
1455
|
+
p1: t.boundaryPluginsP1,
|
|
1456
|
+
p2: t.boundaryPluginsP2,
|
|
1457
|
+
isWin,
|
|
1458
|
+
installerUrl,
|
|
1459
|
+
releaseUrl,
|
|
1460
|
+
t,
|
|
1461
|
+
}),
|
|
1462
|
+
)
|
|
1463
|
+
|
|
1464
|
+
const renderCredsTab = () =>
|
|
1465
|
+
h(
|
|
1466
|
+
'div',
|
|
1467
|
+
{ className: 'dshg-tab-body' },
|
|
1468
|
+
h(
|
|
1469
|
+
'div',
|
|
1470
|
+
{ className: 'dshg-card' },
|
|
1471
|
+
h(
|
|
679
1472
|
'div',
|
|
680
|
-
{ className: 'dshg-
|
|
681
|
-
h('
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
1473
|
+
{ className: 'dshg-sec-head' },
|
|
1474
|
+
h('span', null, t.providersTitle),
|
|
1475
|
+
h('span', { className: 'dshg-badge', 'data-tone': 'blue' }, String(providers.length)),
|
|
1476
|
+
),
|
|
1477
|
+
providers.length > 0
|
|
1478
|
+
? h(
|
|
1479
|
+
'div',
|
|
1480
|
+
{ className: 'dshg-list' },
|
|
1481
|
+
...providers.map((prov) => {
|
|
1482
|
+
const editingThis = Boolean(prov.apiKeyEnv && state.editProviderKey === prov.id)
|
|
1483
|
+
return h(
|
|
1484
|
+
'div',
|
|
1485
|
+
{ key: prov.id, className: 'dshg-item' },
|
|
1486
|
+
h(
|
|
1487
|
+
'div',
|
|
1488
|
+
{ className: 'dshg-item-row' },
|
|
1489
|
+
h(
|
|
1490
|
+
'div',
|
|
1491
|
+
{ className: 'dshg-item-main' },
|
|
1492
|
+
h(
|
|
1493
|
+
'div',
|
|
1494
|
+
{ className: 'dshg-item-title' },
|
|
1495
|
+
h('span', null, prov.displayName),
|
|
1496
|
+
h('span', { className: 'dshg-pill' }, prov.api),
|
|
1497
|
+
h('span', { className: 'dshg-pill' }, `${prov.models.length} ${t.modelsUnit}`),
|
|
1498
|
+
),
|
|
1499
|
+
prov.baseURL ? h('div', { className: 'dshg-mono' }, prov.baseURL) : null,
|
|
1500
|
+
h(
|
|
1501
|
+
'div',
|
|
1502
|
+
{ className: 'dshg-pills', style: { marginTop: 2 } },
|
|
1503
|
+
...(prov.profiles || []).map((pf) => h('span', { key: pf, className: 'dshg-pill' }, pf)),
|
|
1504
|
+
prov.apiKeyEnv
|
|
1505
|
+
? h('span', { className: 'dshg-badge', 'data-tone': prov.keyConfigured ? 'ok' : 'warn' }, `${prov.apiKeyEnv} · ${prov.keyConfigured ? t.keyReady : t.keyMissing}`)
|
|
1506
|
+
: null,
|
|
1507
|
+
),
|
|
1508
|
+
),
|
|
1509
|
+
prov.apiKeyEnv
|
|
1510
|
+
? h(
|
|
1511
|
+
'button',
|
|
1512
|
+
{
|
|
1513
|
+
type: 'button',
|
|
1514
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
1515
|
+
onClick: () =>
|
|
1516
|
+
patch({
|
|
1517
|
+
editProviderKey: editingThis ? '' : prov.id,
|
|
1518
|
+
draftSecret: '',
|
|
1519
|
+
}),
|
|
1520
|
+
},
|
|
1521
|
+
editingThis ? t.cancelBtn : prov.keyConfigured ? t.updateKeyBtn : t.setKeyBtn,
|
|
1522
|
+
)
|
|
1523
|
+
: null,
|
|
1524
|
+
),
|
|
1525
|
+
editingThis
|
|
1526
|
+
? h(
|
|
1527
|
+
'div',
|
|
1528
|
+
{ className: 'dshg-drawer' },
|
|
1529
|
+
h(
|
|
1530
|
+
'div',
|
|
1531
|
+
{ className: 'dshg-drawer-row' },
|
|
1532
|
+
h('input', {
|
|
1533
|
+
type: 'password',
|
|
1534
|
+
className: 'dshg-input',
|
|
1535
|
+
autoComplete: 'new-password',
|
|
1536
|
+
value: state.draftSecret,
|
|
1537
|
+
placeholder: t.keyPlaceholder,
|
|
1538
|
+
onChange: (e) => patch({ draftSecret: e.target.value }),
|
|
1539
|
+
}),
|
|
1540
|
+
h(
|
|
1541
|
+
'button',
|
|
1542
|
+
{
|
|
1543
|
+
type: 'button',
|
|
1544
|
+
className: 'dshg-btn dshg-btn-primary dshg-btn-sm',
|
|
1545
|
+
disabled: Boolean(state.busyKey || !state.draftSecret.trim()),
|
|
1546
|
+
onClick: async () => {
|
|
1547
|
+
const secret = state.draftSecret
|
|
1548
|
+
patch({ draftSecret: '' })
|
|
1549
|
+
const res = await postAction(
|
|
1550
|
+
'/credential-key',
|
|
1551
|
+
{ key: prov.apiKeyEnv, value: secret },
|
|
1552
|
+
`write-${prov.apiKeyEnv}`,
|
|
1553
|
+
(r) => `已将 ${r.key} 单向写入 .credentials.yaml(绝不回显)`,
|
|
1554
|
+
)
|
|
1555
|
+
if (res && res.ok) patch({ editProviderKey: '' })
|
|
1556
|
+
},
|
|
1557
|
+
},
|
|
1558
|
+
state.busyKey === `write-${prov.apiKeyEnv}` ? t.writingKeyBtn : t.writeKeyBtn,
|
|
1559
|
+
),
|
|
1560
|
+
),
|
|
1561
|
+
)
|
|
1562
|
+
: null,
|
|
1563
|
+
)
|
|
1564
|
+
}),
|
|
1565
|
+
)
|
|
1566
|
+
: h('div', { className: 'dshg-sec-sub' }, t.providersEmpty),
|
|
1567
|
+
),
|
|
687
1568
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
1569
|
+
h(
|
|
1570
|
+
'div',
|
|
1571
|
+
{ className: 'dshg-card' },
|
|
1572
|
+
h(
|
|
691
1573
|
'div',
|
|
692
|
-
{ className: 'dshg-
|
|
1574
|
+
{ className: 'dshg-sec-head' },
|
|
1575
|
+
h('span', null, t.credsAuditTitle),
|
|
693
1576
|
h(
|
|
694
|
-
'
|
|
695
|
-
{
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
'
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
? t.credReadyBadge(creds.nonEmptyKeysCount || 0, creds.totalKeysCount || 0)
|
|
702
|
-
: t.credMissingFile,
|
|
703
|
-
),
|
|
1577
|
+
'button',
|
|
1578
|
+
{
|
|
1579
|
+
type: 'button',
|
|
1580
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
1581
|
+
onClick: () => patch({ showAddKey: !state.showAddKey, newKeySecret: '' }),
|
|
1582
|
+
},
|
|
1583
|
+
state.showAddKey ? t.cancelBtn : t.addKeyToggle,
|
|
704
1584
|
),
|
|
705
|
-
|
|
706
|
-
|
|
1585
|
+
),
|
|
1586
|
+
h('div', { className: 'dshg-sec-sub' }, t.credsAuditSub),
|
|
1587
|
+
state.showAddKey
|
|
1588
|
+
? h(
|
|
1589
|
+
'div',
|
|
1590
|
+
{ className: 'dshg-drawer', style: { borderTop: 'none', paddingTop: 0 } },
|
|
1591
|
+
h('input', {
|
|
1592
|
+
type: 'text',
|
|
1593
|
+
className: 'dshg-input',
|
|
1594
|
+
value: state.newKeyName,
|
|
1595
|
+
placeholder: t.envNameLabel,
|
|
1596
|
+
onChange: (e) => patch({ newKeyName: e.target.value }),
|
|
1597
|
+
}),
|
|
1598
|
+
h(
|
|
707
1599
|
'div',
|
|
708
|
-
{ className: 'dshg-
|
|
709
|
-
|
|
1600
|
+
{ className: 'dshg-drawer-row' },
|
|
1601
|
+
h('input', {
|
|
1602
|
+
type: 'password',
|
|
1603
|
+
className: 'dshg-input',
|
|
1604
|
+
autoComplete: 'new-password',
|
|
1605
|
+
value: state.newKeySecret,
|
|
1606
|
+
placeholder: t.keyPlaceholder,
|
|
1607
|
+
onChange: (e) => patch({ newKeySecret: e.target.value }),
|
|
1608
|
+
}),
|
|
1609
|
+
h(
|
|
1610
|
+
'button',
|
|
1611
|
+
{
|
|
1612
|
+
type: 'button',
|
|
1613
|
+
className: 'dshg-btn dshg-btn-primary dshg-btn-sm',
|
|
1614
|
+
disabled: Boolean(state.busyKey || !state.newKeyName.trim() || !state.newKeySecret.trim()),
|
|
1615
|
+
onClick: async () => {
|
|
1616
|
+
const keyName = state.newKeyName.trim()
|
|
1617
|
+
const secret = state.newKeySecret
|
|
1618
|
+
patch({ newKeySecret: '' })
|
|
1619
|
+
const res = await postAction(
|
|
1620
|
+
'/credential-key',
|
|
1621
|
+
{ key: keyName, value: secret },
|
|
1622
|
+
'write-custom-key',
|
|
1623
|
+
(r) => `已将 ${r.key} 单向写入 .credentials.yaml(绝不回显)`,
|
|
1624
|
+
)
|
|
1625
|
+
if (res && res.ok) patch({ newKeyName: '', showAddKey: false })
|
|
1626
|
+
},
|
|
1627
|
+
},
|
|
1628
|
+
state.busyKey === 'write-custom-key' ? t.writingKeyBtn : t.writeKeyBtn,
|
|
1629
|
+
),
|
|
1630
|
+
),
|
|
1631
|
+
)
|
|
1632
|
+
: null,
|
|
1633
|
+
credentials.keys && credentials.keys.length > 0
|
|
1634
|
+
? h(
|
|
1635
|
+
'div',
|
|
1636
|
+
{ className: 'dshg-list' },
|
|
1637
|
+
...credentials.keys.map((k) =>
|
|
1638
|
+
h(
|
|
1639
|
+
'div',
|
|
1640
|
+
{ key: k.key, className: 'dshg-item', style: { padding: '6px 9px' } },
|
|
710
1641
|
h(
|
|
711
|
-
'
|
|
712
|
-
{
|
|
713
|
-
|
|
1642
|
+
'div',
|
|
1643
|
+
{ className: 'dshg-item-row' },
|
|
1644
|
+
h(
|
|
1645
|
+
'span',
|
|
1646
|
+
{
|
|
1647
|
+
className: 'dshg-mono',
|
|
1648
|
+
style: {
|
|
1649
|
+
color: 'var(--dshg-text)',
|
|
1650
|
+
fontWeight: 500,
|
|
1651
|
+
display: 'inline-flex',
|
|
1652
|
+
alignItems: 'center',
|
|
1653
|
+
gap: 5,
|
|
1654
|
+
},
|
|
1655
|
+
},
|
|
1656
|
+
k.protected ? h(LockIcon, { size: 12 }) : null,
|
|
1657
|
+
k.key,
|
|
1658
|
+
),
|
|
1659
|
+
k.protected
|
|
1660
|
+
? h('span', { className: 'dshg-badge', 'data-tone': 'muted' }, t.credProtected)
|
|
1661
|
+
: h('span', { className: 'dshg-badge', 'data-tone': k.present ? 'ok' : 'blue' }, k.present ? t.credPresent : t.credEnvOnly),
|
|
714
1662
|
),
|
|
715
1663
|
),
|
|
716
|
-
)
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
1664
|
+
),
|
|
1665
|
+
)
|
|
1666
|
+
: h('div', { className: 'dshg-sec-sub' }, t.credsEmpty),
|
|
1667
|
+
),
|
|
720
1668
|
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
1669
|
+
h(BoundaryDisclosure, {
|
|
1670
|
+
summary: t.boundaryCredsSummary,
|
|
1671
|
+
p1: t.boundaryCredsP1,
|
|
1672
|
+
p2: t.boundaryCredsP2,
|
|
1673
|
+
isWin,
|
|
1674
|
+
installerUrl,
|
|
1675
|
+
releaseUrl,
|
|
1676
|
+
t,
|
|
1677
|
+
}),
|
|
1678
|
+
)
|
|
1679
|
+
|
|
1680
|
+
const renderSnapshotsTab = () =>
|
|
1681
|
+
h(
|
|
1682
|
+
'div',
|
|
1683
|
+
{ className: 'dshg-tab-body' },
|
|
1684
|
+
h(
|
|
1685
|
+
'div',
|
|
1686
|
+
{ className: 'dshg-toolbar' },
|
|
1687
|
+
h(
|
|
1688
|
+
'button',
|
|
1689
|
+
{
|
|
1690
|
+
type: 'button',
|
|
1691
|
+
className: 'dshg-btn dshg-btn-primary dshg-btn-sm',
|
|
1692
|
+
disabled: Boolean(state.busyKey),
|
|
1693
|
+
onClick: () =>
|
|
1694
|
+
postAction(
|
|
1695
|
+
'/snapshots/create',
|
|
1696
|
+
{ target: 'web', reason: 'Web 手动备份' },
|
|
1697
|
+
'snap-web',
|
|
1698
|
+
(res) => `已创建 Web 快照 ${res.snapshot.id}`,
|
|
1699
|
+
),
|
|
1700
|
+
},
|
|
1701
|
+
state.busyKey === 'snap-web' ? t.snapCreating : t.snapCreateWeb,
|
|
1702
|
+
),
|
|
1703
|
+
h(
|
|
1704
|
+
'button',
|
|
1705
|
+
{
|
|
1706
|
+
type: 'button',
|
|
1707
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
1708
|
+
disabled: Boolean(state.busyKey),
|
|
1709
|
+
onClick: () =>
|
|
1710
|
+
postAction(
|
|
1711
|
+
'/snapshots/create',
|
|
1712
|
+
{ target: 'desktop', reason: '桌面端手动备份' },
|
|
1713
|
+
'snap-desktop',
|
|
1714
|
+
(res) => `已创建桌面端快照 ${res.snapshot.id}`,
|
|
1715
|
+
),
|
|
1716
|
+
},
|
|
1717
|
+
state.busyKey === 'snap-desktop' ? t.snapCreating : t.snapCreateDesktop,
|
|
1718
|
+
),
|
|
1719
|
+
),
|
|
1720
|
+
|
|
1721
|
+
h(
|
|
1722
|
+
'div',
|
|
1723
|
+
{ className: 'dshg-card' },
|
|
1724
|
+
h(
|
|
724
1725
|
'div',
|
|
725
|
-
{ className: 'dshg-
|
|
726
|
-
h(
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
1726
|
+
{ className: 'dshg-sec-head' },
|
|
1727
|
+
h('span', null, t.kpiSnaps),
|
|
1728
|
+
h('span', { className: 'dshg-badge', 'data-tone': 'muted' }, String(snapshots.total || 0)),
|
|
1729
|
+
),
|
|
1730
|
+
snapshots.snapshots && snapshots.snapshots.length > 0
|
|
1731
|
+
? h(
|
|
1732
|
+
'div',
|
|
1733
|
+
{ className: 'dshg-list' },
|
|
1734
|
+
...snapshots.snapshots.map((s) => {
|
|
1735
|
+
const expanded = Boolean(state.expandedSnaps[s.id])
|
|
1736
|
+
const trackColor = s.target === 'desktop' ? '#f59e0b' : '#3b82f6'
|
|
1737
|
+
const fileStatusLabel = (st) =>
|
|
1738
|
+
st === 'same' ? t.fileSame : st === 'modified' ? t.fileModified : st === 'missing_now' ? t.fileMissing : t.fileUnknown
|
|
1739
|
+
const fileTone = (st) =>
|
|
1740
|
+
st === 'same' ? 'ok' : st === 'modified' || st === 'missing_now' ? 'warn' : 'muted'
|
|
1741
|
+
|
|
1742
|
+
return h(
|
|
1743
|
+
'div',
|
|
1744
|
+
{ key: s.id, className: 'dshg-item' },
|
|
737
1745
|
h(
|
|
738
1746
|
'div',
|
|
739
|
-
{
|
|
1747
|
+
{ className: 'dshg-item-row' },
|
|
740
1748
|
h(
|
|
741
1749
|
'div',
|
|
742
|
-
{ className: 'dshg-
|
|
1750
|
+
{ className: 'dshg-item-main' },
|
|
743
1751
|
h(
|
|
744
|
-
'
|
|
745
|
-
{ className: 'dshg-
|
|
746
|
-
|
|
1752
|
+
'div',
|
|
1753
|
+
{ className: 'dshg-item-title' },
|
|
1754
|
+
h('span', { className: 'dshg-track-dot', style: { background: trackColor } }),
|
|
1755
|
+
h('span', null, s.reason || s.id),
|
|
1756
|
+
h('span', { className: 'dshg-pill' }, s.source === 'desktop' ? t.snapSourceDesktop : t.snapSourcePlugin),
|
|
747
1757
|
),
|
|
748
|
-
h('
|
|
1758
|
+
h('div', { className: 'dshg-mono' }, `${s.target} · ${formatTimeShort(s.createdAt)} · ${s.itemCount} files`),
|
|
1759
|
+
),
|
|
1760
|
+
h(
|
|
1761
|
+
'span',
|
|
1762
|
+
{ className: 'dshg-badge', 'data-tone': s.changedCount > 0 ? 'warn' : 'ok' },
|
|
1763
|
+
s.changedCount > 0 ? t.snapDiff(s.changedCount) : t.snapSame,
|
|
749
1764
|
),
|
|
750
|
-
h('div', { className: 'dshg-mono' }, s.id),
|
|
751
|
-
h('div', { style: { fontSize: 11, color: 'var(--dshg-text-2)' } }, s.reason || t.snapNoReason),
|
|
752
1765
|
),
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
1766
|
+
h(
|
|
1767
|
+
'div',
|
|
1768
|
+
{ className: 'dshg-actions', style: { justifyContent: 'space-between', marginTop: 2 } },
|
|
1769
|
+
h(
|
|
1770
|
+
'button',
|
|
1771
|
+
{
|
|
1772
|
+
type: 'button',
|
|
1773
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
1774
|
+
onClick: () =>
|
|
1775
|
+
patch({
|
|
1776
|
+
expandedSnaps: { ...state.expandedSnaps, [s.id]: !expanded },
|
|
1777
|
+
}),
|
|
1778
|
+
},
|
|
1779
|
+
t.snapFilesToggle((s.files || []).length),
|
|
1780
|
+
),
|
|
1781
|
+
s.restorableCount > 0
|
|
1782
|
+
? h(
|
|
1783
|
+
'button',
|
|
1784
|
+
{
|
|
1785
|
+
type: 'button',
|
|
1786
|
+
className: 'dshg-btn dshg-btn-primary dshg-btn-sm',
|
|
1787
|
+
disabled: Boolean(state.busyKey),
|
|
1788
|
+
onClick: () =>
|
|
1789
|
+
postAction(
|
|
1790
|
+
'/snapshots/restore-config',
|
|
1791
|
+
{ snapshotId: s.id },
|
|
1792
|
+
`restore-${s.id}`,
|
|
1793
|
+
(res) => `已恢复 ${res.restoredFiles.length} 个配置文件(恢复前已自动备份 ${res.preRestoreId})`,
|
|
1794
|
+
),
|
|
1795
|
+
},
|
|
1796
|
+
state.busyKey === `restore-${s.id}` ? t.snapRestoring : t.snapRestoreBtn,
|
|
1797
|
+
)
|
|
1798
|
+
: h('span', { className: 'dshg-sec-sub' }, t.snapDesktopOnlyTip),
|
|
1799
|
+
),
|
|
1800
|
+
expanded
|
|
1801
|
+
? h(
|
|
1802
|
+
'div',
|
|
1803
|
+
{ className: 'dshg-drawer' },
|
|
1804
|
+
s.files && s.files.length > 0
|
|
1805
|
+
? s.files.map((f) =>
|
|
1806
|
+
h(
|
|
1807
|
+
'div',
|
|
1808
|
+
{ key: f.relPath || f.name, className: 'dshg-row' },
|
|
1809
|
+
h('span', { className: 'dshg-mono' }, f.relPath || f.name),
|
|
1810
|
+
h('span', { className: 'dshg-badge', 'data-tone': fileTone(f.status) }, fileStatusLabel(f.status)),
|
|
1811
|
+
),
|
|
1812
|
+
)
|
|
1813
|
+
: h('div', { className: 'dshg-sec-sub' }, t.snapNoFiles),
|
|
1814
|
+
)
|
|
1815
|
+
: null,
|
|
1816
|
+
)
|
|
1817
|
+
}),
|
|
1818
|
+
)
|
|
1819
|
+
: h(
|
|
1820
|
+
'div',
|
|
1821
|
+
{ className: 'dshg-empty' },
|
|
1822
|
+
h('div', { style: { fontWeight: 600, fontSize: 12 } }, t.snapshotsEmpty),
|
|
1823
|
+
h('div', { style: { fontSize: 11, lineHeight: 1.5 } }, t.snapshotsEmptyDesc),
|
|
1824
|
+
),
|
|
1825
|
+
),
|
|
1826
|
+
|
|
1827
|
+
h(BoundaryDisclosure, {
|
|
1828
|
+
summary: t.boundarySnapsSummary,
|
|
1829
|
+
p1: t.boundarySnapsP1,
|
|
1830
|
+
p2: t.boundarySnapsP2,
|
|
1831
|
+
isWin,
|
|
1832
|
+
installerUrl,
|
|
1833
|
+
releaseUrl,
|
|
1834
|
+
t,
|
|
1835
|
+
}),
|
|
1836
|
+
)
|
|
1837
|
+
|
|
1838
|
+
return h(
|
|
1839
|
+
'div',
|
|
1840
|
+
{ className: 'dshg-wrap', 'data-variant': (props && props.variant) || 'dock' },
|
|
1841
|
+
// Clean Header (zero install-nudge CTA when EXE is missing)
|
|
1842
|
+
h(
|
|
1843
|
+
'div',
|
|
1844
|
+
{ className: 'dshg-header' },
|
|
1845
|
+
h(
|
|
1846
|
+
'div',
|
|
1847
|
+
{ className: 'dshg-brand' },
|
|
1848
|
+
h('div', { className: 'dshg-logo' }, h(GuardIcon, { size: 16 })),
|
|
1849
|
+
h(
|
|
1850
|
+
'div',
|
|
1851
|
+
{ className: 'dshg-title-box' },
|
|
1852
|
+
h(
|
|
1853
|
+
'div',
|
|
1854
|
+
{ className: 'dshg-title-row' },
|
|
1855
|
+
h('span', { className: 'dshg-title' }, t.brand),
|
|
1856
|
+
h('span', { className: 'dshg-ver' }, t.versionPill),
|
|
1857
|
+
),
|
|
1858
|
+
h('div', { className: 'dshg-sub' }, t.subtitle),
|
|
1859
|
+
),
|
|
1860
|
+
),
|
|
1861
|
+
h(
|
|
1862
|
+
'div',
|
|
1863
|
+
{ className: 'dshg-actions' },
|
|
1864
|
+
guard.installed
|
|
1865
|
+
? h(
|
|
1866
|
+
'button',
|
|
1867
|
+
{
|
|
1868
|
+
type: 'button',
|
|
1869
|
+
className: 'dshg-btn',
|
|
1870
|
+
disabled: Boolean(state.busyKey),
|
|
1871
|
+
onClick: launchGuardDesktop,
|
|
1872
|
+
},
|
|
1873
|
+
h(ExternalIcon, { size: 12 }),
|
|
1874
|
+
h('span', null, state.busyKey === 'open-desktop' ? t.launchingBtn : t.openDesktopBtn),
|
|
1875
|
+
)
|
|
1876
|
+
: null,
|
|
1877
|
+
h(
|
|
1878
|
+
'button',
|
|
1879
|
+
{
|
|
1880
|
+
type: 'button',
|
|
1881
|
+
className: 'dshg-btn dshg-btn-icon',
|
|
1882
|
+
title: t.refresh,
|
|
1883
|
+
disabled: state.loading,
|
|
1884
|
+
onClick: () => fetchOverview(true),
|
|
1885
|
+
},
|
|
1886
|
+
h(RefreshIcon, { size: 13, className: state.loading ? 'dshg-spin' : undefined }),
|
|
1887
|
+
),
|
|
1888
|
+
h(
|
|
1889
|
+
'button',
|
|
1890
|
+
{
|
|
1891
|
+
type: 'button',
|
|
1892
|
+
className: 'dshg-btn',
|
|
1893
|
+
onClick: () => patch({ lang: state.lang === 'zh' ? 'en' : 'zh' }),
|
|
1894
|
+
},
|
|
1895
|
+
t.langSwitch,
|
|
1896
|
+
),
|
|
1897
|
+
),
|
|
1898
|
+
),
|
|
1899
|
+
|
|
1900
|
+
state.error ? h('div', { className: 'dshg-error' }, state.error) : null,
|
|
1901
|
+
state.notice ? h('div', { className: 'dshg-notice' }, state.notice) : null,
|
|
1902
|
+
|
|
1903
|
+
// Status row
|
|
1904
|
+
data
|
|
1905
|
+
? h(
|
|
1906
|
+
'div',
|
|
1907
|
+
{ className: 'dshg-row' },
|
|
1908
|
+
h(
|
|
1909
|
+
'span',
|
|
1910
|
+
{ className: 'dshg-badge', 'data-tone': healthy ? 'ok' : 'warn' },
|
|
1911
|
+
h('span', { className: 'dshg-dot' }),
|
|
1912
|
+
healthy ? t.healthy : t.unhealthy(issues.length),
|
|
1913
|
+
),
|
|
1914
|
+
state.checkedAt
|
|
1915
|
+
? h('span', { style: { fontSize: 11, color: 'var(--dshg-text-3)' } }, t.checkedAt(formatTimeShort(state.checkedAt)))
|
|
1916
|
+
: null,
|
|
756
1917
|
)
|
|
757
1918
|
: null,
|
|
758
1919
|
|
|
759
|
-
//
|
|
1920
|
+
// Interactive 4-KPI Strip
|
|
760
1921
|
data
|
|
761
1922
|
? h(
|
|
762
1923
|
'div',
|
|
763
|
-
{ className: 'dshg-
|
|
764
|
-
h(
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
1924
|
+
{ className: 'dshg-kpi-strip' },
|
|
1925
|
+
h(
|
|
1926
|
+
'button',
|
|
1927
|
+
{
|
|
1928
|
+
type: 'button',
|
|
1929
|
+
className: 'dshg-kpi',
|
|
1930
|
+
'data-active': state.tab === 'overview' ? 'true' : 'false',
|
|
1931
|
+
onClick: () => patch({ tab: 'overview' }),
|
|
1932
|
+
},
|
|
1933
|
+
h('span', { className: 'dshg-kpi-label' }, t.kpiHealth),
|
|
1934
|
+
h('span', { className: 'dshg-kpi-val' }, healthy ? t.kpiHealthOk : t.kpiHealthWarn(issues.length)),
|
|
1935
|
+
),
|
|
1936
|
+
h(
|
|
1937
|
+
'button',
|
|
1938
|
+
{
|
|
1939
|
+
type: 'button',
|
|
1940
|
+
className: 'dshg-kpi',
|
|
1941
|
+
'data-active': state.tab === 'plugins' ? 'true' : 'false',
|
|
1942
|
+
onClick: () => patch({ tab: 'plugins' }),
|
|
1943
|
+
},
|
|
1944
|
+
h('span', { className: 'dshg-kpi-label' }, t.kpiExt),
|
|
1945
|
+
h('span', { className: 'dshg-kpi-val' }, String(totalExtCount)),
|
|
1946
|
+
),
|
|
1947
|
+
h(
|
|
1948
|
+
'button',
|
|
1949
|
+
{
|
|
1950
|
+
type: 'button',
|
|
1951
|
+
className: 'dshg-kpi',
|
|
1952
|
+
'data-active': state.tab === 'creds' ? 'true' : 'false',
|
|
1953
|
+
onClick: () => patch({ tab: 'creds' }),
|
|
1954
|
+
},
|
|
1955
|
+
h('span', { className: 'dshg-kpi-label' }, t.kpiCreds),
|
|
1956
|
+
h('span', { className: 'dshg-kpi-val' }, credsSummaryVal),
|
|
1957
|
+
),
|
|
1958
|
+
h(
|
|
1959
|
+
'button',
|
|
1960
|
+
{
|
|
1961
|
+
type: 'button',
|
|
1962
|
+
className: 'dshg-kpi',
|
|
1963
|
+
'data-active': state.tab === 'snapshots' ? 'true' : 'false',
|
|
1964
|
+
onClick: () => patch({ tab: 'snapshots' }),
|
|
1965
|
+
},
|
|
1966
|
+
h('span', { className: 'dshg-kpi-label' }, t.kpiSnaps),
|
|
1967
|
+
h('span', { className: 'dshg-kpi-val' }, String(snapshots.total || 0)),
|
|
1968
|
+
),
|
|
1969
|
+
)
|
|
1970
|
+
: null,
|
|
1971
|
+
|
|
1972
|
+
// Segmented 4-Tab Bar
|
|
1973
|
+
data
|
|
1974
|
+
? h(
|
|
1975
|
+
'div',
|
|
1976
|
+
{ className: 'dshg-seg' },
|
|
1977
|
+
...[
|
|
1978
|
+
['overview', t.tabOverview],
|
|
1979
|
+
['plugins', t.tabPlugins],
|
|
1980
|
+
['creds', t.tabCreds],
|
|
1981
|
+
['snapshots', t.tabSnapshots],
|
|
1982
|
+
].map(([id, label]) =>
|
|
1983
|
+
h(
|
|
1984
|
+
'button',
|
|
1985
|
+
{
|
|
1986
|
+
key: id,
|
|
1987
|
+
type: 'button',
|
|
1988
|
+
className: 'dshg-seg-btn',
|
|
1989
|
+
'data-active': state.tab === id ? 'true' : 'false',
|
|
1990
|
+
onClick: () => patch({ tab: id }),
|
|
1991
|
+
},
|
|
1992
|
+
label,
|
|
1993
|
+
),
|
|
1994
|
+
),
|
|
1995
|
+
)
|
|
1996
|
+
: null,
|
|
1997
|
+
|
|
1998
|
+
!data && state.loading
|
|
1999
|
+
? h('div', { className: 'dshg-card', style: { fontSize: 12, color: 'var(--dshg-text-2)' } }, t.loading)
|
|
2000
|
+
: null,
|
|
2001
|
+
|
|
2002
|
+
!data && !state.loading && state.error
|
|
2003
|
+
? h(
|
|
2004
|
+
'div',
|
|
2005
|
+
{ className: 'dshg-empty' },
|
|
2006
|
+
h('div', { style: { fontSize: 12 } }, state.error),
|
|
2007
|
+
h('button', { type: 'button', className: 'dshg-btn', onClick: () => fetchOverview(true) }, t.retry),
|
|
797
2008
|
)
|
|
798
2009
|
: null,
|
|
2010
|
+
|
|
2011
|
+
data && state.tab === 'overview' ? renderOverviewTab() : null,
|
|
2012
|
+
data && state.tab === 'plugins' ? renderPluginsTab() : null,
|
|
2013
|
+
data && state.tab === 'creds' ? renderCredsTab() : null,
|
|
2014
|
+
data && state.tab === 'snapshots' ? renderSnapshotsTab() : null,
|
|
2015
|
+
|
|
2016
|
+
h(
|
|
2017
|
+
'div',
|
|
2018
|
+
{ className: 'dshg-footer' },
|
|
2019
|
+
h('span', null, t.footerNote),
|
|
2020
|
+
h(
|
|
2021
|
+
'div',
|
|
2022
|
+
{ style: { display: 'flex', gap: 10 } },
|
|
2023
|
+
h('a', { href: releaseUrl, target: '_blank', rel: 'noopener noreferrer' }, 'Releases'),
|
|
2024
|
+
h('a', { href: repoUrl, target: '_blank', rel: 'noopener noreferrer' }, t.footerHome),
|
|
2025
|
+
),
|
|
2026
|
+
),
|
|
799
2027
|
)
|
|
800
2028
|
}
|
|
801
2029
|
|