From 056c782af779f8c8fbae2b50e8a1a3682b4fb714 Mon Sep 17 00:00:00 2001 From: ThearchyHelios Date: Wed, 7 Oct 2026 00:23:24 +0800 Subject: [PATCH] =?UTF-8?q?M3=20check-bundle=20=E6=94=B6=E5=B0=BE=EF=BC=9A?= =?UTF-8?q?=E4=BC=AA=E9=80=A0=E7=9A=84=E8=BE=85=E5=8A=A9=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E4=BA=A4=E5=9B=9E=E7=94=A8=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E7=9A=84=E6=94=B9=E5=89=8D=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/check-bundle.mjs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/check-bundle.mjs b/scripts/check-bundle.mjs index 1666bd2a..6fae442d 100644 --- a/scripts/check-bundle.mjs +++ b/scripts/check-bundle.mjs @@ -162,7 +162,7 @@ const hasItem = (s, check, result, text) => s.items.some((i) => i.check === chec /** * 「哈希全部重算」的伪造:报告里挑一个能核对的数字或取值(引用口径卡或随文件附带的快照,pick(片段) 为真的第一个), * edit(片段) 改它,再把文档、引用它的事件、清单哈希、页面顶部的封存哈希全部重算。返回改了哪一处的说明(what、所在报告 - * node、片段 seg、改之前的显示文字 before),找不到可改的返回 null + * node、改过的片段 seg),找不到可改的返回 null */ function rewrite(data, pick, edit) { const docArt = data.artifacts.find((a) => a.kind === 'report_doc' && typeof a.b64 === 'string') @@ -176,7 +176,6 @@ function rewrite(data, pick, edit) { && embedded.has(doc.catalog?.[c.alias]?.artifact) && pick(seg)) hit = seg } if (!hit) return null - const before = hit.text edit(hit) const bytes = Buffer.from(JSON.stringify(doc), 'utf8') const oldId = docArt.id @@ -194,7 +193,7 @@ function rewrite(data, pick, edit) { .map(([e]) => `${e.seq}|${e.type}|${e.node_id ?? ''}|${e.data_sha256}`) data.meta.manifest_hash = sha(lines.join('\n')) return { what: `片段 ${hit.id}(${hit.cite.kind})`, node: data.reports.find((r) => r.doc_artifact === newId)?.node_id, - seg: hit, before } + seg: hit } } /** 改一个数字的引用值(显示文字不动),重算全部哈希:⑤ 拿口径卡、快照对出来 */