dsh-multipane 1.0.51 → 1.0.52
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/LICENSE +21 -21
- package/README.md +6 -0
- package/cordis.patch.yml +11 -11
- package/lib/client.js +19 -14
- package/lib/index.js +433 -241
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 weiaisuyan
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 weiaisuyan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -160,6 +160,12 @@ node scripts/check-names.cjs # 包名 / 版本 / 冷却豁免三处是否一
|
|
|
160
160
|
|
|
161
161
|
## 更新记录
|
|
162
162
|
|
|
163
|
+
### 1.0.52(2026-11-12)
|
|
164
|
+
|
|
165
|
+
- **修「明明更新过,进设置页还提示新版本」**:设置页那个更新按钮只把文件覆盖进 `node_modules\dsh-multipane`,而 profile 的 `package.json` 与 `pnpm-lock.yaml` 里还钉着旧版本号。之后只要在这个 profile 里装/卸**任何**别的插件(pnpm 一跑),它就会按 lockfile 把这个目录重铺回旧版本 —— 用户看到的就是「更新成功了,提示还在」。实测:1.0.51 装上后 9:09 确实在跑,9:42 装了另一个插件,目录又变回 1.0.37
|
|
166
|
+
- 现在自更新成功后同时改两处登记:`package.json` 里的依赖值,以及 `pnpm-lock.yaml` 的 importer(specifier 与 version)、packages 条目(键名与 integrity)、snapshots 键名。全部按文本编辑,保留原文件格式。两处里只要有一处不能确定改对就**一并不改**,并在提示里写明「依赖登记没同步」—— 留一半新一半旧会让 pnpm 以 frozen-lockfile 不一致为由拒绝整个 profile,比退回一版更糟
|
|
167
|
+
- integrity 用下载到的 tgz 现算(sha512),与 npm registry 给的完全一致;新版本号同时写进 `pnpm-workspace.yaml` 的等待期白名单,免得下次 pnpm 解析时被 24 小时新包限制挡住
|
|
168
|
+
|
|
163
169
|
### 1.0.51(2026-11-11)
|
|
164
170
|
|
|
165
171
|
- **轮次导航条的隐藏阈值变成设置项**:设置页「界面元素」新增「窄栏隐藏轮次导航条」,一根 0–600px 的滑杆,默认 240px,`0` = 永不隐藏。以前 240 是写死的,栏一窄就消失、改不了
|
package/cordis.patch.yml
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# dsh-split-view bundle patch.
|
|
2
|
-
#
|
|
3
|
-
# Installing this package through the official CLI
|
|
4
|
-
# dsh plugin --profile desktop add file:<path-to-this-directory>
|
|
5
|
-
# reconciles `dsh.profile.bundles` against installed packages and appends
|
|
6
|
-
# `dsh-split-view` to the bundle stack; the profile boot then merges this patch
|
|
7
|
-
# (a single `insert` of the plugin row).
|
|
8
|
-
- insert:
|
|
9
|
-
- id: split-view
|
|
10
|
-
name: 'dsh-multipane'
|
|
11
|
-
label: '多栏视图'
|
|
1
|
+
# dsh-split-view bundle patch.
|
|
2
|
+
#
|
|
3
|
+
# Installing this package through the official CLI
|
|
4
|
+
# dsh plugin --profile desktop add file:<path-to-this-directory>
|
|
5
|
+
# reconciles `dsh.profile.bundles` against installed packages and appends
|
|
6
|
+
# `dsh-split-view` to the bundle stack; the profile boot then merges this patch
|
|
7
|
+
# (a single `insert` of the plugin row).
|
|
8
|
+
- insert:
|
|
9
|
+
- id: split-view
|
|
10
|
+
name: 'dsh-multipane'
|
|
11
|
+
label: '多栏视图'
|
package/lib/client.js
CHANGED
|
@@ -17,7 +17,7 @@ window.__ModuleLoader__.load({
|
|
|
17
17
|
*/
|
|
18
18
|
const PLUGIN_LABEL = "多栏视图";
|
|
19
19
|
/* 与 package.json 的 version 必须一致(发版时两处同改;check-names.cjs 会校验)。 */
|
|
20
|
-
const PLUGIN_VERSION = "1.0.
|
|
20
|
+
const PLUGIN_VERSION = "1.0.52";
|
|
21
21
|
const NPM_LATEST_URL = "https://registry.npmjs.org/dsh-multipane/latest";
|
|
22
22
|
|
|
23
23
|
|
|
@@ -229,6 +229,7 @@ const PLUGIN_VERSION = "1.0.51";
|
|
|
229
229
|
"检查失败:{0}": "Check failed: {0}",
|
|
230
230
|
"正在从 npm 下载…": "Downloading from npm…",
|
|
231
231
|
"已更新到 {0},重启 App 后生效": "Updated to {0}; restart the app to apply",
|
|
232
|
+
"已更新到 {0},但依赖登记没同步({1}):下次装/卸别的插件可能把它退回旧版": "Updated to {0}, but the profile's dependency record was not synced ({1}) — installing or removing another plugin later may roll it back",
|
|
232
233
|
"更新失败:{0}": "Update failed: {0}",
|
|
233
234
|
"正在更新…": "Updating…",
|
|
234
235
|
"现在有 {0} 个会话正在运行。更新会替换插件文件,那个会话可能在半路读到新旧混着的代码而报错。确定要继续,就再点一次「仍然更新」。": "{0} sessions are running now. Updating replaces plugin files, so a running session may read a mix of old and new code and fail. Click \"Update anyway\" again to continue.",
|
|
@@ -2328,14 +2329,14 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
2328
2329
|
.dsv-pane .dsv-body [data-content-phase="active"] .an3WzG_scrollBody:has([data-chat-flow])>.an3WzG_composerSeat{margin-top:0}
|
|
2329
2330
|
/* 宿主聊天滚动管理器在「工具/明细折叠」后会在内容下方预留最多半个滚动区高度的空白,
|
|
2330
2331
|
在窄栏里尤其明显;这里把它的预留位清零。 */
|
|
2331
|
-
.dsv-pane .dsv-body [data-chat-turn-spacer]{height:0!important}
|
|
2332
|
-
|
|
2333
|
-
/* ==== 1.0.46:窗格里的「轮次导航条」不再忽隐忽现(会话右侧那列短横线)====
|
|
2334
|
-
宿主在会话宽度 ≤900px 时整条 display:none,分栏后每栏必然更窄,于是开着插件
|
|
2335
|
-
它就没了。1.0.45 把它放开,却又用 display:none 在窄窗格里收回:来回切 display
|
|
2336
|
-
会让宿主的虚拟滚动把可用高度量成 0 并留在状态里,宽度回来也没人重算 ——
|
|
2337
|
-
拉窄消失后拖回原宽度也回不来(单向棘轮)。现在显示恒为 block(布局与测量
|
|
2338
|
-
一直在),只有窄到放不下时才隐藏**可见性**,恢复宽度立刻可见。
|
|
2332
|
+
.dsv-pane .dsv-body [data-chat-turn-spacer]{height:0!important}
|
|
2333
|
+
|
|
2334
|
+
/* ==== 1.0.46:窗格里的「轮次导航条」不再忽隐忽现(会话右侧那列短横线)====
|
|
2335
|
+
宿主在会话宽度 ≤900px 时整条 display:none,分栏后每栏必然更窄,于是开着插件
|
|
2336
|
+
它就没了。1.0.45 把它放开,却又用 display:none 在窄窗格里收回:来回切 display
|
|
2337
|
+
会让宿主的虚拟滚动把可用高度量成 0 并留在状态里,宽度回来也没人重算 ——
|
|
2338
|
+
拉窄消失后拖回原宽度也回不来(单向棘轮)。现在显示恒为 block(布局与测量
|
|
2339
|
+
一直在),只有窄到放不下时才隐藏**可见性**,恢复宽度立刻可见。
|
|
2339
2340
|
选择器用结构条件、不写宿主的哈希类名(如 SNx2jG_*),宿主升级换了哈希也不会失效。
|
|
2340
2341
|
|
|
2341
2342
|
⚠️ 1.0.50 修正:不能用 nav:has(button[data-index]) 当开关。宿主在容器宽度
|
|
@@ -3506,8 +3507,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
3506
3507
|
return null;
|
|
3507
3508
|
}, []);
|
|
3508
3509
|
|
|
3509
|
-
const paneId = react.useContext(PaneIdCtx);
|
|
3510
|
-
|
|
3510
|
+
const paneId = react.useContext(PaneIdCtx);
|
|
3511
|
+
|
|
3511
3512
|
/* ── 1.0.49:轮次导航条在窗格里不出现的取证 + 修正刺激 ──────────────────
|
|
3512
3513
|
宿主源码(app.asar → dsh-client-ui-chat/lib/client.js)里,那条短横线要同时满足:
|
|
3513
3514
|
1) `scroll.initialized === true` 才渲染 TurnNavigator(第 3622 行);
|
|
@@ -3624,7 +3625,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
3624
3625
|
sessionId,
|
|
3625
3626
|
paneId
|
|
3626
3627
|
]);
|
|
3627
|
-
|
|
3628
|
+
|
|
3628
3629
|
if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-empty" }, t("这个版本没有提供会话内容区域"));
|
|
3629
3630
|
|
|
3630
3631
|
// A blank tab is the host's own "new session" page: the content factory
|
|
@@ -4952,7 +4953,7 @@ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-e
|
|
|
4952
4953
|
h(TabContentMemo, {
|
|
4953
4954
|
sessionId: tabSessionId,
|
|
4954
4955
|
hero: tabHero,
|
|
4955
|
-
active: tabActive,
|
|
4956
|
+
active: tabActive,
|
|
4956
4957
|
sessions,
|
|
4957
4958
|
renderFactorySlot,
|
|
4958
4959
|
SessionProvider,
|
|
@@ -7764,10 +7765,14 @@ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-e
|
|
|
7764
7765
|
const why = body === null || body === void 0 ? `HTTP ${res.status}` : hostMessage(String(body.message ?? ""));
|
|
7765
7766
|
throw new Error(why === "" ? `HTTP ${res.status}` : why);
|
|
7766
7767
|
}
|
|
7768
|
+
/* 宿主会在 warn 里说明「文件装好了,但 profile 的 package.json / pnpm-lock
|
|
7769
|
+
没改成功」。这种情况不能报成功就完事:下一次装别的插件还是会把它退回旧版,
|
|
7770
|
+
用户会再看到一模一样的「发现新版本」。 */
|
|
7771
|
+
const warn = body !== null && typeof body.warn === "string" ? body.warn.trim() : "";
|
|
7767
7772
|
setUpdate((prev) => ({
|
|
7768
7773
|
...prev,
|
|
7769
7774
|
phase: "done",
|
|
7770
|
-
text: t("已更新到 {0},重启 App 后生效", [target]),
|
|
7775
|
+
text: warn === "" ? t("已更新到 {0},重启 App 后生效", [target]) : t("已更新到 {0},但依赖登记没同步({1}):下次装/卸别的插件可能把它退回旧版", [target, hostMessage(warn)]),
|
|
7771
7776
|
canUpdate: false,
|
|
7772
7777
|
progress: 100,
|
|
7773
7778
|
forceHint: ""
|
package/lib/index.js
CHANGED
|
@@ -1,241 +1,433 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Host half of dsh-split-view.
|
|
3
|
-
*
|
|
4
|
-
* The feature is a pure client-surface extension: it registers a `main` panel
|
|
5
|
-
* that renders the existing conversation panel several times, each bound to its
|
|
6
|
-
* own session. `apply` therefore has one real job beyond keeping the bundle row
|
|
7
|
-
* mountable: keep this plugin installable through the plugin market on THIS
|
|
8
|
-
* machine.
|
|
9
|
-
*
|
|
10
|
-
* pnpm refuses packages younger than the profile's minimumReleaseAge unless that
|
|
11
|
-
* exact version is listed under minimumReleaseAgeExclude in
|
|
12
|
-
* ~/.dsh/profiles/<profile>/pnpm-workspace.yaml. That list is per-machine and
|
|
13
|
-
* per-profile, so every release used to break "update from the settings page" on
|
|
14
|
-
* any machine whose list had not been edited by hand — something a user should
|
|
15
|
-
* never have to do, and cannot reasonably do without a terminal.
|
|
16
|
-
*
|
|
17
|
-
* The host half has filesystem access, so it keeps the bookkeeping itself: on
|
|
18
|
-
* load, append the running version to the existing dsh-multipane line when it is
|
|
19
|
-
* missing. Nothing here may affect plugin loading, so every path is guarded.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
try {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Host half of dsh-split-view.
|
|
3
|
+
*
|
|
4
|
+
* The feature is a pure client-surface extension: it registers a `main` panel
|
|
5
|
+
* that renders the existing conversation panel several times, each bound to its
|
|
6
|
+
* own session. `apply` therefore has one real job beyond keeping the bundle row
|
|
7
|
+
* mountable: keep this plugin installable through the plugin market on THIS
|
|
8
|
+
* machine.
|
|
9
|
+
*
|
|
10
|
+
* pnpm refuses packages younger than the profile's minimumReleaseAge unless that
|
|
11
|
+
* exact version is listed under minimumReleaseAgeExclude in
|
|
12
|
+
* ~/.dsh/profiles/<profile>/pnpm-workspace.yaml. That list is per-machine and
|
|
13
|
+
* per-profile, so every release used to break "update from the settings page" on
|
|
14
|
+
* any machine whose list had not been edited by hand — something a user should
|
|
15
|
+
* never have to do, and cannot reasonably do without a terminal.
|
|
16
|
+
*
|
|
17
|
+
* The host half has filesystem access, so it keeps the bookkeeping itself: on
|
|
18
|
+
* load, append the running version to the existing dsh-multipane line when it is
|
|
19
|
+
* missing. Nothing here may affect plugin loading, so every path is guarded.
|
|
20
|
+
*
|
|
21
|
+
* The same account has a second half, and skipping it is what made an update look
|
|
22
|
+
* like it never happened: installing the files under node_modules does NOT touch
|
|
23
|
+
* the profile's package.json or pnpm-lock.yaml, which still pin the OLD version.
|
|
24
|
+
* The next `pnpm install` in that profile — installing or removing ANY other
|
|
25
|
+
* plugin — then re-materialises the locked version over the fresh files, silently
|
|
26
|
+
* downgrading this plugin and bringing the "new version available" prompt right
|
|
27
|
+
* back (measured 2026-11-12: 1.0.51 installed, the 9:42 synapse install later,
|
|
28
|
+
* directory 1.0.37 again, settings page still offering 1.0.51). So a successful
|
|
29
|
+
* update now also rewrites both bookkeeping files to the new version and its
|
|
30
|
+
* integrity, and writes neither when either edit cannot be proven exact.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
34
|
+
import { execFile } from "node:child_process";
|
|
35
|
+
import { createHash } from "node:crypto";
|
|
36
|
+
import { homedir } from "node:os";
|
|
37
|
+
import { join } from "node:path";
|
|
38
|
+
import { fileURLToPath } from "node:url";
|
|
39
|
+
|
|
40
|
+
/** Cordis plugin name used by the loader row. */
|
|
41
|
+
export const name = 'dsh-split-view';
|
|
42
|
+
|
|
43
|
+
/** No host services are required. */
|
|
44
|
+
export const inject = [];
|
|
45
|
+
|
|
46
|
+
/** Package name as published; also the name the market knows. */
|
|
47
|
+
const PKG_NAME = "dsh-multipane";
|
|
48
|
+
|
|
49
|
+
function readOwnVersion() {
|
|
50
|
+
try {
|
|
51
|
+
const pkgPath = fileURLToPath(new URL("../package.json", import.meta.url));
|
|
52
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
53
|
+
return typeof pkg.version === "string" ? pkg.version : "";
|
|
54
|
+
} catch {
|
|
55
|
+
return "";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Append `version` to the dsh-multipane row of one profile's pnpm-workspace.yaml.
|
|
61
|
+
* The row has to be edited in place: pnpm honours only the FIRST rule per package
|
|
62
|
+
* name, so appending a second line for the same name is ignored.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} profileDir absolute path of the profile directory
|
|
65
|
+
* @param {string} version version to allow
|
|
66
|
+
* @returns boolean whether the file was changed
|
|
67
|
+
*/
|
|
68
|
+
function allowVersionOnThisMachine(profileDir, version) {
|
|
69
|
+
const yamlPath = join(profileDir, "pnpm-workspace.yaml");
|
|
70
|
+
if (!existsSync(yamlPath)) return false;
|
|
71
|
+
const lines = readFileSync(yamlPath, "utf8").split(/\r?\n/);
|
|
72
|
+
const index = lines.findIndex((line) => line.indexOf(PKG_NAME + "@") >= 0);
|
|
73
|
+
if (index < 0) return false;
|
|
74
|
+
const escaped = version.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
75
|
+
if (new RegExp("(^|[\\s|])" + escaped + "(\\s|$)").test(lines[index])) return false;
|
|
76
|
+
lines[index] = lines[index].trimEnd() + " || " + version;
|
|
77
|
+
writeFileSync(yamlPath, lines.join("\n"), "utf8");
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Escape a literal string so it can be embedded in a RegExp source.
|
|
83
|
+
*
|
|
84
|
+
* @param {string} text literal text
|
|
85
|
+
* @returns string regex-safe text
|
|
86
|
+
*/
|
|
87
|
+
function escapeRegex(text) {
|
|
88
|
+
return String(text).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* npm-style sha512 integrity of a file ("sha512-" + base64 of the digest).
|
|
93
|
+
*
|
|
94
|
+
* pnpm stores exactly this string as the lockfile entry's integrity. A stale or
|
|
95
|
+
* invented one makes the next install treat the package as tampered with, which
|
|
96
|
+
* is worse than leaving the old entry alone.
|
|
97
|
+
*
|
|
98
|
+
* @param {string} file absolute path of the tarball
|
|
99
|
+
* @returns {string} integrity string, or "" when the file cannot be read
|
|
100
|
+
*/
|
|
101
|
+
function integrityOfFile(file) {
|
|
102
|
+
try {
|
|
103
|
+
return "sha512-" + createHash("sha512").update(readFileSync(file)).digest("base64");
|
|
104
|
+
} catch {
|
|
105
|
+
return "";
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Point the profile's dependency bookkeeping at `version`.
|
|
111
|
+
*
|
|
112
|
+
* Two files decide what the next `pnpm install` believes about this package:
|
|
113
|
+
* package.json (the specifier the profile asks for) and pnpm-lock.yaml (the
|
|
114
|
+
* specifier it expects, plus the version and integrity it will materialise). If
|
|
115
|
+
* both keep naming the old version, the very next install in the profile
|
|
116
|
+
* silently downgrades the files an update just wrote.
|
|
117
|
+
*
|
|
118
|
+
* Both files are edited as text rather than through a JSON/YAML round-trip, so
|
|
119
|
+
* the user's formatting survives. Nothing is written unless both edits are known
|
|
120
|
+
* to be exact: half-updated bookkeeping (new specifier, old lock entry) would
|
|
121
|
+
* make pnpm reject the whole profile instead of merely rolling this one package
|
|
122
|
+
* back — a much worse failure than the bug being fixed.
|
|
123
|
+
*
|
|
124
|
+
* @param {string} profileDir absolute path of the profile directory
|
|
125
|
+
* @param {string} version version that was just installed
|
|
126
|
+
* @param {string} integrity sha512 integrity of the tarball that was installed
|
|
127
|
+
* @returns {{ok: boolean, changed: boolean, problems: string[]}} result
|
|
128
|
+
*/
|
|
129
|
+
function syncDependencyBookkeeping(profileDir, version, integrity) {
|
|
130
|
+
const pkgPath = join(profileDir, "package.json");
|
|
131
|
+
const lockPath = join(profileDir, "pnpm-lock.yaml");
|
|
132
|
+
const problems = [];
|
|
133
|
+
|
|
134
|
+
let pkgText = "";
|
|
135
|
+
let lockText = "";
|
|
136
|
+
try {
|
|
137
|
+
if (existsSync(pkgPath)) pkgText = readFileSync(pkgPath, "utf8");
|
|
138
|
+
} catch (error) {
|
|
139
|
+
problems.push("读不了 package.json:" + String((error && error.message) || error));
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
if (existsSync(lockPath)) lockText = readFileSync(lockPath, "utf8");
|
|
143
|
+
} catch (error) {
|
|
144
|
+
problems.push("读不了 pnpm-lock.yaml:" + String((error && error.message) || error));
|
|
145
|
+
}
|
|
146
|
+
if (pkgText === "") problems.push("找不到 profile 的 package.json");
|
|
147
|
+
if (lockText === "") problems.push("找不到 pnpm-lock.yaml");
|
|
148
|
+
|
|
149
|
+
/* 依赖行本就存在的三种形状都认:dependencies、devDependencies、optional… 这里只按
|
|
150
|
+
「"dsh-multipane": "<spec>"」这一处文本换掉 spec,不关心它在哪个段里。 */
|
|
151
|
+
const depRe = new RegExp('("' + escapeRegex(PKG_NAME) + '"\\s*:\\s*")[^"]*(")');
|
|
152
|
+
if (pkgText !== "" && !depRe.test(pkgText)) problems.push("package.json 里没有 " + PKG_NAME + " 的依赖行");
|
|
153
|
+
if (problems.length > 0) return { ok: false, changed: false, problems };
|
|
154
|
+
|
|
155
|
+
/* importer 块:specifier 与 version 成对出现,两行都要换。前导换行必须在捕获组里,
|
|
156
|
+
否则替换会把上一行与这一行粘成一行 —— YAML 直接坏掉,pnpm 拒绝整个 profile。 */
|
|
157
|
+
const importerRe = new RegExp("(\\n " + escapeRegex(PKG_NAME) + ":\\n specifier: )([^\\n]*)(\\n version: )([^\\n]*)");
|
|
158
|
+
const hit = lockText.match(importerRe);
|
|
159
|
+
if (hit === null) return { ok: false, changed: false, problems: ["pnpm-lock 里没有 " + PKG_NAME + " 的 importer 块"] };
|
|
160
|
+
/* version 可能带 peer 后缀(1.0.37(@deepseek-ai/dsh@…)),键名里只比裸版本号。 */
|
|
161
|
+
const previous = hit[4].trim().split("(")[0];
|
|
162
|
+
const changed = previous !== version;
|
|
163
|
+
|
|
164
|
+
let nextLock = lockText;
|
|
165
|
+
if (changed) {
|
|
166
|
+
nextLock = nextLock.replace(importerRe, (all, head, spec, mid) => head + version + mid + version);
|
|
167
|
+
/* packages 段与 snapshots 段各有一条键: dsh-multipane@<版本>: */
|
|
168
|
+
const keyRe = new RegExp("(^|\\n)( " + escapeRegex(PKG_NAME) + "@)" + escapeRegex(previous) + "(?=[:(])", "g");
|
|
169
|
+
const keys = (nextLock.match(keyRe) || []).length;
|
|
170
|
+
if (keys < 1) return { ok: false, changed: false, problems: ["pnpm-lock 里找不到 " + PKG_NAME + "@" + previous + " 的条目"] };
|
|
171
|
+
nextLock = nextLock.replace(keyRe, (all, lead, prefix) => lead + prefix + version);
|
|
172
|
+
if (integrity !== "") {
|
|
173
|
+
const resRe = new RegExp("(\\n " + escapeRegex(PKG_NAME) + "@" + escapeRegex(version) + ":\\n resolution: \\{integrity: )[^}\\n]+(\\})");
|
|
174
|
+
if (!resRe.test(nextLock)) return { ok: false, changed: false, problems: ["pnpm-lock 里找不到 " + version + " 的 integrity 行"] };
|
|
175
|
+
nextLock = nextLock.replace(resRe, (all, head, tail) => head + integrity + tail);
|
|
176
|
+
}
|
|
177
|
+
const guard = lockEditProblems(lockText, nextLock, version);
|
|
178
|
+
if (guard.length > 0) {
|
|
179
|
+
return { ok: false, changed: false, problems: guard.map((one) => "pnpm-lock 未写入:" + one) };
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const nextPkg = pkgText.replace(depRe, (all, head, tail) => head + version + tail);
|
|
183
|
+
|
|
184
|
+
try {
|
|
185
|
+
if (changed) writeFileSync(lockPath, nextLock, "utf8");
|
|
186
|
+
writeFileSync(pkgPath, nextPkg, "utf8");
|
|
187
|
+
} catch (error) {
|
|
188
|
+
try {
|
|
189
|
+
if (changed) writeFileSync(lockPath, lockText, "utf8");
|
|
190
|
+
} catch {
|
|
191
|
+
/* 回滚失败也不抛出:调用方拿 problems 里的原因去提示用户 */
|
|
192
|
+
}
|
|
193
|
+
return { ok: false, changed: false, problems: ["写登记文件失败:" + String((error && error.message) || error)] };
|
|
194
|
+
}
|
|
195
|
+
return { ok: true, changed, problems: [] };
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Guard the lockfile edit: only the lines we meant to touch may differ.
|
|
200
|
+
*
|
|
201
|
+
* A text edit that swallows a newline still "looks" fine in the editor but makes
|
|
202
|
+
* the file unparseable, and pnpm then refuses the whole profile instead of merely
|
|
203
|
+
* rolling one package back. Comparing line by line makes that impossible to ship:
|
|
204
|
+
* the edit is accepted only when the line count is unchanged and every changed
|
|
205
|
+
* line is one of the expected shapes.
|
|
206
|
+
*
|
|
207
|
+
* It returns the reasons it refused (empty array = clean) rather than a bare
|
|
208
|
+
* false: a silent rejection is exactly the kind of detail that is impossible to
|
|
209
|
+
* support later, and the caller shows these strings to the user.
|
|
210
|
+
*
|
|
211
|
+
* @param {string} before lock text as read
|
|
212
|
+
* @param {string} after lock text as edited
|
|
213
|
+
* @param {string} version version that was installed
|
|
214
|
+
* @returns {string[]} problems, empty when the edit is clean
|
|
215
|
+
*/
|
|
216
|
+
function lockEditProblems(before, after, version) {
|
|
217
|
+
const a = before.split("\n");
|
|
218
|
+
const b = after.split("\n");
|
|
219
|
+
if (a.length !== b.length) return ["行数从 " + a.length + " 变成 " + b.length];
|
|
220
|
+
/* 预期最多 5 行:importer 的 specifier 与 version、packages 键、snapshots 键、
|
|
221
|
+
packages 条目的 integrity。 */
|
|
222
|
+
const maxChanged = 5;
|
|
223
|
+
const allowed = [
|
|
224
|
+
new RegExp("^ specifier: " + escapeRegex(version) + "$"),
|
|
225
|
+
new RegExp("^ version: " + escapeRegex(version) + "(?:\\(.*\\))?$"),
|
|
226
|
+
/* snapshots 的条目带一个空映射: dsh-multipane@1.0.51: {} */
|
|
227
|
+
new RegExp("^ " + escapeRegex(PKG_NAME) + "@" + escapeRegex(version) + "(?:\\(.*\\))?:(?:\\s*\\{\\s*\\})?$"),
|
|
228
|
+
/^ resolution: \{integrity: sha512-[^}]+\}$/
|
|
229
|
+
];
|
|
230
|
+
const problems = [];
|
|
231
|
+
let changed = 0;
|
|
232
|
+
for (let i = 0; i < a.length; i += 1) {
|
|
233
|
+
if (a[i] === b[i]) continue;
|
|
234
|
+
changed += 1;
|
|
235
|
+
if (changed > maxChanged) {
|
|
236
|
+
problems.push("改了 " + changed + " 行,超过上限 " + maxChanged);
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
if (!allowed.some((rule) => rule.test(b[i]))) {
|
|
240
|
+
problems.push("第 " + (i + 1) + " 行不在预期范围内:" + b[i].trim().slice(0, 60));
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (problems.length === 0 && changed === 0) problems.push("没有产生任何改动");
|
|
244
|
+
return problems;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Try every profile that exists on this machine (desktop is what the app uses,
|
|
249
|
+
* web is used by headless checks). Unknown layouts are skipped silently.
|
|
250
|
+
*/
|
|
251
|
+
function ensureMarketInstallable() {
|
|
252
|
+
try {
|
|
253
|
+
const version = readOwnVersion();
|
|
254
|
+
if (version === "") return;
|
|
255
|
+
const root = join(homedir(), ".dsh", "profiles");
|
|
256
|
+
if (!existsSync(root)) return;
|
|
257
|
+
for (const profile of ["desktop", "web"]) {
|
|
258
|
+
try {
|
|
259
|
+
allowVersionOnThisMachine(join(root, profile), version);
|
|
260
|
+
} catch {
|
|
261
|
+
/* 单个 profile 失败不影响另一个,也不影响插件加载 */
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
} catch {
|
|
265
|
+
/* 绝不因为这里失败而挡住插件加载 */
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Mount the host half.
|
|
271
|
+
*
|
|
272
|
+
* @returns void
|
|
273
|
+
*/
|
|
274
|
+
const UPDATE_ROUTE = "/dsh-multipane/update";
|
|
275
|
+
const STATUS_ROUTE = "/dsh-multipane/status";
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Install one published version straight from the npm registry.
|
|
279
|
+
*
|
|
280
|
+
* Why not the package manager: the market path goes through pnpm, which refuses
|
|
281
|
+
* releases younger than the profile's minimumReleaseAge, and the market itself
|
|
282
|
+
* syncs its catalog minutes behind the registry. Downloading the published
|
|
283
|
+
* tarball and unpacking it is what "update from npm" means here — no pnpm, no
|
|
284
|
+
* third-party catalog, no release-age wait.
|
|
285
|
+
*
|
|
286
|
+
* Safety: copy the current directory aside first, and put it back if anything
|
|
287
|
+
* fails, so a half-written plugin can never brick the app. A successful copy is
|
|
288
|
+
* followed by syncDependencyBookkeeping, which makes the profile's package.json
|
|
289
|
+
* and pnpm-lock.yaml name the same version — without that, the next install in
|
|
290
|
+
* this profile rolls the directory straight back.
|
|
291
|
+
*
|
|
292
|
+
* @param {string} profileDir profile directory that owns node_modules
|
|
293
|
+
* @param {string} version version to install
|
|
294
|
+
* @returns {Promise<{ok: boolean, message: string, warn: string}>} result
|
|
295
|
+
*/
|
|
296
|
+
function installFromRegistry(profileDir, version) {
|
|
297
|
+
const target = join(profileDir, "node_modules", PKG_NAME);
|
|
298
|
+
const staging = join(homedir(), ".dsh", ".dsv-update-" + process.pid);
|
|
299
|
+
const backup = join(homedir(), ".dsh", ".dsv-backup-" + process.pid);
|
|
300
|
+
const tarball = join(staging, "pkg.tgz");
|
|
301
|
+
const url = "https://registry.npmjs.org/" + PKG_NAME + "/-/" + PKG_NAME + "-" + version + ".tgz";
|
|
302
|
+
const run = (file, args, options) =>
|
|
303
|
+
new Promise((resolve) => {
|
|
304
|
+
execFile(file, args, Object.assign({ timeout: 120000, windowsHide: true }, options || {}), (error, stdout, stderr) => {
|
|
305
|
+
resolve({ ok: error === null, out: String(stdout || ""), err: String(stderr || (error && error.message) || "") });
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
return (async () => {
|
|
309
|
+
try {
|
|
310
|
+
rmSync(staging, { recursive: true, force: true });
|
|
311
|
+
rmSync(backup, { recursive: true, force: true });
|
|
312
|
+
mkdirSync(staging, { recursive: true });
|
|
313
|
+
const dl = await run("curl", ["-sSL", "--noproxy", "*", "--max-time", "110", "-o", tarball, url]);
|
|
314
|
+
if (!dl.ok || !existsSync(tarball)) return { ok: false, message: "下载失败:" + dl.err.slice(0, 200) };
|
|
315
|
+
/* 必须用 Windows 自带的 bsdtar:git-bash 里的 GNU tar 会把 "C:/…" 当成
|
|
316
|
+
host:path 语法去连远程主机(报 "Cannot connect to C: resolve failed")。 */
|
|
317
|
+
const tarExe = existsSync("C:/Windows/System32/tar.exe") ? "C:/Windows/System32/tar.exe" : "tar";
|
|
318
|
+
const un = await run(tarExe, ["-xzf", tarball, "-C", staging]);
|
|
319
|
+
if (!un.ok) return { ok: false, message: "解压失败:" + un.err.slice(0, 200) };
|
|
320
|
+
const unpacked = join(staging, "package");
|
|
321
|
+
if (!existsSync(join(unpacked, "package.json"))) return { ok: false, message: "包里没有 package.json" };
|
|
322
|
+
const got = JSON.parse(readFileSync(join(unpacked, "package.json"), "utf8")).version;
|
|
323
|
+
if (got !== version) return { ok: false, message: "包内版本是 " + got + ",不是 " + version };
|
|
324
|
+
/* integrity 要从解压前的 tgz 算,解压完 staging 就删了。 */
|
|
325
|
+
const integrity = integrityOfFile(tarball);
|
|
326
|
+
if (existsSync(target)) {
|
|
327
|
+
cpSync(target, backup, { recursive: true });
|
|
328
|
+
}
|
|
329
|
+
rmSync(target, { recursive: true, force: true });
|
|
330
|
+
cpSync(unpacked, target, { recursive: true });
|
|
331
|
+
rmSync(staging, { recursive: true, force: true });
|
|
332
|
+
rmSync(backup, { recursive: true, force: true });
|
|
333
|
+
/* 文件就位只是前半笔账,还要让 profile 的 package.json / pnpm-lock 也指到新版本,
|
|
334
|
+
否则下一次任何 pnpm 安装都会按旧 lockfile 把这个目录重铺回旧版本。 */
|
|
335
|
+
try {
|
|
336
|
+
allowVersionOnThisMachine(profileDir, version);
|
|
337
|
+
} catch {
|
|
338
|
+
/* 免查名单只影响「从插件市场更新」,不影响已经装好的文件 */
|
|
339
|
+
}
|
|
340
|
+
const sync = syncDependencyBookkeeping(profileDir, version, integrity);
|
|
341
|
+
if (sync.ok) return { ok: true, message: "已安装 " + version, warn: "" };
|
|
342
|
+
return { ok: true, message: "已安装 " + version, warn: sync.problems.join(";") };
|
|
343
|
+
} catch (error) {
|
|
344
|
+
try {
|
|
345
|
+
if (existsSync(backup)) {
|
|
346
|
+
rmSync(target, { recursive: true, force: true });
|
|
347
|
+
cpSync(backup, target, { recursive: true });
|
|
348
|
+
}
|
|
349
|
+
} catch {
|
|
350
|
+
/* 回滚失败也不抛出 */
|
|
351
|
+
}
|
|
352
|
+
return { ok: false, message: String((error && error.message) || error) };
|
|
353
|
+
}
|
|
354
|
+
})();
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function readJsonBody(request, limit, done) {
|
|
358
|
+
let body = "";
|
|
359
|
+
let aborted = false;
|
|
360
|
+
request.on("data", (chunk) => {
|
|
361
|
+
body += chunk;
|
|
362
|
+
if (body.length > limit) {
|
|
363
|
+
aborted = true;
|
|
364
|
+
request.destroy();
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
request.on("end", () => {
|
|
368
|
+
if (!aborted) done(body);
|
|
369
|
+
});
|
|
370
|
+
request.on("error", () => {
|
|
371
|
+
/* 忽略 */
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export function apply(ctx) {
|
|
376
|
+
try {
|
|
377
|
+
ensureMarketInstallable();
|
|
378
|
+
} catch {
|
|
379
|
+
/* 忽略 */
|
|
380
|
+
}
|
|
381
|
+
try {
|
|
382
|
+
ctx.inject(["webServer"], (host) => {
|
|
383
|
+
const profileDirOf = () => join(homedir(), ".dsh", "profiles", "desktop");
|
|
384
|
+
const routes = [
|
|
385
|
+
{
|
|
386
|
+
kind: "exact",
|
|
387
|
+
path: STATUS_ROUTE,
|
|
388
|
+
handler: (request, response) => {
|
|
389
|
+
response.writeHead(200, { "content-type": "application/json; charset=utf-8", "cache-control": "no-store" });
|
|
390
|
+
response.end(JSON.stringify({ version: readOwnVersion(), profile: profileDirOf() }));
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
kind: "exact",
|
|
395
|
+
path: UPDATE_ROUTE,
|
|
396
|
+
handler: (request, response) => {
|
|
397
|
+
if (request.method !== "POST") {
|
|
398
|
+
response.writeHead(405, { allow: "POST" });
|
|
399
|
+
response.end("");
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
readJsonBody(request, 4096, (body) => {
|
|
403
|
+
let version = "";
|
|
404
|
+
try {
|
|
405
|
+
version = String(JSON.parse(body).version || "");
|
|
406
|
+
} catch {
|
|
407
|
+
/* 交给下面校验 */
|
|
408
|
+
}
|
|
409
|
+
if (!/^\d+\.\d+\.\d+$/.test(version)) {
|
|
410
|
+
response.writeHead(400, { "content-type": "application/json; charset=utf-8" });
|
|
411
|
+
response.end(JSON.stringify({ ok: false, message: "version 参数不合法" }));
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
installFromRegistry(profileDirOf(), version).then((result) => {
|
|
415
|
+
response.writeHead(result.ok ? 200 : 500, { "content-type": "application/json; charset=utf-8" });
|
|
416
|
+
response.end(JSON.stringify(result));
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
];
|
|
422
|
+
for (const route of routes) {
|
|
423
|
+
try {
|
|
424
|
+
host.webServer.register(route);
|
|
425
|
+
} catch {
|
|
426
|
+
/* 单个路由失败不影响另一个 */
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
} catch {
|
|
431
|
+
/* 拿不到 webServer 就只是没有设置页内的更新入口,插件本身照常工作 */
|
|
432
|
+
}
|
|
433
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-multipane",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.52",
|
|
4
4
|
"description": "Split the DSH main area into up to four panes, each with its own tab strip, composer and view switcher. Drag a tab to a pane edge to split. Bilingual (zh/en).",
|
|
5
5
|
"displayName": "多栏视图",
|
|
6
6
|
"dshhub": {
|