// 校验注入后的 exe 里确实含有署名。 // // 为什么不用 findstr:它在 chcp 65001 下匹配不了 UTF-8 中文(会静默误报 NOT found), // 而 build.bat 又必须保持纯 ASCII。用 Node 读字节比对最稳。 import { existsSync, readFileSync } from 'node:fs' import { dirname, join } from 'node:path' const root = dirname(import.meta.dirname) const sigFile = join(root, 'deploy', 'signature.build.txt') const exe = join(root, 'dist', 'scoreboard.exe') if (!existsSync(sigFile)) process.exit(0) const sig = readFileSync(sigFile, 'utf8').trim() if (sig === '') process.exit(0) if (!existsSync(exe)) { console.error(' [warn] scoreboard.exe not found, skip signature check') process.exit(0) } if (!readFileSync(exe).includes(Buffer.from(sig, 'utf8'))) { console.error(' [ERROR] internal signature NOT found in scoreboard.exe') process.exit(1) } console.log(' internal signature verified in exe')