From 24be8c89cb37b40cbc3ea484747d42d2bf996c15 Mon Sep 17 00:00:00 2001 From: Nat3z <66748576+Nat3z@users.noreply.github.com> Date: Mon, 2 Mar 2026 19:48:38 -0800 Subject: [PATCH 1/2] fix: fixed blockmap updates --- updater/src/main.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/updater/src/main.js b/updater/src/main.js index 35354fe..249ade6 100644 --- a/updater/src/main.js +++ b/updater/src/main.js @@ -432,7 +432,7 @@ async function downloadFullRelease(release) { mainWindow.webContents.send('text', 'Downloading Update'); const downloadPath = process.platform === 'win32' - ? './update.zip' + ? path.join(__dirname, 'update.zip') : './update/OpenGameInstaller.AppImage'; if (process.platform === 'linux') { fs.mkdirSync('./update', { recursive: true }); @@ -452,16 +452,17 @@ async function downloadFullRelease(release) { mainWindow.webContents.send('text', 'Download Complete'); if (process.platform === 'win32') { - persistSourceArtifact(assetWithPortable.name, './update.zip'); + const zipPath = path.join(__dirname, 'update.zip'); + persistSourceArtifact(assetWithPortable.name, zipPath); mainWindow.webContents.send('text', 'Extracting Update'); - await unzip(`./update.zip`, localCache); + await unzip(zipPath, localCache); mainWindow.webContents.send('text', 'Copying Update Files'); copyCacheToUpdate(localCache); fs.copyFileSync( - './update.zip', + zipPath, path.join(localCache, assetWithPortable.name) ); - fs.unlinkSync('./update.zip'); + fs.unlinkSync(zipPath); } else { const item = path.join(__dirname, 'update', 'OpenGameInstaller.AppImage'); fs.copyFileSync(item, path.join(localCache, 'OpenGameInstaller.AppImage')); @@ -605,7 +606,13 @@ async function applyBlockmapPatch( `Short read from source artifact at ${matched.offset}: expected ${size}, got ${bytesRead}` ); } - fs.writeSync(outFd, buffer, 0, size, writeOffset); + const actualChecksum = createHash('sha256').update(buffer).digest('base64').replace(/=+$/, ''); + const expectedChecksum = (newFile.checksums[i] || '').replace(/=+$/, ''); + if (actualChecksum !== expectedChecksum) { + misses.push({ offset: writeOffset, size }); + } else { + fs.writeSync(outFd, buffer, 0, size, writeOffset); + } } else { misses.push({ offset: writeOffset, size }); } From f8656d2fd1955577e3b3c42a1748043018fb0a9b Mon Sep 17 00:00:00 2001 From: Nat3z <66748576+Nat3z@users.noreply.github.com> Date: Mon, 2 Mar 2026 20:24:50 -0800 Subject: [PATCH 2/2] Update updater/src/main.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- updater/src/main.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/updater/src/main.js b/updater/src/main.js index 249ade6..301fec1 100644 --- a/updater/src/main.js +++ b/updater/src/main.js @@ -606,9 +606,20 @@ async function applyBlockmapPatch( `Short read from source artifact at ${matched.offset}: expected ${size}, got ${bytesRead}` ); } - const actualChecksum = createHash('sha256').update(buffer).digest('base64').replace(/=+$/, ''); - const expectedChecksum = (newFile.checksums[i] || '').replace(/=+$/, ''); - if (actualChecksum !== expectedChecksum) { + const expectedChecksum = newFile.checksums[i]; + const digestBytes = createHash('sha256').update(buffer).digest(); + const actualBase64 = digestBytes.toString('base64'); + const actualHex = digestBytes.toString('hex'); + const normalizedExpected = + typeof expectedChecksum === 'string' + ? expectedChecksum.replace(/=+$/, '') + : ''; + const normalizedBase64 = actualBase64.replace(/=+$/, ''); + if ( + expectedChecksum !== actualBase64 && + expectedChecksum !== actualHex && + normalizedExpected !== normalizedBase64 + ) { misses.push({ offset: writeOffset, size }); } else { fs.writeSync(outFd, buffer, 0, size, writeOffset);