fix(promptlib): 1.14.1 修正 manifest.files 哈希(1.14.0 市场安装报完整性校验失败)\n\n1.14.0 改了 main.js 但 manifest.files 仍写着旧哈希 720b8aaa,客户端装载时\n比对真实字节 e6e9ec6a 直接拒绝(提示词库显示「未加载 · 完整性校验失败」)。\n\n- plugins/promptlib/manifest.json:版本 1.14.1,files 按真实字节重算\n- plugins/index.json:同步版本与三处哈希\n- scripts/gen-market.js:生成市场包前断言 manifest.files == 实际字节,不符即中断\n- tests/plugin-manifest-hashes-test.js:门禁里守住 manifest.files / index.json 哈希与版本一致
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 50s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 50s
This commit is contained in:
1 parent
012fd0267c
commit
e781fa9f5b
6 files changed
+76
-6
No files matched your search
@@ -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 }
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user