fix(promptlib): 1.14.1 修正 manifest.files 哈希(1.14.0 市场安装报完整性校验失败)

1.14.0 改了 main.js,但 manifest.files 仍写着旧哈希 720b8aaa,客户端装载时
比对真实字节 e6e9ec6a 直接拒绝,界面显示「未加载 · 完整性校验失败」。

- plugins/promptlib/manifest.json:版本 1.14.1,files 按真实字节重算
- plugins/index.json:同步版本与三处哈希
- scripts/gen-market.js:生成市场包前断言 manifest.files == 实际字节,不符即中断
- tests/plugin-manifest-hashes-test.js:门禁守住 manifest.files / index.json 哈希与版本一致
This commit is contained in:
qiqi committed 2026-11-27 12:08:35 +08:00
1 parent 012fd0267c
commit ea1e865426
6 files changed
+76 -6

No files matched your search

+16
View File
@@ -39,6 +39,22 @@ function readFolderFiles (id) {
if (fs.statSync(abs).isFile()) files.push({ name: 'assets/' + name, data: fs.readFileSync(abs) })
}
}
// v3.26.109:manifest.files 是客户端装载时校验入口文件的依据;写成旧值会让市场安装直接
// 「完整性校验失败(main.js 的 sha256 不符)」(promptlib 1.14.0 就这样发出去过一次)。
// 生成阶段就对照真实字节,不符直接中断,别等用户装不上才发现。
const bad = []
for (const [name, expect] of Object.entries(manifest.files || {})) {
const f = files.find((x) => x.name === name)
if (!f) { bad.push(name + ' 缺失'); continue }
const actual = shaHex(f.data)
if (actual !== String(expect).toLowerCase()) bad.push(name + ' 期望 ' + String(expect).slice(0, 8) + ' 实际 ' + actual.slice(0, 8))
}
if (bad.length) {
console.error('[gen-market] ' + String(manifest.id) + ' 的 manifest.files 与实际字节不符:' + bad.join(';'))
console.error('[gen-market] 修好 manifest.files 再发市场(否则客户端会拒绝装载)')
process.exit(1)
}
return { files, manifest }
}