electrobun 1.2.2-beta.2 → 1.2.2-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/bun/core/Updater.ts +16 -9
- package/package.json +1 -1
- package/src/cli/index.ts +4 -3
|
@@ -404,19 +404,20 @@ const Updater = {
|
|
|
404
404
|
|
|
405
405
|
emitStatus('extracting-version', 'Extracting version info from patched tar...', { currentHash });
|
|
406
406
|
|
|
407
|
-
let
|
|
407
|
+
let hashFilePath = "";
|
|
408
408
|
const untarDir = join(appDataFolder, "self-extraction", "tmpuntar");
|
|
409
409
|
mkdirSync(untarDir, { recursive: true });
|
|
410
410
|
|
|
411
|
-
//
|
|
412
|
-
|
|
411
|
+
// Extract the hash from the patched tar:
|
|
412
|
+
// - macOS/Windows: Resources/version.json (inside the app bundle directory)
|
|
413
|
+
// - Linux: metadata.json (alongside the AppImage, since AppImage is opaque)
|
|
414
|
+
const resourcesDir = 'Resources';
|
|
413
415
|
await tar.x({
|
|
414
|
-
// gzip: false,
|
|
415
416
|
file: tmpPatchedTarFilePath,
|
|
416
417
|
cwd: untarDir,
|
|
417
418
|
filter: (path: string) => {
|
|
418
|
-
if (path.endsWith(`${resourcesDir}/version.json`)) {
|
|
419
|
-
|
|
419
|
+
if (path.endsWith(`${resourcesDir}/version.json`) || path.endsWith('metadata.json')) {
|
|
420
|
+
hashFilePath = path;
|
|
420
421
|
return true;
|
|
421
422
|
} else {
|
|
422
423
|
return false;
|
|
@@ -424,10 +425,16 @@ const Updater = {
|
|
|
424
425
|
},
|
|
425
426
|
});
|
|
426
427
|
|
|
427
|
-
|
|
428
|
-
|
|
428
|
+
if (!hashFilePath) {
|
|
429
|
+
emitStatus('error', 'Could not find version/metadata file in patched tar', { currentHash });
|
|
430
|
+
console.error("Neither Resources/version.json nor metadata.json found in patched tar:", tmpPatchedTarFilePath);
|
|
431
|
+
break;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
const hashFileJson = await Bun.file(
|
|
435
|
+
join(untarDir, hashFilePath)
|
|
429
436
|
).json();
|
|
430
|
-
const nextHash =
|
|
437
|
+
const nextHash = hashFileJson.hash;
|
|
431
438
|
|
|
432
439
|
if (seenHashes.includes(nextHash)) {
|
|
433
440
|
emitStatus('error', 'Cyclical update detected, falling back to full download', { currentHash: nextHash });
|
package/package.json
CHANGED
package/src/cli/index.ts
CHANGED
|
@@ -2065,7 +2065,7 @@ if (commandArg === "init") {
|
|
|
2065
2065
|
// 3. Icon file
|
|
2066
2066
|
// 4. Metadata
|
|
2067
2067
|
|
|
2068
|
-
const tempDirName = `${appFileName}-
|
|
2068
|
+
const tempDirName = `${appFileName}-tar-staging`;
|
|
2069
2069
|
const tempDirPath = join(buildFolder, tempDirName);
|
|
2070
2070
|
|
|
2071
2071
|
// Clean up any existing temp directory
|
|
@@ -2078,7 +2078,7 @@ if (commandArg === "init") {
|
|
|
2078
2078
|
const innerDirPath = join(tempDirPath, appFileName);
|
|
2079
2079
|
mkdirSync(innerDirPath, { recursive: true });
|
|
2080
2080
|
|
|
2081
|
-
// Copy AppImage
|
|
2081
|
+
// Copy AppImage (the inner app bundle on Linux)
|
|
2082
2082
|
const appImageDestPath = join(innerDirPath, `${appFileName}.AppImage`);
|
|
2083
2083
|
cpSync(appImagePath, appImageDestPath, { dereference: true });
|
|
2084
2084
|
|
|
@@ -2099,7 +2099,8 @@ if (commandArg === "init") {
|
|
|
2099
2099
|
identifier: config.app.identifier,
|
|
2100
2100
|
name: config.app.name,
|
|
2101
2101
|
version: config.app.version,
|
|
2102
|
-
channel: buildEnvironment
|
|
2102
|
+
channel: buildEnvironment,
|
|
2103
|
+
hash: hash,
|
|
2103
2104
|
};
|
|
2104
2105
|
writeFileSync(join(innerDirPath, 'metadata.json'), JSON.stringify(metadata, null, 2));
|
|
2105
2106
|
|