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.
@@ -0,0 +1,66 @@
1
+ /**
2
+ * 附属小插件(社区资源)的宿主侧支持。
3
+ *
4
+ * 只做两件事:
5
+ * 1. 读内置清单 community/manifest.json,给 status.community 提供 builtin 信息;
6
+ * 2. 看 profile 里有没有声明兼容的外部实现(包名 dsh-modpack-community + community.json),
7
+ * 有就标成 external。外部实现只公开信息、不改主体行为,出问题也退得回内置。
8
+ */
9
+ import fs from 'node:fs'
10
+ import path from 'node:path'
11
+
12
+ export const COMMUNITY_ID = 'dsh-modpack-community'
13
+ export const COMMUNITY_API = 1
14
+
15
+ const builtinManifest = new URL('../community/manifest.json', import.meta.url)
16
+
17
+ export function readBuiltinManifest() {
18
+ try {
19
+ return JSON.parse(fs.readFileSync(builtinManifest, 'utf8'))
20
+ } catch {
21
+ return { id: COMMUNITY_ID, apiVersion: COMMUNITY_API, name: '社区资源', routes: [] }
22
+ }
23
+ }
24
+
25
+ function readExternal(profileDir) {
26
+ if (!profileDir) return null
27
+ const file = path.join(profileDir, 'node_modules', COMMUNITY_ID, 'community.json')
28
+ try {
29
+ const raw = JSON.parse(fs.readFileSync(file, 'utf8'))
30
+ if (!raw || raw.id !== COMMUNITY_ID) return null
31
+ const apiVersion = Number(raw.apiVersion)
32
+ if (!Number.isFinite(apiVersion) || apiVersion < 1) return null
33
+ return { raw, apiVersion, file }
34
+ } catch {
35
+ return null
36
+ }
37
+ }
38
+
39
+ /**
40
+ * @returns {{id: string, mode: 'builtin'|'external', apiVersion: number, version: string, enabled: boolean, reason?: string, routes: string[]}}
41
+ */
42
+ export function resolveCommunity(profileDir, config = {}) {
43
+ const builtin = readBuiltinManifest()
44
+ const enabled = config.showModpackMarket !== false
45
+ const apiVersion = Number(builtin.apiVersion) || COMMUNITY_API
46
+ const external = readExternal(profileDir)
47
+ if (external && external.apiVersion <= apiVersion) {
48
+ return {
49
+ id: COMMUNITY_ID,
50
+ mode: 'external',
51
+ apiVersion: external.apiVersion,
52
+ version: String(external.raw.version || ''),
53
+ enabled,
54
+ routes: Array.isArray(builtin.routes) ? builtin.routes : [],
55
+ }
56
+ }
57
+ return {
58
+ id: COMMUNITY_ID,
59
+ mode: 'builtin',
60
+ apiVersion,
61
+ version: '',
62
+ enabled,
63
+ ...(external ? { reason: '外部实现声明的 apiVersion 比宿主新(' + external.apiVersion + ' > ' + apiVersion + '),继续用内置实现' } : {}),
64
+ routes: Array.isArray(builtin.routes) ? builtin.routes : [],
65
+ }
66
+ }
package/lib/github.mjs ADDED
@@ -0,0 +1,289 @@
1
+ import { execFile } from 'node:child_process'
2
+ import fs from 'node:fs'
3
+ import os from 'node:os'
4
+ import path from 'node:path'
5
+
6
+ /**
7
+ * 只做 GitHub API 的那点事:用 curl 发请求(本机 Node 的 fetch 走代理会证书失败,
8
+ * curl 带 --ssl-no-revoke 是唯一稳的路子)。所有函数都返回解析后的 JSON。
9
+ */
10
+
11
+ const API = 'https://api.github.com'
12
+ const USER_AGENT = 'dsh-modpack-kit'
13
+
14
+ function run(args, input) {
15
+ return new Promise((resolve, reject) => {
16
+ const child = execFile('curl', args, { maxBuffer: 64 * 1024 * 1024, encoding: 'buffer' }, (error, stdout, stderr) => {
17
+ if (error) {
18
+ reject(new Error('curl 失败:' + String(error.message || error) + ' ' + String((stderr || '').toString('utf8')).slice(0, 300)))
19
+ return
20
+ }
21
+ resolve(stdout)
22
+ })
23
+ if (input !== undefined && child.stdin) {
24
+ child.stdin.end(input)
25
+ }
26
+ })
27
+ }
28
+
29
+ /** 调一次 API。method 大写,body 是对象或 undefined。 */
30
+ export async function gh(token, method, path, body) {
31
+ if (!token) throw new Error('还没有 GitHub 凭据:先在社区资源的上传页里填一次 token')
32
+ const args = [
33
+ '-sS',
34
+ '--ssl-no-revoke',
35
+ '-X', method,
36
+ '-H', 'accept: application/vnd.github+json',
37
+ '-H', 'authorization: Bearer ' + token,
38
+ '-H', 'user-agent: ' + USER_AGENT,
39
+ '-H', 'x-github-api-version: 2022-11-28',
40
+ '-w', '\n%{http_code}',
41
+ API + path,
42
+ ]
43
+ let input
44
+ if (body !== undefined) {
45
+ args.push('-H', 'content-type: application/json', '--data-binary', '@-')
46
+ input = JSON.stringify(body)
47
+ }
48
+ const out = (await run(args, input)).toString('utf8')
49
+ const index = out.lastIndexOf('\n')
50
+ const text = index >= 0 ? out.slice(0, index) : ''
51
+ const status = Number(index >= 0 ? out.slice(index + 1).trim() : '0')
52
+ let data = null
53
+ try {
54
+ data = text ? JSON.parse(text) : null
55
+ } catch {
56
+ data = null
57
+ }
58
+ if (status < 200 || status >= 300) {
59
+ const message = (data && (data.message || data.error)) || text.slice(0, 300) || 'HTTP ' + status
60
+ const error = new Error('GitHub 接口返回 ' + status + ':' + message)
61
+ error.status = status
62
+ error.data = data
63
+ throw error
64
+ }
65
+ return data
66
+ }
67
+
68
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
69
+
70
+ /** 拿到当前 token 是谁。 */
71
+ export async function whoAmI(token) {
72
+ const user = await gh(token, 'GET', '/user')
73
+ return { login: user.login, name: user.name || '' }
74
+ }
75
+
76
+ /** 确保 fork 存在(已存在就直接用),返回 fork 的 owner/name。 */
77
+ export async function ensureFork(token, catalog, login, onStep) {
78
+ const [owner, name] = String(catalog).split('/')
79
+ const forkPath = '/repos/' + login + '/' + name
80
+ try {
81
+ const repo = await gh(token, 'GET', forkPath)
82
+ if (onStep) onStep('已经有 fork:' + login + '/' + name)
83
+ return { owner: login, name, exists: true, parent: repo.parent ? repo.parent.full_name : catalog }
84
+ } catch (error) {
85
+ if (error.status !== 404) throw error
86
+ }
87
+ if (onStep) onStep('正在 fork 目录仓库…')
88
+ await gh(token, 'POST', '/repos/' + owner + '/' + name + '/forks', {})
89
+ for (let attempt = 0; attempt < 20; attempt += 1) {
90
+ await sleep(1500)
91
+ try {
92
+ const repo = await gh(token, 'GET', forkPath)
93
+ if (onStep) onStep('fork 好了:' + login + '/' + name)
94
+ return { owner: login, name, exists: false, parent: repo.parent ? repo.parent.full_name : catalog }
95
+ } catch (error) {
96
+ if (error.status !== 404) throw error
97
+ }
98
+ }
99
+ throw new Error('fork 建好后十分钟内还没出现,去 GitHub 网页上看一眼再重试')
100
+ }
101
+
102
+ /** 在一棵新分支上放两个新文件(包 + 条目),然后开 PR。 */
103
+ export async function openPackPullRequest(options) {
104
+ const { token, catalog, login, branch, packPath, packBase64, entryPath, entryText, title, body, onStep } = options
105
+ const [upstreamOwner, upstreamName] = String(catalog).split('/')
106
+ const fork = await ensureFork(token, catalog, login, onStep)
107
+ const repoPath = '/repos/' + fork.owner + '/' + fork.name
108
+
109
+ // 分支:已存在就换一个后缀,避免顶掉上一轮
110
+ let branchName = branch
111
+ let branchReady = false
112
+ for (let attempt = 0; attempt < 5; attempt += 1) {
113
+ try {
114
+ const ref = await gh(token, 'GET', repoPath + '/git/ref/heads/main')
115
+ const sha = ref.object.sha
116
+ await gh(token, 'POST', repoPath + '/git/refs', { ref: 'refs/heads/' + branchName, sha })
117
+ if (onStep) onStep('从 main 开了分支 ' + branchName)
118
+ branchReady = true
119
+ break
120
+ } catch (error) {
121
+ if (error.status === 422) {
122
+ branchName = branchName + '-' + Date.now().toString(36).slice(-4)
123
+ continue
124
+ }
125
+ throw error
126
+ }
127
+ }
128
+ if (!branchReady) throw new Error('分支建不出来(连续 5 次撞名):隔一分钟再传,或去 fork 里删几个旧分支')
129
+
130
+ // GitHub 的 contents API 对「已存在的文件」要求带 sha;我们是在新分支上写新文件,
131
+ // 撞名的唯一可能是 main 上已经有同名条目/包——提前查一次,给一句能照做的话。
132
+ const ensureFresh = async (filePath, what) => {
133
+ const encoded = String(filePath).split('/').map((part) => encodeURIComponent(part)).join('/')
134
+ try {
135
+ await gh(token, 'GET', repoPath + '/contents/' + encoded + '?ref=' + encodeURIComponent(branchName))
136
+ throw new Error('目录里已经有' + what + '(' + filePath + '):换一个包名(id 由文件名生成),或先去 ' + catalog + ' 删掉旧的那份再传')
137
+ } catch (error) {
138
+ if (error && error.status === 404) return
139
+ throw error
140
+ }
141
+ }
142
+
143
+ // 包放 Release 时 packPath 是空串:PR 里只带条目,包已经传进使用者自己的 Release
144
+ if (packPath) {
145
+ await ensureFresh(packPath, '这个包文件')
146
+
147
+ if (onStep) onStep('正在放包文件(' + Math.round(packBase64.length * 0.75 / 1024) + ' KB)…')
148
+ await gh(token, 'PUT', repoPath + '/contents/' + packPath, {
149
+ message: 'catalog: add ' + packPath.split('/').pop(),
150
+ content: packBase64,
151
+ branch: branchName,
152
+ })
153
+ }
154
+
155
+ // 封面:可选的第三份文件,放在 covers/ 下,条目里用 cover 指过来
156
+ if (options.coverPath && options.coverBase64) {
157
+ await ensureFresh(options.coverPath, '这张封面')
158
+ if (onStep) onStep('正在放封面图(' + Math.round(options.coverBase64.length * 0.75 / 1024) + ' KB)…')
159
+ await gh(token, 'PUT', repoPath + '/contents/' + options.coverPath, {
160
+ message: 'catalog: add cover for ' + (options.packId || 'pack'),
161
+ content: options.coverBase64,
162
+ branch: branchName,
163
+ })
164
+ }
165
+
166
+ if (onStep) onStep('正在写条目…')
167
+ await ensureFresh(entryPath, '这个条目')
168
+ await gh(token, 'PUT', repoPath + '/contents/' + entryPath, {
169
+ message: 'catalog: add entry ' + entryPath.split('/').pop(),
170
+ content: Buffer.from(entryText, 'utf8').toString('base64'),
171
+ branch: branchName,
172
+ })
173
+
174
+ if (onStep) onStep('正在开 PR…')
175
+ const pr = await gh(token, 'POST', '/repos/' + upstreamOwner + '/' + upstreamName + '/pulls', {
176
+ title,
177
+ head: fork.owner + ':' + branchName,
178
+ base: 'main',
179
+ body,
180
+ })
181
+ return { url: pr.html_url, number: pr.number, branch: branchName, fork: fork.owner + '/' + fork.name }
182
+ }
183
+
184
+ export function entryFileName(id) {
185
+ return 'data/packs/' + id + '.json'
186
+ }
187
+
188
+ // 只给文件名:目录仓库里放在 packs/ 下,Release 里就是资产名。
189
+ // 不要在这里带 'packs/' —— 条目里的 file 字段只认裸文件名。
190
+ export function packFileName(id, strategy) {
191
+ return id + '-' + strategy + '.dshpack'
192
+ }
193
+
194
+ /** 发一个二进制请求(Release 资产上传走 uploads.github.com,不能套 JSON 那套)。 */
195
+ function runRaw(args) {
196
+ return new Promise((resolve, reject) => {
197
+ const child = execFile('curl', args, { maxBuffer: 8 * 1024 * 1024, encoding: 'buffer' }, (error, stdout, stderr) => {
198
+ if (error) {
199
+ reject(new Error('curl 失败:' + String(error.message || error) + ' ' + String((stderr || '').toString('utf8')).slice(0, 300)))
200
+ return
201
+ }
202
+ resolve(stdout)
203
+ })
204
+ if (child.stdin) child.stdin.end()
205
+ })
206
+ }
207
+
208
+ function parseStatus(out) {
209
+ const text = out.toString('utf8')
210
+ const index = text.lastIndexOf('\n')
211
+ const body = index >= 0 ? text.slice(0, index) : ''
212
+ const status = Number(index >= 0 ? text.slice(index + 1).trim() : '0')
213
+ let data = null
214
+ try { data = body ? JSON.parse(body) : null } catch { data = null }
215
+ return { status, data, body }
216
+ }
217
+
218
+ /** 确保某个仓库里有一个叫 tag 的 Release(没有就建),返回 id。 */
219
+ export async function ensureRelease(token, repo, tag, name, onStep) {
220
+ try {
221
+ const found = await gh(token, 'GET', '/repos/' + repo + '/releases/tags/' + encodeURIComponent(tag))
222
+ if (found && found.id) {
223
+ if (onStep) onStep('已经有 Release ' + tag + ':' + (found.html_url || ''))
224
+ return { id: found.id, tag, created: false, url: found.html_url || '' }
225
+ }
226
+ } catch (error) {
227
+ if (error.status !== 404) throw error
228
+ }
229
+ const created = await gh(token, 'POST', '/repos/' + repo + '/releases', {
230
+ tag_name: tag,
231
+ name: name || tag,
232
+ body: '由 dsh-modpack-kit 上传的整合包;这个 Release 的资产下载数就是「真实下载量」。',
233
+ draft: false,
234
+ prerelease: false,
235
+ })
236
+ if (onStep) onStep('建了 Release ' + tag + ':' + (created.html_url || ''))
237
+ return { id: created.id, tag, created: true, url: created.html_url || '' }
238
+ }
239
+
240
+ /** 把包作为资产传进 Release(重名会先删旧的,免得一个 Release 里堆一串同名)。 */
241
+ export async function uploadReleaseAsset(token, repo, releaseId, name, buffer, onStep) {
242
+ const uploadUrl = 'https://uploads.github.com/repos/' + repo + '/releases/' + releaseId + '/assets?name=' + encodeURIComponent(name)
243
+ const post = async () => {
244
+ const file = path.join(os.tmpdir(), 'dshpack-asset-' + Date.now().toString(36) + '-' + Math.random().toString(36).slice(2, 8) + '.bin')
245
+ fs.writeFileSync(file, buffer)
246
+ try {
247
+ const out = await runRaw([
248
+ '-sS', '--ssl-no-revoke', '-X', 'POST',
249
+ '-H', 'accept: application/vnd.github+json',
250
+ '-H', 'authorization: Bearer ' + token,
251
+ '-H', 'user-agent: ' + USER_AGENT,
252
+ '-H', 'x-github-api-version: 2022-11-28',
253
+ '-H', 'content-type: application/octet-stream',
254
+ '--data-binary', '@' + file,
255
+ '-w', '\n%{http_code}',
256
+ uploadUrl,
257
+ ])
258
+ return parseStatus(out)
259
+ } finally {
260
+ try { fs.rmSync(file, { force: true }) } catch {}
261
+ }
262
+ }
263
+ let result = await post()
264
+ if (result.status === 422) {
265
+ // 同名资产已存在:删掉再传(GitHub 不允许覆盖资产)
266
+ try {
267
+ const rel = await gh(token, 'GET', '/repos/' + repo + '/releases/' + releaseId)
268
+ const existing = (Array.isArray(rel.assets) ? rel.assets : []).find((asset) => asset.name === name)
269
+ if (existing) {
270
+ await gh(token, 'DELETE', '/repos/' + repo + '/releases/assets/' + existing.id)
271
+ if (onStep) onStep('删掉同名旧资产,重新上传')
272
+ }
273
+ } catch {}
274
+ result = await post()
275
+ }
276
+ if (result.status < 200 || result.status >= 300) {
277
+ const message = (result.data && (result.data.message || result.data.error)) || result.body.slice(0, 300) || 'HTTP ' + result.status
278
+ const error = new Error('上传 Release 资产失败(' + result.status + '):' + message)
279
+ error.status = result.status
280
+ throw error
281
+ }
282
+ if (onStep) onStep('资产传好了:' + name + '(' + Math.round(buffer.length / 1024) + ' KB)')
283
+ return {
284
+ id: result.data && result.data.id,
285
+ name,
286
+ size: result.data && result.data.size,
287
+ url: (result.data && result.data.browser_download_url) || '',
288
+ }
289
+ }
@@ -124,7 +124,17 @@ function normalizeCatalog(raw) {
124
124
  const plugins = Array.isArray(pack.plugins)
125
125
  ? pack.plugins
126
126
  .filter((plugin) => plugin && plugin.name)
127
- .map((plugin) => ({ name: String(plugin.name), version: String(plugin.version || ''), description: String(plugin.description || '') }))
127
+ .map((plugin) => ({
128
+ name: String(plugin.name),
129
+ version: String(plugin.version || ''),
130
+ latest: plugin.latest === true,
131
+ description: String(plugin.description || ''),
132
+ configKeys: Number(plugin.configKeys) || 0,
133
+ hasConfig: plugin.hasConfig === true,
134
+ dataIncluded: plugin.dataIncluded === true,
135
+ redacted: Number(plugin.redacted) || 0,
136
+ group: String(plugin.group || ''),
137
+ }))
128
138
  : [];
129
139
  list.push({
130
140
  id,
@@ -133,6 +143,8 @@ function normalizeCatalog(raw) {
133
143
  category: String(pack.category || '其它'),
134
144
  version: String(pack.version || '1.0.0'),
135
145
  strategy: String(pack.strategy || 'lite'),
146
+ customization: pack.customization === 'custom' ? 'custom' : 'none',
147
+ customizationLabel: pack.customization === 'custom' ? '有自定义' : '无修改',
136
148
  file: String(pack.file || ''),
137
149
  sha256: String(pack.sha256 || ''),
138
150
  size: Number(pack.size) || 0,
@@ -145,8 +157,16 @@ function normalizeCatalog(raw) {
145
157
  homepage: String(pack.homepage || ''),
146
158
  // 下载量只认「这个包文件本身被下载了多少次」,不拿包内插件的 npm 下载量凑数:
147
159
  // 目录里没有计数渠道时就是 0(作者的下载量可以自己在清单里写)
160
+ host: pack.host === 'release' ? 'release' : 'repo',
161
+ tag: String(pack.tag || ''),
162
+ downloadUrl: String(pack.downloadUrl || ''),
148
163
  downloads: Number.isFinite(Number(pack.downloads)) && pack.downloads !== null && pack.downloads !== '' ? Number(pack.downloads) : null,
149
164
  updatedAt: String(pack.updatedAt || ''),
165
+ hasSpecialConfig: pack.hasSpecialConfig === true,
166
+ configPlugins: Array.isArray(pack.configPlugins) ? pack.configPlugins.map((item) => ({ name: String(item.name || ''), keys: Number(item.keys) || 0 })) : [],
167
+ hasData: pack.hasData === true,
168
+ redactedTotal: Number(pack.redactedTotal) || 0,
169
+ groups: Array.isArray(pack.groups) ? pack.groups.map((item) => String(item)) : [],
150
170
  });
151
171
  const last = list[list.length - 1];
152
172
  last.tier = tierOf(last.plugins.length).id;
@@ -174,6 +194,13 @@ function sourceBaseOf(sourceUrl) {
174
194
  }
175
195
 
176
196
  export function packFileUrl(pack, sourceBase) {
197
+ // 放 Release 的包有固定下载地址(downloadUrl 由目录构建时写进来,读不到就按约定拼)
198
+ if (pack && pack.host === 'release') {
199
+ if (pack.downloadUrl) return String(pack.downloadUrl);
200
+ if (pack.repo && pack.tag && pack.file) {
201
+ return 'https://github.com/' + pack.repo + '/releases/download/' + encodeURIComponent(pack.tag) + '/' + encodeURIComponent(pack.file);
202
+ }
203
+ }
177
204
  const base = String(sourceBase || MARKET_SOURCES[0].replace(/\/packs\.json$/u, ''));
178
205
  return base + '/packs/' + encodeURIComponent(pack.file || '');
179
206
  }
package/lib/repack.mjs ADDED
@@ -0,0 +1,57 @@
1
+ import { readZip, readZipText, writeZip } from './zip.mjs'
2
+ import { MANIFEST_NAME, buildReadme, sha256 } from './manifest.mjs'
3
+
4
+ /**
5
+ * 上传前允许改「名称 / 作者 / 简介 / 主页」。
6
+ *
7
+ * 目录那边只认包里的 dsh-modpack.json,所以这里不另存一份「覆盖字段」,
8
+ * 而是原地改写包内的清单、按新清单重写 README.txt,再把 integrity.json 重算一遍——
9
+ * 上传出去的包、目录里显示的条目、别人装的时候看到的名字,三处才会一致。
10
+ */
11
+ export function rewritePackManifest(bytes, edits = {}) {
12
+ const entries = readZip(bytes)
13
+ const manifestIndex = entries.findIndex((entry) => entry.name === MANIFEST_NAME)
14
+ if (manifestIndex < 0) throw new Error('包里没有 ' + MANIFEST_NAME)
15
+ const raw = JSON.parse(readZipText(entries, MANIFEST_NAME) || '{}')
16
+
17
+ const next = { ...raw }
18
+ const patch = {}
19
+ for (const key of ['name', 'author', 'description', 'homepage']) {
20
+ if (typeof edits[key] !== 'string') continue
21
+ const value = edits[key].trim()
22
+ if (!value || value === String(raw[key] || '')) continue
23
+ patch[key] = value
24
+ }
25
+ if (Object.keys(patch).length === 0) return { buffer: bytes, manifest: raw, changed: false, patch }
26
+
27
+ Object.assign(next, patch, { updatedAt: new Date().toISOString() })
28
+ const manifestBuf = Buffer.from(JSON.stringify(next, null, 2), 'utf8')
29
+ entries[manifestIndex] = { name: MANIFEST_NAME, data: manifestBuf }
30
+
31
+ // README.txt 是从清单生成的:名字/作者/简介改了,这份也要跟着改,否则包里两份说法
32
+ const readmeIndex = entries.findIndex((entry) => entry.name === 'README.txt')
33
+ if (readmeIndex >= 0) {
34
+ entries[readmeIndex] = { name: 'README.txt', data: Buffer.from(buildReadme(next), 'utf8') }
35
+ }
36
+
37
+ // integrity 覆盖除自身外的所有条目:改过哪个条目就重算哪个
38
+ const integrityIndex = entries.findIndex((entry) => entry.name === 'integrity.json')
39
+ if (integrityIndex >= 0) {
40
+ const old = JSON.parse(readZipText(entries, 'integrity.json') || '{}')
41
+ const files = {}
42
+ for (const entry of entries) {
43
+ if (entry.name === 'integrity.json') continue
44
+ files[entry.name] = sha256(entry.data)
45
+ }
46
+ const integrity = {
47
+ generatedAt: new Date().toISOString(),
48
+ algorithm: 'sha256',
49
+ files,
50
+ ...(old.root ? { root: old.root } : {}),
51
+ }
52
+ entries[integrityIndex] = { name: 'integrity.json', data: Buffer.from(JSON.stringify(integrity, null, 2), 'utf8') }
53
+ }
54
+
55
+ const buffer = writeZip(entries.map((entry) => ({ name: entry.name, data: entry.data })))
56
+ return { buffer, manifest: next, changed: true, patch }
57
+ }
package/lib/store.mjs CHANGED
@@ -73,6 +73,8 @@ export const DEFAULT_CONFIG = {
73
73
  // 二次开发用:额外扫描规则(形状同 lib/scan.mjs 的 SECRET_RULES)
74
74
  extraScanRules: [],
75
75
  historyLimit: 50,
76
+ // 装完把这份安装包删掉(只删插件自己 packs 目录里、由社区下载留下的那份)
77
+ autoClearPack: false,
76
78
  // 插件目录(分类与词条照插件市场):每页多少条、隔多久自己去更新一次
77
79
  catalogPageSize: 20,
78
80
  catalogRefreshHours: 24,
package/locale/en.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Modpack Kit",
4
- "description": "(Put these plugins together and it is genuinely good.) A PCL/HMCL-style modpack tool for DSH: bundle DSH plugins with their own config and data into one .dshpack and install them in one go; a bare DSH can install it too. Three strategies: lazy pack (payload included, works offline), download-only (install code only, smallest), hybrid (the strategy follows how each plugin is configured). Per-plugin setup: \"plugin preset\" or \"custom config\"; entries are restored item by item, existing local files are not overwritten by default, and suspected credentials become ${REDACTED}. Forced checks: before packing, scan for risky or sensitive content (masked only); high risk pauses for confirmation. Before installing, verify sha256, compatibility and licences. In sync with the market: categories, search, paging, groups and versions follow the plugin market catalog; packing and installing still work without it. Use it as a backup of your plugin combo: move to a new machine, back up or share plugin config. Sources include file and folder pickers, any directory, imported list and links; supports the market AI search. Would love to build a modpack marketplace but not skilled enough; updates are irregular (cluck cluck). Installing the plugin market (dshmarket) is recommended for a better experience. npm: https://www.npmjs.com/package/dsh-modpack-kit",
4
+ "description": "\"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",
5
5
  "detail": "docs/DETAIL.md"
6
6
  }
7
7
  }
package/locale/zh.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "整合包",
4
- "description": "(你说这几个插件整一块不牛逼坏了) 类似 HMCL / PCL 的 DSH 整合包工具:把多个 DSH 插件连同各自的配置与数据打成一个 .dshpack,一次装好;纯净版 DSH 也能装。 三种打包策略:懒人包(带本体,离线可装)、仅下载码(只记安装码,体积最小)、混合(按插件配置类型选择打包策略) 逐插件定制:「插件预设」或「自定义配置」,按条目回填、默认不覆盖本机文件,疑似凭据替换为 ${REDACTED}。 强制检测:打包前扫描风险与敏感信息(只留掩码),高风险停下等确认;安装前校验 sha256、兼容性与许可证。 和市场同源:分类、搜索、分页、分组、版本与插件市场目录同步;没装市场也能打包与安装。 平时可以把整合包当作插件组合的备份,迁移到新机器、备份或分享插件配置。 取包支持文件/文件夹选择器、任意目录、已导入列表与链接;支持市场的新版 AI 搜索。 想整社区资源奈何技术力不足,不定时更新咕咕咕。建议先装插件市场(dshmarket)以获得更好的体验。 npm:https://www.npmjs.com/package/dsh-modpack-kit",
4
+ "description": "(你说这几个插件整一块不牛逼坏了) 类似 HMCL / PCL 的 DSH 整合包工具:把插件连同配置与数据打成一个 .dshpack,一次装好,纯净 DSH 也能装;「社区资源」浏览、下载和一键上传你的整合包。插件安装按市场分组。 三种打包策略:懒人包(带本体,离线可装)、轻量包(只记安装码,最省空间)、混合(按插件配置类型选)。 逐插件定制:「插件预设」或「自定义配置」,按条目回填、默认不覆盖本机文件,疑似凭据替换为 ${REDACTED}。 打包前强制扫描风险与敏感信息(只留掩码),高风险先停下等确认;安装前校验 sha256、兼容性与许可证。 与插件市场同源:分类、搜索、分页、分组、版本都跟插件市场目录走,没装市场也能打包与安装。 取包支持文件/文件夹选择器、任意目录、已导入列表与链接。 建议先装插件市场(dshmarket)。 npm:https://www.npmjs.com/package/dsh-modpack-kit",
5
5
  "detail": "docs/DETAIL.md"
6
6
  }
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-modpack-kit",
3
- "version": "0.2.3",
4
- "description": "(你说这几个插件整一块不牛逼坏了) 类似 HMCL / PCL 的 DSH 整合包工具:把多个 DSH 插件连同各自的配置与数据打成一个 .dshpack,一次装好;纯净版 DSH 也能装。 三种打包策略:懒人包(带本体,离线可装)、仅下载码(只记安装码,体积最小)、混合(按插件配置类型选择打包策略) 逐插件定制:「插件预设」或「自定义配置」,按条目回填、默认不覆盖本机文件,疑似凭据替换为 ${REDACTED}。 强制检测:打包前扫描风险与敏感信息(只留掩码),高风险停下等确认;安装前校验 sha256、兼容性与许可证。 和市场同源:分类、搜索、分页、分组、版本与插件市场目录同步;没装市场也能打包与安装。 平时可以把整合包当作插件组合的备份,迁移到新机器、备份或分享插件配置。 取包支持文件/文件夹选择器、任意目录、已导入列表与链接;支持市场的新版 AI 搜索。 想整社区资源奈何技术力不足,不定时更新咕咕咕。建议先装插件市场(dshmarket)以获得更好的体验。 npm:https://www.npmjs.com/package/dsh-modpack-kit",
3
+ "version": "0.2.4",
4
+ "description": "(你说这几个插件整一块不牛逼坏了) 类似 HMCL / PCL 的 DSH 整合包工具:把插件连同配置与数据打成一个 .dshpack,一次装好,纯净 DSH 也能装;「社区资源」浏览、下载和一键上传你的整合包。插件安装按市场分组。 三种打包策略:懒人包(带本体,离线可装)、轻量包(只记安装码,最省空间)、混合(按插件配置类型选)。 逐插件定制:「插件预设」或「自定义配置」,按条目回填、默认不覆盖本机文件,疑似凭据替换为 ${REDACTED}。 打包前强制扫描风险与敏感信息(只留掩码),高风险先停下等确认;安装前校验 sha256、兼容性与许可证。 与插件市场同源:分类、搜索、分页、分组、版本都跟插件市场目录走,没装市场也能打包与安装。 取包支持文件/文件夹选择器、任意目录、已导入列表与链接。 建议先装插件市场(dshmarket)。 npm:https://www.npmjs.com/package/dsh-modpack-kit",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "exports": {