dsh-multipane 1.0.24 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/lib/client.js +89 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -246,6 +246,13 @@ C:\Users\weiai\.dsh\plugin-src\_probe\sync-client.ps1 -Push # 台式机 ->
|
|
|
246
246
|
|
|
247
247
|
## 更新记录
|
|
248
248
|
|
|
249
|
+
### 1.0.25(2026-11-10)
|
|
250
|
+
- **不再自己实现更新流程,改成嵌入插件市场自己的面板**:插件市场通过 `ctx.provide("market", …)` 对外提供
|
|
251
|
+
`render()`,返回它完整的「已安装」面板(含新版本检测、会话运行确认、进度、失败回滚)。
|
|
252
|
+
设置页里点「打开更新」直接把它嵌进来——所有安装逻辑都由市场作者自己维护的那套负责。
|
|
253
|
+
之前几版的问题正是「在市场上又包了一层自己的实现」,每漏一个参数(`confirmAgentsRunning`、
|
|
254
|
+
缓存时间戳、同版本重装保护)就卡住一次。
|
|
255
|
+
|
|
249
256
|
### 1.0.24(2026-11-10)
|
|
250
257
|
- **市场缓存旧时自动重查一次**:市场对同一 URL 有服务端缓存,刚到新版本时第一次查可能还是旧值。
|
|
251
258
|
现在发现 npm 上更新且市场说「已最新」时,会当场换时间戳重查一次——拿到就直接弹更新框,
|
package/lib/client.js
CHANGED
|
@@ -17,8 +17,25 @@ 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.25";
|
|
21
21
|
const NPM_LATEST_URL = "https://registry.npmjs.org/dsh-multipane/latest";
|
|
22
|
+
/**
|
|
23
|
+
* 插件市场把自己注册成客户端服务 `market`(`ctx.provide("market", …)`),
|
|
24
|
+
* 并提供 render() 用来把它的完整面板嵌进任何宿主界面。
|
|
25
|
+
* 安装/更新/回滚/会话运行检查全是它自己的逻辑 —— 凡是「自己再实现一遍」的做法
|
|
26
|
+
* 都会漏掉它的某个参数(confirmAgentsRunning、缓存时间戳、同版本重装保护…),
|
|
27
|
+
* 所以这里只调它的 render(),不复制它的流程。
|
|
28
|
+
*/
|
|
29
|
+
function getMarketService() {
|
|
30
|
+
try {
|
|
31
|
+
const ctx = window.__dsv === void 0 ? void 0 : window.__dsv.ctx;
|
|
32
|
+
if (ctx === void 0 || ctx === null || typeof ctx.reflect?.get !== "function") return null;
|
|
33
|
+
const svc = ctx.reflect.get("market");
|
|
34
|
+
return svc !== null && svc !== void 0 && typeof svc.render === "function" ? svc : null;
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
22
39
|
/* 插件市场的公开更新 API v1(dshmarket 提供,见其 UPDATE-API-V1.md)。
|
|
23
40
|
它自己负责装包/校验版本/回滚,我们只负责触发和显示结果——
|
|
24
41
|
不要再自己去跑 npm install,那会覆盖正在运行的文件。 */
|
|
@@ -1825,6 +1842,13 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
1825
1842
|
.dsv-modal-actions button[data-primary="1"]{background:var(--dsh-accent-color,#4a8cf7);border-color:transparent;color:#fff;font-weight:500}
|
|
1826
1843
|
.dsv-modal-actions button[data-primary="1"]:hover{filter:brightness(1.08)}
|
|
1827
1844
|
.dsv-modal-actions button:disabled{opacity:.55;cursor:default}
|
|
1845
|
+
/* 嵌入式插件市场面板:走市场自己的 UI 完成安装/更新/回滚,我们只提供容器 */
|
|
1846
|
+
.dsv-market-shell{position:fixed;inset:0;background:rgba(0,0,0,.66);z-index:10000;display:flex;align-items:center;justify-content:center}
|
|
1847
|
+
.dsv-market-box{width:min(1180px,94vw);height:min(800px,88vh);display:flex;flex-direction:column;border-radius:14px;overflow:hidden;border:1px solid var(--dsh-border-color,rgba(128,128,128,.34));background:var(--dsv-page-bg,#1b1b1d);box-shadow:0 30px 80px -24px rgba(0,0,0,.9)}
|
|
1848
|
+
.dsv-market-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 14px;border-bottom:1px solid var(--dsh-border-color,rgba(128,128,128,.24))}
|
|
1849
|
+
.dsv-market-title{font-size:13.5px;font-weight:600}
|
|
1850
|
+
.dsv-market-body{flex:1 1 auto;min-height:0;overflow:auto}
|
|
1851
|
+
.dsv-market-fallback{padding:16px;font-size:12.5px;line-height:1.8;opacity:.85}
|
|
1828
1852
|
.dsv-page-title-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
|
|
1829
1853
|
.dsv-page-title{font-size:19px;font-weight:700;letter-spacing:.01em;margin:0}
|
|
1830
1854
|
.dsv-badge{display:inline-flex;align-items:center;gap:5px;height:20px;padding:0 8px;border-radius:999px;font-size:11px;font-weight:600;border:1px solid transparent}
|
|
@@ -6436,6 +6460,31 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
6436
6460
|
checkedAt: ""
|
|
6437
6461
|
});
|
|
6438
6462
|
const closeModal = () => setUpdate((prev) => ({ ...prev, modal: false }));
|
|
6463
|
+
/* 嵌入式市场面板:打开后由市场自己处理安装/更新,包括「有会话在跑」的确认与回滚 */
|
|
6464
|
+
const [marketOpen, setMarketOpen] = react.useState(false);
|
|
6465
|
+
const openMarket = () => {
|
|
6466
|
+
setUpdate((prev) => ({ ...prev, modal: false }));
|
|
6467
|
+
setMarketOpen(true);
|
|
6468
|
+
};
|
|
6469
|
+
const renderMarketPanel = () => {
|
|
6470
|
+
const svc = getMarketService();
|
|
6471
|
+
if (svc === null) {
|
|
6472
|
+
return h(
|
|
6473
|
+
"div",
|
|
6474
|
+
{ className: "dsv-market-fallback" },
|
|
6475
|
+
"没有找到插件市场。请关闭这个窗口,改从左侧「插件市场」→「已安装」里更新本插件。"
|
|
6476
|
+
);
|
|
6477
|
+
}
|
|
6478
|
+
try {
|
|
6479
|
+
return svc.render({ preferredSubsectionId: "installed" });
|
|
6480
|
+
} catch (err) {
|
|
6481
|
+
return h(
|
|
6482
|
+
"div",
|
|
6483
|
+
{ className: "dsv-market-fallback" },
|
|
6484
|
+
"打开插件市场面板失败:" + String((err && err.message) || err) + "。请改从左侧「插件市场」更新。"
|
|
6485
|
+
);
|
|
6486
|
+
}
|
|
6487
|
+
};
|
|
6439
6488
|
const checkUpdate = async (silent) => {
|
|
6440
6489
|
const quiet = silent === true;
|
|
6441
6490
|
setUpdate({
|
|
@@ -7058,24 +7107,51 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
7058
7107
|
key: "go",
|
|
7059
7108
|
type: "button",
|
|
7060
7109
|
"data-primary": "1",
|
|
7061
|
-
|
|
7062
|
-
onClick: () =>
|
|
7063
|
-
update.canUpdate === true
|
|
7064
|
-
? runUpdate(false, update.agentsBusy === true)
|
|
7065
|
-
: checkUpdate()
|
|
7110
|
+
onClick: update.canUpdate === true ? openMarket : () => checkUpdate()
|
|
7066
7111
|
},
|
|
7067
|
-
update.
|
|
7068
|
-
? "更新中…"
|
|
7069
|
-
: update.agentsBusy === true
|
|
7070
|
-
? "仍然更新"
|
|
7071
|
-
: update.canUpdate === true
|
|
7072
|
-
? "立即更新"
|
|
7073
|
-
: "重新检查"
|
|
7112
|
+
update.canUpdate === true ? "打开更新" : "重新检查"
|
|
7074
7113
|
)
|
|
7075
7114
|
]
|
|
7076
7115
|
)
|
|
7077
7116
|
)
|
|
7078
7117
|
)
|
|
7118
|
+
: null,
|
|
7119
|
+
marketOpen === true
|
|
7120
|
+
? h(
|
|
7121
|
+
"div",
|
|
7122
|
+
{
|
|
7123
|
+
className: "dsv-market-shell",
|
|
7124
|
+
onClick: () => {
|
|
7125
|
+
setMarketOpen(false);
|
|
7126
|
+
}
|
|
7127
|
+
},
|
|
7128
|
+
h(
|
|
7129
|
+
"div",
|
|
7130
|
+
{
|
|
7131
|
+
className: "dsv-market-box",
|
|
7132
|
+
onClick: (event) => {
|
|
7133
|
+
event.stopPropagation();
|
|
7134
|
+
}
|
|
7135
|
+
},
|
|
7136
|
+
h(
|
|
7137
|
+
"div",
|
|
7138
|
+
{ className: "dsv-market-head" },
|
|
7139
|
+
h("span", { className: "dsv-market-title" }, "插件市场 · 已安装"),
|
|
7140
|
+
h(
|
|
7141
|
+
"button",
|
|
7142
|
+
{
|
|
7143
|
+
type: "button",
|
|
7144
|
+
className: "dsv-mini-btn",
|
|
7145
|
+
onClick: () => {
|
|
7146
|
+
setMarketOpen(false);
|
|
7147
|
+
}
|
|
7148
|
+
},
|
|
7149
|
+
"关闭"
|
|
7150
|
+
)
|
|
7151
|
+
),
|
|
7152
|
+
h("div", { className: "dsv-market-body" }, renderMarketPanel())
|
|
7153
|
+
)
|
|
7154
|
+
)
|
|
7079
7155
|
: null
|
|
7080
7156
|
);
|
|
7081
7157
|
}
|
package/package.json
CHANGED