增加 CRC Hex 输入并修复依赖漏洞

This commit is contained in:
mid
2026-08-19 15:54:22 +08:00
parent 0ae6db36cb
commit 8bc6032f38
13 changed files with 268 additions and 37 deletions
+9 -1
View File
@@ -1,4 +1,4 @@
import { calculateCrcReport, type CrcWorkerRequest, type CrcWorkerResponse } from '@/lib/crcWorker'
import { calculateCrcHexInput, calculateCrcReport, type CrcWorkerRequest, type CrcWorkerResponse } from '@/lib/crcWorker'
import { getFirmwareFormat, MAX_FIRMWARE_FILE_SIZE, parseFirmwareContent } from '@/lib/firmware'
import type { DataBlock } from '@/lib/intelHex'
@@ -31,6 +31,14 @@ workerScope.onmessage = async (event) => {
})
return
}
if (request.type === 'calculate-hex') {
workerScope.postMessage({
type: 'calculated-hex',
id: request.id,
...calculateCrcHexInput(request.input, request.parameters),
})
return
}
if (!firmwareBlocks) throw new Error('请先选择 BIN 或 Intel HEX 文件')
workerScope.postMessage({ type: 'calculated', id: request.id, ...calculateCrcReport(firmwareBlocks, request.parameters) })
} catch (reason) {