dsh-mcp-connector 0.2.88 → 0.2.89
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/CHANGELOG.md +12 -0
- package/README.en.md +3 -3
- package/README.md +3 -3
- package/docs/I18N.md +2 -2
- package/docs/screenshots/01-market-overview.jpg +0 -0
- package/docs/screenshots/02-connector-detail.jpg +0 -0
- package/docs/screenshots/03-tool-discovery.jpg +0 -0
- package/docs/screenshots/04-json-import.jpg +0 -0
- package/docs/screenshots/05-unified-tool-search.png +0 -0
- package/docs/screenshots/06-tool-parameters.png +0 -0
- package/docs/screenshots/07-connection-diagnostics.png +0 -0
- package/docs/screenshots/08-ten-recommendations.jpg +0 -0
- package/docs/screenshots/README.md +1 -1
- package/docs/screenshots/assets.json +30 -30
- package/docs/tutorials/FIRST-SUCCESS-SCENARIOS.md +1 -1
- package/package.json +1 -1
- package/ui/index.html +30 -12
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
本项目遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);首个公开版本从 `0.1.0` 开始。
|
|
4
4
|
|
|
5
|
+
## [0.2.89] - 2026-11-01
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- 语言下拉改为面板顶部右侧始终可见的「简体中文 / English」按钮,当前语言高亮,支持键盘和读屏。
|
|
10
|
+
- 记住当前浏览器同源下的主动语言选择;存储不可用时仍可通过页面参数切换,未选择时继续跟随 Host 并回退中文。
|
|
11
|
+
- 编辑时切换语言仍需确认放弃未保存内容;只重载面板,不重启 DSH 或修改 Host 配置。
|
|
12
|
+
|
|
13
|
+
### Verification
|
|
14
|
+
|
|
15
|
+
- 完整回归及隔离 Chrome Mock 验证覆盖切换、重开记忆、取消确认、窄屏与存储降级,不代表 Windows Desktop 实机验收。
|
|
16
|
+
|
|
5
17
|
## [0.2.88] - 2026-10-31
|
|
6
18
|
|
|
7
19
|
### Added
|
package/README.en.md
CHANGED
|
@@ -10,7 +10,7 @@ OAuth availability depends on each provider's client-registration policy and acc
|
|
|
10
10
|
|
|
11
11
|
[简体中文](README.md)
|
|
12
12
|
|
|
13
|
-
**Bilingual interface:**
|
|
13
|
+
**Bilingual interface:** Both **简体中文 / English** buttons are always visible at the top right of the panel. Your explicit choice is remembered in this browser. Host messages follow the explicit DSH language preference, defaulting to Chinese when unavailable; configure `locale: en` or `locale: zh-CN` to override. Switching reloads only the panel and confirms before discarding edits. Provider descriptions and user content retain their original language. See [language configuration](docs/I18N.md).
|
|
14
14
|
|
|
15
15
|
### Homepage recommendations
|
|
16
16
|
|
|
@@ -114,7 +114,7 @@ As of 2026-10-24, the public Registry publishes 112 connector descriptors. After
|
|
|
114
114
|
| Connection diagnostics and last-success cache | |
|
|
115
115
|
|  | |
|
|
116
116
|
|
|
117
|
-
<!-- generated:media -->Screenshots and GIF were captured from v0.2.
|
|
117
|
+
<!-- generated:media -->Screenshots and GIF were captured from v0.2.89 (2026-11-01), using the credential-free Mock harness. They demonstrate UI, not real business acceptance; counts are fixtures. See [asset provenance](docs/screenshots/README.md).<!-- /generated:media -->
|
|
118
118
|
|
|
119
119
|
## Installation
|
|
120
120
|
|
|
@@ -245,7 +245,7 @@ npm run dev:ui
|
|
|
245
245
|
|
|
246
246
|
Every Registry merge regenerates `catalog-stats.json`; an hourly workflow in this repository synchronizes the Chinese and English product copy plus a local stats snapshot. The static npm README updates with package releases, while the live badges above read the Registry directly and therefore stay current without another npm release.
|
|
247
247
|
|
|
248
|
-
<!-- generated:version -->The current public version is [`dsh-mcp-connector@0.2.
|
|
248
|
+
<!-- generated:version -->The current public version is [`dsh-mcp-connector@0.2.89`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.89](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.89).<!-- /generated:version -->
|
|
249
249
|
|
|
250
250
|
See [CHANGELOG.md](CHANGELOG.md) for version history and [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md) for the Desktop release checklist.
|
|
251
251
|
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ OAuth 是否可用取决于服务商的客户端注册、账号权限与授权
|
|
|
10
10
|
|
|
11
11
|
[English](README.en.md)
|
|
12
12
|
|
|
13
|
-
**中英文界面:**
|
|
13
|
+
**中英文界面:** 面板顶部右侧直接展示「简体中文 / English」按钮,并记住当前浏览器中的主动选择。插件 Host 默认跟随 DSH 显式语言偏好,缺失时保持中文;可配置 `locale: zh-CN` 或 `locale: en`。面板切换不重启 DSH,未保存编辑需先确认;详情见 [语言设置](docs/I18N.md)。
|
|
14
14
|
|
|
15
15
|
### 首页推荐
|
|
16
16
|
|
|
@@ -116,7 +116,7 @@ Desktop 需要完全退出并重新启动应用;Web 需要停止原 `dsh web`
|
|
|
116
116
|
| 连接诊断与最后成功缓存 | |
|
|
117
117
|
|  | |
|
|
118
118
|
|
|
119
|
-
<!-- generated:media -->截图与 GIF 采集自 v0.2.
|
|
119
|
+
<!-- generated:media -->截图与 GIF 采集自 v0.2.89(2026-11-01)无凭据 Mock 页面,展示界面而非真实业务验收;市场数量是测试夹具。来源与更新方法见 [素材说明](docs/screenshots/README.md)。<!-- /generated:media -->
|
|
120
120
|
|
|
121
121
|
## 安装
|
|
122
122
|
|
|
@@ -240,7 +240,7 @@ npm run dev:ui
|
|
|
240
240
|
|
|
241
241
|
公共 Registry 每次合并后会生成 `catalog-stats.json`;本仓库的定时工作流每小时同步中英文介绍和统计快照。npm 页面中的静态正文随版本发布更新,上方动态统计徽标则直接读取 Registry,可在不发布新 npm 版本时保持实时数量一致。
|
|
242
242
|
|
|
243
|
-
<!-- generated:version -->当前公开版本为 [`dsh-mcp-connector@0.2.
|
|
243
|
+
<!-- generated:version -->当前公开版本为 [`dsh-mcp-connector@0.2.89`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.89](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.89)。<!-- /generated:version -->
|
|
244
244
|
|
|
245
245
|
版本能力与变更记录见 [CHANGELOG.md](CHANGELOG.md)。
|
|
246
246
|
Desktop 发版回归见 [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md)。
|
package/docs/I18N.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
- 界面语言**跟随用户在 DSH 里的选择**(设置 → Language),插件不覆盖用户偏好。
|
|
9
9
|
- 保持中文界面**零回归**:中文仍是 DSH 默认语言,既有中文文案逐字不变。
|
|
10
10
|
- 用户在 DSH 选英文、或配置 `locale: 'en'` 时,Host 启动后使用英文提示与管理工具描述。
|
|
11
|
-
-
|
|
11
|
+
- 面板顶部右侧独立区域直接展示「简体中文 / English」两个按钮,当前语言高亮,支持键盘及读屏。仅重载当前面板,不修改 Host 配置或重启 DSH;有未保存编辑时先确认。主动选择保存在当前浏览器同源 localStorage(不同浏览器/设备不共享,同源面板共享);存储不可用时仍可通过当前页参数切换。面板语言与 Host 文案可独立;需要统一时同时设置 DSH/插件语言并手工重启 Host。
|
|
12
12
|
- 服务商目录说明、品牌名称、用户内容、示例任务中的企业名及 v1 模板协议常量保留原文,不宣称第三方内容全部英文化。
|
|
13
13
|
- 缺译文**绝不**显示空白或 key:回退中文原文。
|
|
14
14
|
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
`locale` 默认值为 `'auto'`,即走上述链路;`'zh-CN'` / `'en'` 为强制指定。
|
|
29
29
|
|
|
30
|
-
面板优先级:用户当前页 `uiLocale` 选择 → Host 注入语言 → 客户端 `locale` 参数 → HTML 默认中文。新增懒加载分享界面的词典位于 `ui/locale.js`,只翻译显示与提示,不改写用户输入或序列化模板常量。
|
|
30
|
+
面板优先级:用户当前页 `uiLocale` 选择 → 浏览器保存的主动选择 → Host 注入语言 → 客户端 `locale` 参数 → HTML 默认中文。新增懒加载分享界面的词典位于 `ui/locale.js`,只翻译显示与提示,不改写用户输入或序列化模板常量。
|
|
31
31
|
|
|
32
32
|
验收:`npm run check` 为代码门禁;`node scripts/check-i18n-ui.mjs` 为独立 Chromium + Mock API UI 验收,需配置 Playwright。Windows CI 和真实 Windows Desktop 仍是不同证据,不可互相替代。
|
|
33
33
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 产品截图与演示的来源及更新
|
|
2
2
|
|
|
3
|
-
<!-- generated:media -->本组 8 张截图和 GIF 均从 v0.2.
|
|
3
|
+
<!-- generated:media -->本组 8 张截图和 GIF 均从 v0.2.89 于 2026-11-01 重新采集,未修改截图中的版本文字。<!-- /generated:media -->
|
|
4
4
|
|
|
5
5
|
前七张素材由真实产品 UI 的无凭据 Mock harness 渲染:1280×720 浏览器视口、800px 产品面板、桌面两列卡片。顶部保留“无凭据 Mock”标识;目录数、连接数与工具数是演示夹具,不代表生产统计或真实授权、业务验收。不会读取用户 profile、调用服务商或上传业务数据。
|
|
6
6
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"capture": {
|
|
4
|
-
"capturedOn": "2026-
|
|
5
|
-
"sourceVersion": "0.2.
|
|
6
|
-
"sourceFingerprint": "
|
|
4
|
+
"capturedOn": "2026-11-01",
|
|
5
|
+
"sourceVersion": "0.2.89",
|
|
6
|
+
"sourceFingerprint": "1db40e9ed7412f99597d80987790e7e455e6a6b42a9c7b964046abc40edf2348",
|
|
7
7
|
"browserViewport": {
|
|
8
8
|
"width": 1280,
|
|
9
9
|
"height": 720
|
|
@@ -16,63 +16,63 @@
|
|
|
16
16
|
"screenshots": [
|
|
17
17
|
{
|
|
18
18
|
"path": "docs/screenshots/01-market-overview.jpg",
|
|
19
|
-
"sha256": "
|
|
19
|
+
"sha256": "30768c6e90d073495ca731107adf860415ddb049ba3b5804d3c20bc11e4c6c60",
|
|
20
20
|
"width": 1280,
|
|
21
21
|
"height": 720,
|
|
22
|
-
"capturedOn": "2026-
|
|
23
|
-
"sourceVersion": "0.2.
|
|
22
|
+
"capturedOn": "2026-11-01",
|
|
23
|
+
"sourceVersion": "0.2.89"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"path": "docs/screenshots/02-connector-detail.jpg",
|
|
27
|
-
"sha256": "
|
|
27
|
+
"sha256": "6890c053f18a29120f0b1b41321a742cfc7317cbf0942a451d9c5986572d5ae8",
|
|
28
28
|
"width": 1280,
|
|
29
29
|
"height": 720,
|
|
30
|
-
"capturedOn": "2026-
|
|
31
|
-
"sourceVersion": "0.2.
|
|
30
|
+
"capturedOn": "2026-11-01",
|
|
31
|
+
"sourceVersion": "0.2.89"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"path": "docs/screenshots/03-tool-discovery.jpg",
|
|
35
|
-
"sha256": "
|
|
35
|
+
"sha256": "8f3499e346e141ae9543ff5a177ec97dc78cad4ba6a1c850412569dfa676871c",
|
|
36
36
|
"width": 1280,
|
|
37
37
|
"height": 720,
|
|
38
|
-
"capturedOn": "2026-
|
|
39
|
-
"sourceVersion": "0.2.
|
|
38
|
+
"capturedOn": "2026-11-01",
|
|
39
|
+
"sourceVersion": "0.2.89"
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"path": "docs/screenshots/04-json-import.jpg",
|
|
43
|
-
"sha256": "
|
|
43
|
+
"sha256": "b74565c5100bc3323486a902b13d6a4b962a08a352434f0754c5d5c915b17d8a",
|
|
44
44
|
"width": 1280,
|
|
45
45
|
"height": 720,
|
|
46
|
-
"capturedOn": "2026-
|
|
47
|
-
"sourceVersion": "0.2.
|
|
46
|
+
"capturedOn": "2026-11-01",
|
|
47
|
+
"sourceVersion": "0.2.89"
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
"path": "docs/screenshots/05-unified-tool-search.png",
|
|
51
|
-
"sha256": "
|
|
51
|
+
"sha256": "af007d9add536090ab4a08dc7c7a68a2e7dbd461cee5ae4e2b270d3324c16a4f",
|
|
52
52
|
"width": 1280,
|
|
53
53
|
"height": 720,
|
|
54
|
-
"capturedOn": "2026-
|
|
55
|
-
"sourceVersion": "0.2.
|
|
54
|
+
"capturedOn": "2026-11-01",
|
|
55
|
+
"sourceVersion": "0.2.89"
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"path": "docs/screenshots/06-tool-parameters.png",
|
|
59
|
-
"sha256": "
|
|
59
|
+
"sha256": "20727309f6fd911cac1d41eced11ebfc61b25e284ce53443a54b6c0417eeb30b",
|
|
60
60
|
"width": 1280,
|
|
61
61
|
"height": 720,
|
|
62
|
-
"capturedOn": "2026-
|
|
63
|
-
"sourceVersion": "0.2.
|
|
62
|
+
"capturedOn": "2026-11-01",
|
|
63
|
+
"sourceVersion": "0.2.89"
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
"path": "docs/screenshots/07-connection-diagnostics.png",
|
|
67
|
-
"sha256": "
|
|
67
|
+
"sha256": "f3b2e764daf63da7fdebea8688b792ac54017473267bf2b8c90d751cc795ddbb",
|
|
68
68
|
"width": 1280,
|
|
69
69
|
"height": 720,
|
|
70
|
-
"capturedOn": "2026-
|
|
71
|
-
"sourceVersion": "0.2.
|
|
70
|
+
"capturedOn": "2026-11-01",
|
|
71
|
+
"sourceVersion": "0.2.89"
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
"path": "docs/screenshots/08-ten-recommendations.jpg",
|
|
75
|
-
"sha256": "
|
|
75
|
+
"sha256": "2d5c6dd304dbd6dffb705abb73d3ee80e1a775a2ce2f75f742da1a1351231114",
|
|
76
76
|
"width": 1280,
|
|
77
77
|
"height": 1400,
|
|
78
78
|
"browserViewport": {
|
|
@@ -80,17 +80,17 @@
|
|
|
80
80
|
"height": 1400
|
|
81
81
|
},
|
|
82
82
|
"panelHeight": 1280,
|
|
83
|
-
"capturedOn": "2026-
|
|
84
|
-
"sourceVersion": "0.2.
|
|
83
|
+
"capturedOn": "2026-11-01",
|
|
84
|
+
"sourceVersion": "0.2.89"
|
|
85
85
|
}
|
|
86
86
|
],
|
|
87
87
|
"demo": {
|
|
88
88
|
"path": "docs/demo.gif",
|
|
89
|
-
"sha256": "
|
|
89
|
+
"sha256": "e9ff879c9245f9b68792da3ccf6ec47788ae8e4acf3ef2f198f1a0dd6aa589a7",
|
|
90
90
|
"width": 960,
|
|
91
91
|
"height": 540,
|
|
92
|
-
"capturedOn": "2026-
|
|
93
|
-
"sourceVersion": "0.2.
|
|
92
|
+
"capturedOn": "2026-11-01",
|
|
93
|
+
"sourceVersion": "0.2.89",
|
|
94
94
|
"durationSeconds": 36
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
| 项目 | 验收要求 |
|
|
10
10
|
|---|---|
|
|
11
|
-
| 前提 | <!-- generated:version -->正式 `dsh-mcp-connector@0.2.
|
|
11
|
+
| 前提 | <!-- generated:version -->正式 `dsh-mcp-connector@0.2.89`<!-- /generated:version -->;当前 Workspace;企查查 OAuth 可用;测试账号具有目标企业数据权限 |
|
|
12
12
|
| 权限/管理员 | 账号权限、组织授权和可见字段由服务商控制;企业组织可能需要管理员开通,当前文档不能替代审批 |
|
|
13
13
|
| 费用 | 可能受套餐、次数或字段权限影响;MCP连接器无法确认本次费用,调用前在服务商侧核对 |
|
|
14
14
|
| 运行/数据去向 | 远程 MCP Server;企业名称、查询参数和调用结果经 DSH Host 发送到/返回自 `agent.qcc.com` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mcp-connector",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.89",
|
|
4
4
|
"description": "DeepSeek Harness MCP Connector: connect servers, search tools across active connections, and troubleshoot discovery. Includes a continuously updated catalog; supports OAuth 2.0 PKCE, API keys, Streamable HTTP/stdio, and mcpServers JSON import.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
package/ui/index.html
CHANGED
|
@@ -84,6 +84,11 @@
|
|
|
84
84
|
.tabs button.active .tab-count { background: var(--accent-light); color: var(--accent); }
|
|
85
85
|
.tab-count:empty { display: none; }
|
|
86
86
|
.header-spacer { flex: 1; }
|
|
87
|
+
.language-bar { display: flex; flex-shrink: 0; justify-content: flex-end; padding: 8px 24px; background: var(--card); position: relative; z-index: 201; }
|
|
88
|
+
.language-switch { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
|
|
89
|
+
.language-switch button { min-height: 36px; padding: 6px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font: inherit; cursor: pointer; }
|
|
90
|
+
.language-switch button[aria-pressed="true"] { background: var(--card); color: var(--accent); font-weight: 600; box-shadow: var(--shadow); }
|
|
91
|
+
.language-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
87
92
|
.search-box {
|
|
88
93
|
display: flex; align-items: center; gap: 8px;
|
|
89
94
|
background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
|
|
@@ -480,6 +485,12 @@
|
|
|
480
485
|
</head>
|
|
481
486
|
<body>
|
|
482
487
|
<div class="app">
|
|
488
|
+
<div class="language-bar">
|
|
489
|
+
<div id="ui-language" class="language-switch" role="group" aria-label="Language / 语言">
|
|
490
|
+
<button type="button" data-locale="zh-CN" lang="zh-CN" aria-pressed="true">简体中文</button>
|
|
491
|
+
<button type="button" data-locale="en" lang="en" aria-pressed="false">English</button>
|
|
492
|
+
</div>
|
|
493
|
+
</div>
|
|
483
494
|
<header>
|
|
484
495
|
<div class="tabs" id="tabs">
|
|
485
496
|
<button data-view="market" class="active"><span id="tab-market">市场</span> <span class="tab-count" id="market-tab-count"></span></button>
|
|
@@ -487,10 +498,6 @@
|
|
|
487
498
|
<button data-view="tools"><span id="tab-tools">工具</span></button>
|
|
488
499
|
</div>
|
|
489
500
|
<div class="header-spacer"></div>
|
|
490
|
-
<select id="ui-language" aria-label="Language / 界面语言" style="width:auto;max-width:130px">
|
|
491
|
-
<option value="zh-CN">简体中文</option>
|
|
492
|
-
<option value="en">English</option>
|
|
493
|
-
</select>
|
|
494
501
|
<div class="search-box">
|
|
495
502
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="color:var(--muted);flex-shrink:0"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
|
|
496
503
|
<input id="search" type="text" placeholder="搜索连接器…" />
|
|
@@ -1098,6 +1105,7 @@
|
|
|
1098
1105
|
// 时同样回退中文原文,绝不显示空白或 key。
|
|
1099
1106
|
// 面板是独立 HTML,不能 import ES 模块,所以这里内联等价实现(纯函数)。
|
|
1100
1107
|
const DEFAULT_LOCALE = 'zh-CN';
|
|
1108
|
+
const LANGUAGE_STORAGE_KEY = 'mcp-connector.ui-language';
|
|
1101
1109
|
const ACTIVE_LOCALE = detectLocale();
|
|
1102
1110
|
document.documentElement.lang = ACTIVE_LOCALE;
|
|
1103
1111
|
|
|
@@ -1113,9 +1121,7 @@
|
|
|
1113
1121
|
}
|
|
1114
1122
|
|
|
1115
1123
|
/**
|
|
1116
|
-
*
|
|
1117
|
-
* 只在英文时注入,中文时完全不存在 → undefined 视为 zh-CN)→ iframe URL 上的
|
|
1118
|
-
* `?locale=` 查询参数(client.js 也会带)→ `<html lang>` → 中文默认值。
|
|
1124
|
+
* 语言优先级:当前面板参数 → 浏览器中主动选择 → Host 注入 → locale 参数 → HTML。
|
|
1119
1125
|
* 无法识别或不受支持一律回退中文(中文仍是默认界面)。
|
|
1120
1126
|
*/
|
|
1121
1127
|
function detectLocale() {
|
|
@@ -1124,6 +1130,10 @@
|
|
|
1124
1130
|
const choice = normalizeLocale(new URLSearchParams(window.location.search || '').get('uiLocale'));
|
|
1125
1131
|
if (choice) return choice;
|
|
1126
1132
|
} catch { /* fall through to Host preference */ }
|
|
1133
|
+
try {
|
|
1134
|
+
const saved = normalizeLocale(window.localStorage.getItem(LANGUAGE_STORAGE_KEY));
|
|
1135
|
+
if (saved) return saved;
|
|
1136
|
+
} catch { /* Storage may be unavailable in embedded/private contexts. */ }
|
|
1127
1137
|
const fromHost = normalizeLocale(window.__MCP_CONNECTOR_LOCALE__);
|
|
1128
1138
|
if (fromHost !== undefined) return fromHost;
|
|
1129
1139
|
let requested = '';
|
|
@@ -3437,15 +3447,23 @@
|
|
|
3437
3447
|
}
|
|
3438
3448
|
|
|
3439
3449
|
applyStaticLocale();
|
|
3440
|
-
const
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3450
|
+
const languageSwitch = $('#ui-language');
|
|
3451
|
+
for (const button of languageSwitch.querySelectorAll('button[data-locale]')) {
|
|
3452
|
+
button.setAttribute('aria-pressed', String(button.dataset.locale === ACTIVE_LOCALE));
|
|
3453
|
+
}
|
|
3454
|
+
let languageChangePending = false;
|
|
3455
|
+
languageSwitch.addEventListener('click', async (event) => {
|
|
3456
|
+
const button = event.target.closest('button[data-locale]');
|
|
3457
|
+
if (!button || languageChangePending) return;
|
|
3458
|
+
const choice = normalizeLocale(button.dataset.locale);
|
|
3459
|
+
if (!choice) return;
|
|
3444
3460
|
if (choice === ACTIVE_LOCALE) return;
|
|
3461
|
+
languageChangePending = true;
|
|
3445
3462
|
if ($('#modalMask').classList.contains('show') && !await confirmDialog({
|
|
3446
3463
|
title: t('切换界面语言'),
|
|
3447
3464
|
message: t('切换语言将重新加载面板,未保存的编辑会丢失。继续吗?'),
|
|
3448
|
-
})) {
|
|
3465
|
+
})) { languageChangePending = false; return; }
|
|
3466
|
+
try { window.localStorage.setItem(LANGUAGE_STORAGE_KEY, choice); } catch { /* URL fallback still works. */ }
|
|
3449
3467
|
const url = new URL(window.location.href);
|
|
3450
3468
|
url.searchParams.set('uiLocale', choice);
|
|
3451
3469
|
window.location.assign(url.href);
|