dsh-drydock 1.0.1 → 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/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=插件超市(GitHub dsh-plugin topic 聚合)。 */
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, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
161
161
  }
162
162
 
163
+ // 救援动作统一走事件委托:动作用 data-rescue-action 标记,参数(entryId / 包名)只经 data-* 属性传递。
164
+ // 为什么不能把值拼进内联 onclick 的字符串参数:HTML 解析器会先把属性值里的 &#39; 解码回 ',
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 onclick="quarantine(\\'' + issue.entryId + '\\', this)">禁用此插件</button>' : '<span class="muted">救援保护条目</span>') +
183
- (issue.canUninstall ? '<button class="danger" onclick="uninstallPkg(\\'' + esc(issue.moduleName) + '\\', this)">卸载</button>' : '') +
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" onclick="uninstallPkg(\\'' + esc(e.moduleName).replace(/\\\\/g, "\\\\") + '\\', this)">卸载</button></div>'
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.1",
4
- "description": "DSH 引擎船坞(drydock,原名 dsh-plugin-manager-pro):本地插件管理器——分类折叠(核心组件/引擎内置组件/用户插件)、更新源一键更新(npm/GitHub/插件超市)、浏览器下载优先、下载目录自动安装、插件市场(dshfind 精选目录)、README 简介提取、救援与启动前自检;事务化卸载(备份→删除→校验→回滚)、操作历史一键撤销、场景方案、来源人工修正、依赖关系感知;独立救援工具链(3082 rescue-daemon / open-boot 浏览器触发自启 / dsh-boot 启动序列);跨平台(Windows/macOS/Linux)",
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",
@@ -26,6 +26,9 @@
26
26
  "main": "lib/index.js",
27
27
  "packageManager": "npm@11.19.0",
28
28
  "bin": {
29
+ "dsh-drydock": "bin/open-boot.mjs",
30
+ "dsh-drydock-boot": "bin/dsh-boot.mjs",
31
+ "dsh-drydock-rescue": "bin/rescue-daemon.mjs",
29
32
  "dsh-pm-launcher": "bin/open-boot.mjs",
30
33
  "dsh-pm-boot": "bin/dsh-boot.mjs",
31
34
  "dsh-pm-rescue": "bin/rescue-daemon.mjs"
@@ -61,15 +64,21 @@
61
64
  },
62
65
  "scripts": {
63
66
  "build": "node build.mjs",
64
- "test": "node build.mjs && node test-bundle.mjs && node test-render.mjs && node test-integration.mjs && node test-launcher.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",
65
69
  "test:launcher": "node test-launcher.mjs",
66
70
  "test:strict": "node test-launcher.mjs --strict",
71
+ "test:ux": "node test-ux.mjs",
72
+ "test:downloader": "node test-downloader.mjs",
73
+ "test:security": "node test-security-provenance.mjs",
67
74
  "check:vendor": "node tools/check-vendor.mjs",
68
75
  "pack": "node build.mjs && npm pack",
69
76
  "preflight": "node tools/dev/npm-preflight.mjs",
70
77
  "publish:npm": "node tools/dev/publish-npm.mjs",
71
78
  "publish:npm:apply": "node tools/dev/publish-npm.mjs --apply",
72
79
  "publish:webauth": "node tools/dev/publish-webauth.mjs",
80
+ "publish:all": "node tools/dev/publish-all.mjs",
81
+ "publish:status": "node tools/dev/publish-all.mjs --status",
73
82
  "verify:triple": "node tools/dev/verify-triple.mjs"
74
83
  },
75
84
  "dependencies": {