dsh-drydock 1.0.2 → 1.0.3
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 +44 -35
- package/README.md +39 -26
- package/bin/open-boot.mjs +181 -31
- package/lib/aggregate.js +51 -28
- package/lib/client.js +23 -23
- package/lib/downloader.js +87 -20
- package/lib/index.js +434 -58
- package/lib/remote.js +1 -1
- package/lib/rescue.js +20 -3
- package/package.json +4 -3
package/lib/remote.js
CHANGED
|
@@ -71,7 +71,7 @@ const source = z.object({
|
|
|
71
71
|
url: z.string(),
|
|
72
72
|
enabled: z.boolean(),
|
|
73
73
|
official: z.boolean(),
|
|
74
|
-
/** registry=npm 兼容源;github=GitHub Releases;dshfind
|
|
74
|
+
/** registry=npm 兼容源;github=GitHub Releases;dshfind=已移除(仅保留字面量以兼容旧客户端提交,宿主会丢弃)。 */
|
|
75
75
|
type: z.union([
|
|
76
76
|
z.literal("registry"),
|
|
77
77
|
z.literal("github"),
|
package/lib/rescue.js
CHANGED
|
@@ -160,6 +160,23 @@ function esc(s) {
|
|
|
160
160
|
return String(s == null ? "" : s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
// 救援动作统一走事件委托:动作用 data-rescue-action 标记,参数(entryId / 包名)只经 data-* 属性传递。
|
|
164
|
+
// 为什么不能把值拼进内联 onclick 的字符串参数:HTML 解析器会先把属性值里的 ' 解码回 ',
|
|
165
|
+
// 再交给 JS 解析 —— 带单引号的值就能闭合字符串注入脚本,从而读走页面 meta 里的一次性令牌
|
|
166
|
+
// (B 报告 S5 / C 报告 S1)。改成属性 + getAttribute 后,值永远只是字符串数据,不参与 JS 解析。
|
|
167
|
+
document.addEventListener("click", function (ev) {
|
|
168
|
+
var target = ev.target;
|
|
169
|
+
if (!target || typeof target.closest !== "function") return;
|
|
170
|
+
var el = target.closest("[data-rescue-action]");
|
|
171
|
+
if (el === null) return;
|
|
172
|
+
var action = el.getAttribute("data-rescue-action");
|
|
173
|
+
if (action === "quarantine") {
|
|
174
|
+
quarantine(el.getAttribute("data-entry-id") || "", el);
|
|
175
|
+
} else if (action === "uninstall") {
|
|
176
|
+
uninstallPkg(el.getAttribute("data-package-name") || "", el);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
163
180
|
async function diagnose() {
|
|
164
181
|
setBusy("diag-btn", true);
|
|
165
182
|
const status = document.getElementById("diag-status");
|
|
@@ -179,8 +196,8 @@ async function diagnose() {
|
|
|
179
196
|
'<div class="issue"><b>' + esc(issue.configId) + '</b> <span class="muted">' + esc(issue.moduleName) + ' · ' + esc(issue.phase) + '</span>' +
|
|
180
197
|
(issue.error ? '<pre>' + esc(issue.error) + '</pre>' : '') +
|
|
181
198
|
'<div style="margin-top:8px">' +
|
|
182
|
-
(issue.suggestion === "disable" ? '<button
|
|
183
|
-
(issue.canUninstall ? '<button class="danger"
|
|
199
|
+
(issue.suggestion === "disable" ? '<button data-rescue-action="quarantine" data-entry-id="' + esc(issue.entryId) + '">禁用此插件</button>' : '<span class="muted">救援保护条目</span>') +
|
|
200
|
+
(issue.canUninstall ? '<button class="danger" data-rescue-action="uninstall" data-package-name="' + esc(issue.moduleName) + '">卸载</button>' : '') +
|
|
184
201
|
'</div></div>'
|
|
185
202
|
).join("");
|
|
186
203
|
toast("⚠ 诊断发现 " + issues.length + " 个问题条目", "warn");
|
|
@@ -313,7 +330,7 @@ async function loadUninstall() {
|
|
|
313
330
|
box.innerHTML = managed.map((e) =>
|
|
314
331
|
'<div style="display:flex;justify-content:space-between;align-items:center;padding:4px 0;border-bottom:1px solid #232a33">' +
|
|
315
332
|
'<span>' + esc(e.configId) + ' <span class="muted">' + esc(e.moduleName) + '</span></span>' +
|
|
316
|
-
'<button class="danger"
|
|
333
|
+
'<button class="danger" data-rescue-action="uninstall" data-package-name="' + esc(e.moduleName) + '">卸载</button></div>'
|
|
317
334
|
).join("");
|
|
318
335
|
} catch (e) {
|
|
319
336
|
box.innerHTML = '<span class="result bad">读取失败:' + esc(e.message) + '</span>';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-drydock",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "DSH 引擎船坞(drydock,原名 dsh-plugin-manager-pro):本地插件管理器——分类折叠(核心组件/引擎内置组件/用户插件)、更新源一键更新(npm/GitHub
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "DSH 引擎船坞(drydock,原名 dsh-plugin-manager-pro):本地插件管理器——分类折叠(核心组件/引擎内置组件/用户插件)、更新源一键更新(npm/GitHub/自定义镜像)、浏览器下载优先、下载目录自动安装、插件市场(ADP 精选目录)、README 简介提取、救援与启动前自检;事务化卸载(备份→删除→校验→回滚)、操作历史一键撤销、场景方案、来源人工修正、依赖关系感知;独立救援工具链(3082 rescue-daemon / open-boot 浏览器触发自启 / dsh-boot 启动序列);跨平台(Windows/macOS/Linux)",
|
|
5
5
|
"author": "nonentity303",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -64,7 +64,8 @@
|
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"build": "node build.mjs",
|
|
67
|
-
"test": "node build.mjs && node test-bundle.mjs && node test-render.mjs && node test-integration.mjs && node test-launcher.mjs && node test-ux.mjs && node test-downloader.mjs && node test-security-provenance.mjs",
|
|
67
|
+
"test": "node build.mjs && node test-bundle.mjs && node test-admission.mjs && node test-render.mjs && node test-integration.mjs && node test-launcher.mjs && node test-ux.mjs && node test-downloader.mjs && node test-security-provenance.mjs && node test-docs.mjs",
|
|
68
|
+
"test:admission": "node test-admission.mjs",
|
|
68
69
|
"test:launcher": "node test-launcher.mjs",
|
|
69
70
|
"test:strict": "node test-launcher.mjs --strict",
|
|
70
71
|
"test:ux": "node test-ux.mjs",
|