dsh-modpack-kit 0.2.3 → 0.2.4

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/docs/CODE-MAP.md CHANGED
@@ -38,50 +38,58 @@ docs/DETAIL.md 插件详情页正文(locale 的 meta.detail 指向它)
38
38
  | 网络与主机白名单 | `lib/net.mjs` | `requestJson`、`requestBuffer`、`curlOnce` | `grep -n "function requestJson" lib/net.mjs` |
39
39
  | 设置项默认值 | `lib/store.mjs` | `DEFAULT_CONFIG`、`clampConfig`、`loadConfig` | `grep -n "DEFAULT_CONFIG" lib/store.mjs` |
40
40
 
41
- ## 2. 路由表(`index.js`,共 30 条)
41
+ ## 2. 路由表(`index.js`,共 38 条)
42
42
 
43
43
  | 路由 | 行 |
44
44
  | --- | --- |
45
- | `status` | 299 |
46
- | `settings` | 305 |
47
- | `catalog` | 326 |
48
- | `catalog/status` | 336 |
49
- | `catalog/lookup` | 348 |
50
- | `catalog/sync` | 359 |
51
- | `catalog/search` | 370 |
52
- | `market` | 405 |
53
- | `market/search` | 423 |
54
- | `market/sync` | 447 |
55
- | `market/download` | 463 |
56
- | `versions` | 512 |
57
- | `pack/plan` | 814 |
58
- | `pack` | 824 |
59
- | `jobs/ack` | 848 |
60
- | `jobs/dismiss` | 883 |
61
- | `jobs/clear` | 896 |
62
- | `jobs/cancel` | 915 |
63
- | `jobs` | 938 |
64
- | `download` | 945 |
65
- | `save` | 960 |
66
- | `packs` | 999 |
67
- | `pack/drop` | 1015 |
68
- | `inspect` | 1080 |
69
- | `install` | 1265 |
70
- | `install/replace` | 1278 |
71
- | `history` | 1304 |
72
- | `history/clear` | 1310 |
73
- | `history/remove` | 1316 |
74
- | `plugin-summary` | 1324 |
45
+ | `status` | 315 |
46
+ | `settings` | 321 |
47
+ | `catalog` | 342 |
48
+ | `catalog/status` | 352 |
49
+ | `catalog/lookup` | 364 |
50
+ | `catalog/sync` | 375 |
51
+ | `catalog/search` | 386 |
52
+ | `market` | 421 |
53
+ | `market/search` | 439 |
54
+ | `market/sync` | 463 |
55
+ | `upload/status` | 477 |
56
+ | `upload/token` | 494 |
57
+ | `upload/preview` | 520 |
58
+ | `upload/submit` | 598 |
59
+ | `market/preview` | 847 |
60
+ | `market/download` | 890 |
61
+ | `versions` | 977 |
62
+ | `pack/plan` | 1279 |
63
+ | `plugin/install` | 1291 |
64
+ | `pack` | 1333 |
65
+ | `jobs/ack` | 1357 |
66
+ | `jobs/dismiss` | 1392 |
67
+ | `jobs/clear` | 1405 |
68
+ | `jobs/cancel` | 1424 |
69
+ | `jobs` | 1447 |
70
+ | `download` | 1454 |
71
+ | `save` | 1469 |
72
+ | `packs` | 1508 |
73
+ | `packs/open` | 1524 |
74
+ | `packs/remove` | 1539 |
75
+ | `pack/drop` | 1564 |
76
+ | `inspect` | 1629 |
77
+ | `install` | 1826 |
78
+ | `install/replace` | 1839 |
79
+ | `history` | 1865 |
80
+ | `history/clear` | 1871 |
81
+ | `history/remove` | 1877 |
82
+ | `plugin-summary` | 1885 |
75
83
 
76
84
  > 全部挂在 `/dsh-modpack-kit/api/` 下;路由体统一 `if (!needPost(req, res)) return` + `await readJsonBody(req)`,不要再写 `fenced()`。
77
85
 
78
86
  ## 3. 文件职责与符号
79
87
 
80
- ### `index.js`(1396 行)
88
+ ### `index.js`(1974 行)
81
89
 
82
90
  Host 侧:所有 HTTP 路由、打包/安装/市场编排、任务队列与进度
83
91
 
84
- ### `client.js`(3131 行)
92
+ ### `client.js`(3873 行)
85
93
 
86
94
  客户端:打包 / 安装·导入 / 社区资源 / 设置与记录 四块界面 + 悬浮进度窗
87
95
 
@@ -107,6 +115,16 @@ Host 侧:所有 HTTP 路由、打包/安装/市场编排、任务队列与进
107
115
  - `classifyPlugin` L67(导出)
108
116
  - `categoryLabel` L103(导出)
109
117
 
118
+ ### `lib/community.mjs`(67 行)
119
+
120
+
121
+
122
+ - `COMMUNITY_ID` L12(导出常量)
123
+ - `COMMUNITY_API` L13(导出常量)
124
+ - `readBuiltinManifest` L17(导出)
125
+ - `readExternal` L25
126
+ - `resolveCommunity` L42(导出)
127
+
110
128
  ### `lib/compat.mjs`(114 行)
111
129
 
112
130
  兼容性判定:peer 依赖、engines、license、版本差异;按打包策略给不同建议
@@ -114,6 +132,22 @@ Host 侧:所有 HTTP 路由、打包/安装/市场编排、任务队列与进
114
132
  - `versionOf` L12
115
133
  - `checkCompatibility` L21(导出)
116
134
 
135
+ ### `lib/github.mjs`(290 行)
136
+
137
+
138
+
139
+ - `run` L14
140
+ - `gh` L30(导出)
141
+ - `whoAmI` L71(导出)
142
+ - `ensureFork` L77(导出)
143
+ - `openPackPullRequest` L103(导出)
144
+ - `entryFileName` L184(导出)
145
+ - `packFileName` L190(导出)
146
+ - `runRaw` L195
147
+ - `parseStatus` L208
148
+ - `ensureRelease` L219(导出)
149
+ - `uploadReleaseAsset` L241(导出)
150
+
117
151
  ### `lib/groups.mjs`(148 行)
118
152
 
119
153
  读插件市场的分组(.dsh-market/state.json),装完后并入/重名避让
@@ -182,7 +216,7 @@ dsh-modpack.json 的构造、归一化、校验与包内 README 生成
182
216
  - `categoryMapFor` L392(导出)
183
217
  - `lookupPlugins` L404(导出)
184
218
 
185
- ### `lib/modpack-catalog.mjs`(356 行)
219
+ ### `lib/modpack-catalog.mjs`(383 行)
186
220
 
187
221
  社区资源目录(自建仓库 packs.json):同步、缓存、检索、取包
188
222
 
@@ -196,15 +230,15 @@ dsh-modpack.json 的构造、归一化、校验与包内 README 生成
196
230
  - `readCache` L77
197
231
  - `writeCache` L101
198
232
  - `normalizeCatalog` L115
199
- - `sourceBaseOf` L171
200
- - `packFileUrl` L176(导出)
201
- - `marketSummary` L181(导出)
202
- - `syncMarket` L215(导出)
203
- - `installedState` L251
204
- - `relevance` L259
205
- - `searchMarket` L283(导出)
206
- - `fetchMarketPack` L336(导出)
207
- - `findMarketPack` L349(导出)
233
+ - `sourceBaseOf` L191
234
+ - `packFileUrl` L196(导出)
235
+ - `marketSummary` L208(导出)
236
+ - `syncMarket` L242(导出)
237
+ - `installedState` L278
238
+ - `relevance` L286
239
+ - `searchMarket` L310(导出)
240
+ - `fetchMarketPack` L363(导出)
241
+ - `findMarketPack` L376(导出)
208
242
 
209
243
  ### `lib/net.mjs`(168 行)
210
244
 
@@ -275,6 +309,12 @@ dsh-modpack.json 的构造、归一化、校验与包内 README 生成
275
309
  - `fetchCatalog` L196(导出)
276
310
  - `npmSearchCatalog` L211(导出)
277
311
 
312
+ ### `lib/repack.mjs`(58 行)
313
+
314
+
315
+
316
+ - `rewritePackManifest` L11(导出)
317
+
278
318
  ### `lib/scan.mjs`(347 行)
279
319
 
280
320
  安全检测:敏感信息 + 恶意代码痕迹;按来源分组;同内容去重
@@ -303,7 +343,7 @@ dsh-modpack.json 的构造、归一化、校验与包内 README 生成
303
343
  - `testBounds` L103
304
344
  - `satisfies` L119(导出)
305
345
 
306
- ### `lib/store.mjs`(243 行)
346
+ ### `lib/store.mjs`(245 行)
307
347
 
308
348
  本地状态:settings.json / history.json / 目录路径 / 默认配置与 clamp
309
349
 
@@ -314,18 +354,18 @@ dsh-modpack.json 的构造、归一化、校验与包内 README 生成
314
354
  - `HOSTS_VERSION` L31(导出常量)
315
355
  - `NET_VERSION` L33(导出常量)
316
356
  - `DEFAULT_CONFIG` L35(导出常量)
317
- - `pathsFor` L96(导出)
318
- - `clampConfig` L109(导出)
319
- - `loadConfig` L152(导出)
320
- - `writeJsonAtomic` L175(导出)
321
- - `saveConfig` L182(导出)
322
- - `readHistory` L188(导出)
323
- - `appendHistory` L197(导出)
324
- - `clearHistory` L205(导出)
325
- - `removeHistory` L211(导出)
326
- - `appendLog` L218(导出)
327
- - `slugify` L228(导出)
328
- - `ensureDir` L239(导出)
357
+ - `pathsFor` L98(导出)
358
+ - `clampConfig` L111(导出)
359
+ - `loadConfig` L154(导出)
360
+ - `writeJsonAtomic` L177(导出)
361
+ - `saveConfig` L184(导出)
362
+ - `readHistory` L190(导出)
363
+ - `appendHistory` L199(导出)
364
+ - `clearHistory` L207(导出)
365
+ - `removeHistory` L213(导出)
366
+ - `appendLog` L220(导出)
367
+ - `slugify` L230(导出)
368
+ - `ensureDir` L241(导出)
329
369
 
330
370
  ### `lib/tar.mjs`(108 行)
331
371
 
@@ -374,7 +414,7 @@ YAML 子集:只服务 cordis.patch.yml 的读写
374
414
  - **加一条路由**:`index.js` 里 `route("/dsh-modpack-kit/api/…")` → 客户端 `api("/…")` → `dev/tools/verify.cjs` 的路由数 → `test/host-smoke.mjs` 补一条 HTTP 用例。旧宿主没有该路由时会回 404/405,`client.js` 的 `api()` 会提示「重启 DSH」。
375
415
  - **加一个社区资源字段**:`_market/modpack-catalog/scripts/build.mjs`(校验 + 输出)→ `lib/modpack-catalog.mjs` 的 `normalizeCatalog` → `client.js` 的 `renderRow` / 详情块 → `_market/modpack-catalog/README.md` 的条目格式表。
376
416
  - **加一种打包策略或改策略判定**:`lib/pack.mjs`(`strategy` / `embedded`)→ `lib/manifest.mjs`(`format` 归一化)→ `index.js` 的 `computePlan` 与 `/pack/plan` → `client.js` 的 `STRATEGY_INFO` 与卡片 → `lib/install.mjs`(按 `embedded` 决定走市场版还是包内副本)→ 测试。
377
- - **改界面文案**:`client.js` 里的中文字面量;`locale/zh.json`、`locale/en.json` 的 `meta.title/description`;`README.md`;`docs/DETAIL.md`;注意测试里有硬断言(例如旧名「整合包市场」不许出现)。
417
+ - **改界面文案**:`client.js` 里的中文字面量;`locale/zh.json`、`locale/en.json` 的 `meta.title/description`;`README.md`;`docs/DETAIL.md`;注意测试里有硬断言(例如旧名「整合包市场」不许出现);市场介绍那段统一改 `docs/MARKET.txt`,再跑 `dev/tools/market-text.mjs` 同步。
378
418
  - **改完固定收尾**:`test/run.mjs`、`DSH_MODPACK_OFFLINE=1 test/host-smoke.mjs`、`dev/tools/sync.cjs`、`dev/tools/verify.cjs`、`dev/tools/map.mjs`(刷新本文件)。
379
419
 
380
420
  ## 5. 检索示例
package/docs/DETAIL.md CHANGED
@@ -64,17 +64,27 @@ dsh plugin --profile desktop add github:Vesna-Strivozha-cn/dsh-modpack-kit
64
64
 
65
65
  ## 社区资源
66
66
 
67
+ **存放位置两条路**:默认把 `.dshpack` 放进目录仓库的 `packs/`(一次 PR 完事,但 Git 没有逐文件计数);也可以选「放进我的 Release」——插件会确保你仓库里有那个 tag 的 Release,把包作为资产传上去,再向目录仓库提一个只含条目的 PR。目录构建时用 `GET /repos/<repo>/releases/tags/<tag>` 找到资产,核对大小与 sha256、读取 `download_count` 写进 `downloads`,客户端于是显示真实下载次数。
68
+
69
+ **一键上传**:那一栏右上角有「上传我的整合包」。填一次自己的 GitHub token(classic:`repo`;fine-grained:contents 与 pull requests 读写),之后选 `.dshpack`、选类型、填主页(可选)即可提交——插件在本地算 sha256、生成 `data/packs/<id>.json` 条目、fork `Vesna-Strivozha-cn/dsh-modpack-catalog`、在新分支提交两个文件并开 PR。全程只有本机的 GitHub 请求,不经过模型。token 只放内存(`POST /upload/token` → `setUploadToken`,不落盘、不在 settings、不会被抽进整合包),每次上传都要重填,任务结束在 `finally` 里 `clearUploadToken()` 立刻清掉。上传本身是任务队列里的 `upload` job:`POST /upload/submit` 直接回 202,进度与卡住原因都写进 job(左下角悬浮窗展示,完成给「打开 PR」,失败给「我已知晓」)。条目只写定位字段(id、类型、修改词条、文件名、sha256、日期),名称/作者/介绍/插件清单一律从包内 `dsh-modpack.json` 读。
70
+
67
71
  界面不带语言切换,只提供中文。
68
72
 
69
73
  - 体量词条:按插件总数自动判定(0-3 轻量 / 4-8 中型 / 9-12 大型 / 13+ 大宗),目录条目里存成 `tier`,客户端只用不猜。
70
74
  - 水槽:构建时把包里每个插件映射到插件市场分类,跨 ≥3 类就强制 `category = 水槽`,避免「什么都有」的包被塞进单一场景。
71
75
  - 条目字段:id / name / author / category / version / strategy(只收 lite)/ file / sha256 / size / createdAt / updatedAt / description{zh,en} / plugins[{name,version,description}] / downloads。
72
76
  - downloads 指这个 .dshpack 安装文件本身被下载的次数;目录只存元数据、不搬文件。Git 仓库里的文件没有逐文件计数,作者不写这个字段时客户端显示「下载量未统计」,绝不用包里插件的 npm 下载量顶替;托管到 GitHub Release 并写 download_count 就会原样显示。
73
- - 上传时条目只写定位字段(id/类型/文件名/sha256/日期);介绍、名称、作者、插件清单全部取自包内 `dsh-modpack.json`,也就是打包那一刻填的内容——目录里显示什么,取决于打包时写了什么。
77
+ - 收录两种包:轻量包(条目写 `customization: "none"`,词条「无修改」)与混合包(`customization: "custom"`,词条「有自定义」);完整包不收。这一栏必填,且必须与包内 `format` 对得上,否则构建失败。
78
+ - 上传时条目只写定位字段(id/类型/customization/文件名/sha256/日期);介绍、名称、作者、插件清单全部取自包内 `dsh-modpack.json`,也就是打包那一刻填的内容——目录里显示什么,取决于打包时写了什么。
74
79
  - 插件数只算清单里的顶层插件;壁纸引擎那类由插件自己带的组件不计入。
75
80
  - 检索:目录 JSON 按文件的 mtime+size 做内存缓存,每条预算一份小写 searchText;命中查询时先做包含过滤再打分,服务端对同一组条件再缓存 20 秒。
76
81
  - 分组写入:.dsh-market/state.json 里新增 groupOrigins(组名 → 创建它的包);同名组属于别的包时依次试「名字 2」「名字 3」,安装日志会写明避让结果。
82
+ - 下载两条路:`POST /market/download { id, saveOnly: true }` 只把包写进 `pathsFor(config).packs`(名 `<包名 slug>-<sha256 前 8 位>.dshpack`,返回 `savedPath/savedName/savedDir`,不换 token);不带 `saveOnly` 时照旧返回 token 走安装。安装成功后若设置里 `autoClearPack === true`,只删 `packs` 目录里这次用的那一份(`sourcePackFile` 且目录匹配)。
83
+ - `POST /packs/open`:按平台调 `explorer.exe` / `open` / `xdg-open` 打开下载目录,返回 `{ok, dir}`。
84
+ - 封面:上传接口收 `cover`(PNG/JPEG 的 data URL),上限 `COVER_MAX_BYTES = 300 KB`,超出报「封面太大:N KB,上限 300 KB(建议 512×512 以内)」;条目写 `cover: covers/<id>.<png|jpg>`,PR 里先推封面再推条目。客户端用 jsDelivr 或 raw 拼 `cover` 显示。
85
+ - 本地预览:`POST /market/preview` 把选好的包读成模拟条目(`id: "__local_preview__"`),只存内存;随后 `POST /market/download { id: "__local_preview__" }` 用这份字节走真实的下载/安装流程(`!isPreview` 守卫跳过目录条目的体积与 sha256 核对)。全程本地,不上传、不开 PR。
77
86
 
87
+ - 附属小插件:`lib/community.mjs` 的 `resolveCommunity(profileDir, config)` 给出 `{id, mode, apiVersion, version, enabled}`,内置清单位于 `community/manifest.json`(9 条路由、UI 面板名);外部实现放 `<profile>/node_modules/dsh-modpack-community/community.json`,`apiVersion` 不得高于宿主。宿主用 `communityRoute()` 统一包住这 9 条路由:`config.showModpackMarket === false` 时回 404 并附提示,其余接口照常。
78
88
  目录仓库 `Vesna-Strivozha-cn/dsh-modpack-catalog`(GitHub Actions `17 3 * * *` 一天一轮询)。
79
89
 
80
90
  * 数据:`packs.json`(`schema: 1`、`builtAt`、`count`、`categories[{id,label,count}]`、`packs[]`)。jsDelivr `gh/<repo>@main/packs.json` 与 raw.githubusercontent 两个源都取一遍,按 `builtAt` 用更新的那份(jsDelivr 对 gh 的缓存可能落后一整天);本地缓存在 `<home>/dsh-modpack/modpack-market/packs.cache.json`(连 `sourceBase` 一起存),TTL 按 `modpackRefreshHours`(默认 24 小时)。
@@ -87,6 +97,39 @@ dsh plugin --profile desktop add github:Vesna-Strivozha-cn/dsh-modpack-kit
87
97
 
88
98
  上传流程:轻量包 → sha256/字节数 → fork 目录仓库 → `packs/` + `data/packs/<id>.json`(定位字段)→ 本地 `scripts/build.mjs` → PR;合并后每日 03:17 UTC 重建或 Actions 手动 dispatch。构建会打开包读 `dsh-modpack.json`:名称、作者、介绍、插件清单都以它为准,包里插件可写 `{ "name": "x", "latest": true }`(安装取市场最新)。
89
99
 
100
+
101
+ 插件这一层可以直接装:`POST /dsh-modpack-kit/api/plugin/install`(body `{ name, version }`)——带版本时拼成 `名字@版本` 交给宿主 `pluginManager.installBundle`(拿不到服务就退回官方命令行),返回 `application` 与 `restartRequired`;界面每行右侧一个「安装 / 更新到 x.y.z / 重新安装」按钮,装完重拉一页让已装标记跟上。
102
+ ### 详情里的「本机情况」
103
+
104
+ 列表不判断装没装。点开某个整合包时,前端直接拿**目录条目**里的 `plugins` 跟 `status.installed` 对一遍,算出「已装 X / Y、缺哪几个」,再把目录里已经算好的 `hasSpecialConfig` / `configPlugins` / `hasData` / `redactedTotal` / `groups` 一起显示。**不下载包、不发额外请求、不改本机**——这些字段由目录仓库的 `scripts/build.mjs` 在构建时从包内 `dsh-modpack.json` 里算好写进 `packs.json`。
105
+
106
+
107
+ ### 下载的包与安装页的「已下载」
108
+
109
+ `POST /market/download` 校验体积与 sha256、跑完 `inspectPackBuffer` 之后,除了在内存里留一份 token,还会把字节写进 `pathsFor(config).packs`,文件名是 `slug(包 id)-sha256 前 8 位.dshpack`(`mkdirSync` 递归建目录,同名且已存在就跳过)。返回里带 `savedPath / savedName / savedDir`。写盘失败只记一行日志,不影响这次安装。
110
+
111
+ 安装页因此多一张「已下载的整合包」卡:`GET /packs` 列 `packs` 目录里的 `.dshpack`(`{name,size,mtime,path}`,按时间倒序),点「选择」直接 `POST /inspect {file: path}` 走同一条安装流程;点「删除」调 `POST /packs/remove {name}`——只接受纯文件名(带路径或 `..` 一律 400),删完回最新的目录列表。这张卡与「整合包所在的目录」那组输入框共用同一个状态,`packs` 目录可用设置里的 `packDir` 换。
112
+
113
+ ### 封面裁切
114
+
115
+ 上传页第 5 步是裁切器:`coverSrc` 存原图,`coverZoom`(1~3)与 `coverOffset`(像素)在 240×240 的框里拖拽缩放;`applyCover()` 用 canvas 按 `coverSize`(256 或 512)只画框里那块并 `toDataURL("image/png")`,超过 300 KB 直接拦下。提交时只带裁好的 data URL,`parseCover` 再校验一次;目录里存 `covers/<id>.png`。列表行与详情优先用 `coverImg()` 显示图片(内联 `data:` 封面直接画,仓库里的相对路径拼 CDN),没有封面才回落到分类色块 + 名字前两字。
116
+
117
+ ### 预览放在社区列表里
118
+
119
+ 上传页的「在列表里预览」调用 `POST /market/preview` 把包读进内存(`localPreview`),返回的模拟条目 id 是 `__local_preview__`。`ModpackBrowser` 用 `previewPack` 状态把这条拼到列表最前面(`rows = [previewPack, ...items]`),并渲染橙色「测试预览」标记与顶部说明条;`/market/download` 认得这个 id,直接拿内存里的字节走 sha256 校验、读包与安装,不落盘到目录仓库。离开页面再回来时预览条不会保留(它只活在这一屏),需要再点一次。
120
+
121
+ ### 页面状态保留
122
+
123
+ 离开「整合包」页签再回来,页面停在原处:当前页签、打包页的勾选与搜索条件、安装页填的来源与选项都在内存快照里(`pageUi` / `installDraft` / `packDraft` / `marketUi`)。唯一不保留的是上传用的 GitHub 凭据——上传页卸载时会 `POST /upload/token {token: ""}` 让服务端把内存里那份丢掉,下次进来必须重新填。
124
+
125
+ ### 一键上传的顺序
126
+
127
+ 先验包、再要凭据:类型 / 能不能读 / 体积 / 格式(只收 lite、hybrid)/ id 合法性都在本地判完,任何一条不过就直接 400,不碰 GitHub。过了以后才检查内存里有没有 token,然后建任务:登录名 → (可选)Release → fork → 分支 → 放包 → 写条目 → 开 PR,每一步都往进度窗写一句话。任务结束无论成败都清掉内存里的 token。
128
+
129
+ 读包用 `inspectPackBuffer(bytes, { config, force: true, scanBeforeInstall: false, extraScanRules: … })`——第二个参数是 options,配置要挂在 options.config 上,否则设置里的扫描规则在「上传前读包」这一步不生效。类型白名单来自 `lib/modpack-catalog.mjs` 的 `CATEGORY_FALLBACK`,不要在服务端再抄一份。
130
+
131
+ 选包的两种读法都落到同一处:`/upload/preview` 收 `{ base64, fileName }` 或 `{ file: 本机路径 }`,只读清单、不扫描、不要凭据,回名称/作者/简介/主页/插件数/sha256,另带 `pluginList`(每个插件的 `configMode`/`configKeys`/`dataIncluded`/`group`/`embedded`/`latest`)与 `summary`(`configMode`/`configCount`/`dataCount`/`redacted`/`groups`/`embeddedCount`)。界面上这几项可改,提交时带 `edits`;服务端在验完包之后调 `lib/repack.mjs` 的 `rewritePackManifest(bytes, edits)` 重写包内 `dsh-modpack.json`、`README.txt`、`integrity.json`,再用新字节重新读一遍,条目里的 sha256、size 与 PR 里的包文件都按改后的走。上传页本身按「凭据 / 选包 / 改词条 / 放在哪」四张步骤卡排布,选完包后另有一块可折叠的概况(`FoldBox`)逐条列插件。
132
+
90
133
  ## 与插件市场的兼容
91
134
 
92
135
  ||装了插件市场|没装|
@@ -127,6 +170,15 @@ AI 搜索花的 token 记在插件市场那边(它用你在「设置 → 模
127
170
  * 装包含独立安装器 `assets/install-stub.mjs`:完整版先把插件复制到 `~/.dsh/dsh-modpack/vendor/<名字>-<hash>` 再 `file:` 安装(解压目录删了也不会断),已装默认跳过。
128
171
  * 改完源码要 `node dev/tools/sync.cjs`(profile 里是硬链接拷贝,不是软链)再 `node dev/tools/verify.cjs`。
129
172
 
173
+ ### 上传规则(两条路)
174
+
175
+ 规则页的 MARKET_RULES 与目录仓库 README 同源,覆盖:
176
+
177
+ 1. **插件内一键上传**:内存态 token(离开页面或上传结束即清)→ 选包(base64 或本机路径)→ 可选改名称/作者/简介/主页(写回包内清单并重算 sha256)→ 可选封面(canvas 裁 256/512,只传框内,300 KB 上限)→ 选目录仓库(插件算 sha256、写条目、fork、开 PR,带包 + 条目 + 可选封面)或自己的 Release(条目写 host/repo/tag,目录读资产 download_count)。
178
+ 2. **手动 PR**:打包 → 算 sha256 与字节数 → fork + 分支 → `packs/`、`data/packs/<id>.json`、`covers/` → `node scripts/build.mjs` → PR → 每天 03:17 UTC 自动重建,或 Actions 手动 Run workflow。
179
+
180
+ 条目只写定位字段;介绍、名称、作者、插件清单以包内 `dsh-modpack.json` 为准;轻量包 customization 为 none、混合包为 custom。
181
+
130
182
  ## 已知限制
131
183
 
132
184
  * 只记安装码的包必须联网,且市场里得有那个版本;市场没收录的插件只能打懒人包或混合包。
@@ -0,0 +1,19 @@
1
+ # 插件市场介绍文本(唯一来源)
2
+ #
3
+ # 改完同步到四处副本: ELECTRON_RUN_AS_NODE=1 "<DeepSeek Harness.exe>" dev/tools/market-text.mjs
4
+ # 只检查是否一致: 同上,末尾加 --check
5
+ #
6
+ # 会同步到:locale/zh.json 与 locale/en.json 的 meta.description、package.json 的 description、
7
+ # dev/marketplace-awesome-dsh-plugin.yml 的 description.zh / description.en。
8
+ #
9
+ # 约定:
10
+ # - [zh]、[en] 各一段,整段写在一行里,工具原样同步过去,不要手动折行。
11
+ # - 市场卡片只显示开头一百多字,所以 zh 的前 150 字里要交代清楚社区整合包能安装、能上传。
12
+ # - 市场条目描述必须单行(CI 会查换行),这里写成多行工具也不认,直接报错。
13
+ # - 别把 ${REDACTED} 改成别的写法:安装端是按这个字面量认的。
14
+
15
+ [zh]
16
+ (你说这几个插件整一块不牛逼坏了) 类似 HMCL / PCL 的 DSH 整合包工具:把插件连同配置与数据打成一个 .dshpack,一次装好,纯净 DSH 也能装;「社区资源」浏览、下载和一键上传你的整合包。插件安装按市场分组。 三种打包策略:懒人包(带本体,离线可装)、轻量包(只记安装码,最省空间)、混合(按插件配置类型选)。 逐插件定制:「插件预设」或「自定义配置」,按条目回填、默认不覆盖本机文件,疑似凭据替换为 ${REDACTED}。 打包前强制扫描风险与敏感信息(只留掩码),高风险先停下等确认;安装前校验 sha256、兼容性与许可证。 与插件市场同源:分类、搜索、分页、分组、版本都跟插件市场目录走,没装市场也能打包与安装。 取包支持文件/文件夹选择器、任意目录、已导入列表与链接。 建议先装插件市场(dshmarket)。 npm:https://www.npmjs.com/package/dsh-modpack-kit
17
+
18
+ [en]
19
+ "Put these plugins together and it is genuinely good." A PCL/HMCL-style modpack tool for DSH: bundle plugins with their config and data into one .dshpack and install them in one go; a bare DSH can install it too. "Community" browses, downloads and one-click uploads your packs; plugins install into their plugin-market groups. Three strategies: lazy pack (payload included, offline), light (install codes only, smallest), hybrid (follows how each plugin is configured). Per-plugin setup: "plugin preset" or "custom config"; entries restored item by item, local files not overwritten by default, suspected credentials become ${REDACTED}. Packing forces a scan for risks and secrets (masks only, nothing kept locally), and high-risk items wait for your confirmation; sha256, compatibility and licences are checked before installing. In sync with the plugin market: categories, search, paging, groups and versions follow its catalog; works without it too. Sources include file and folder pickers, any directory, imported list and links. Installing the plugin market (dshmarket) is recommended. npm: https://www.npmjs.com/package/dsh-modpack-kit