fix(desktop): use full Windows installers within the feed limit

This commit is contained in:
Yun Chan 2026-11-20 21:13:37 +09:00
parent 52df7e7e7b
commit df680e4716
17 changed files with 109 additions and 32 deletions

View file

@ -7,7 +7,7 @@
//
// 검증 항목:
// 1. *-Setup-*.exe 존재, 크기(4KiB ~ 100MiB), DOS MZ + PE\0\0 헤더 정합성
// 2. *.exe.blockmap 존재 및 gzip 매직 바이트(0x1f 0x8b)
// 2. 차분 모드는 *.exe.blockmap 존재·gzip 매직(0x1f 0x8b), full-only 모드는 부재 확인
// 3. latest.yml 버전 일치, 설치본 파일명 참조 일치, 실제 설치본 SHA-512 재계산 일치
// 4. win-unpacked/*.exe x86_64 PE64(0x8664) 헤더, resources/app-update.yml 정본 피드 URL,
// resources/app.asar Chromium Pickle JSON("files") 헤더 정합성
@ -31,6 +31,7 @@ import { tmpdir } from 'node:os'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { gzipSync } from 'node:zlib'
import { supportsWindowsDifferentialDownload } from './lib/desktop-installer-mode.mjs'
const root = join(dirname(fileURLToPath(import.meta.url)), '..', '..')
const CANONICAL_UPDATE_FEED =
@ -99,7 +100,8 @@ export function verifyInstallerReleaseDir({
releaseDir,
expectedVersion,
publicKeyPem,
requireSignature = false
requireSignature = false,
expectBlockmap = true
}) {
const errors = []
const fail = (cond, code) => {
@ -127,8 +129,9 @@ export function verifyInstallerReleaseDir({
const blockmapPath = join(releaseDir, `${installerName}.blockmap`)
if (!existsSync(blockmapPath)) {
errors.push('blockmap_missing')
if (expectBlockmap) errors.push('blockmap_missing')
} else {
fail(expectBlockmap, 'unexpected_blockmap_for_full_only')
const blockmapBytes = readFileSync(blockmapPath)
fail(
blockmapBytes.length >= 10 && blockmapBytes[0] === 0x1f && blockmapBytes[1] === 0x8b,
@ -275,6 +278,17 @@ function runSelfTest() {
return dir
}
const fullOnlyDir = createValidFixture('full-only')
rmSync(join(fullOnlyDir, `${installerName}.blockmap`))
const fullOnlyResult = verifyInstallerReleaseDir({
releaseDir: fullOnlyDir,
expectedVersion: version,
publicKeyPem,
requireSignature: true,
expectBlockmap: false
})
if (!fullOnlyResult.ok) throw new Error('self_test_full_only_case_failed')
const validDir = createValidFixture('valid')
const okResult = verifyInstallerReleaseDir({
releaseDir: validDir,
@ -373,7 +387,7 @@ function runSelfTest() {
'manifest_signature_invalid'
)
process.stdout.write('[release:installer:smoke] self-test GREEN (2 valid + 8 negative cases)\n')
process.stdout.write('[release:installer:smoke] self-test GREEN (3 valid + 8 negative cases)\n')
} finally {
rmSync(sandbox, { recursive: true, force: true })
}
@ -397,6 +411,9 @@ const summary = verifyInstallerReleaseDir({
releaseDir: targetDir,
expectedVersion: productVersion,
publicKeyPem,
requireSignature: args.includes('--verify-signature')
requireSignature: args.includes('--verify-signature'),
expectBlockmap: supportsWindowsDifferentialDownload(
readFileSync(join(root, 'apps', 'desktop', 'electron-builder.yml'), 'utf8')
)
})
process.stdout.write(`${JSON.stringify(summary, null, 2)}\n`)