fix: 🐛 appUpdater support ARM64 (#2327)

Add ARM64 support for the appUpdater
This commit is contained in:
Carlos Alcaide Corvo authored and GitHub committed 2024-06-25 12:50:17 -07:00
1 parent 72cf7b0d71
commit 6d97b15591
1 file changed
+22 -2
@@ -8,9 +8,10 @@ const path = require('path');
const https = require('https');
const semver = require('semver');
const { parse } = require('node-html-parser');
const { autoUpdater, dialog } = require('electron');
const { autoUpdater, dialog, app } = require('electron');
const { isWindows, isLinux } = require('../helpers/platform.js');
const config = require('../../config/config.js');
const log = require('electron-log/main');
let currentVersion = config.releaseVersion;
const debug = process.env.DEBUG_APP_UPDATER;
@@ -19,6 +20,24 @@ if (debug && process.env.APP_UPDATER_CURRENT_VERSION) {
currentVersion = process.env.APP_UPDATER_CURRENT_VERSION;
}
// Returns the real CPU architecture of the machine.
const returnArchitectureToUpdate = () => {
const nodeArchitecture = process.arch;
if (nodeArchitecture === 'arm64') {
return nodeArchitecture;
}
try {
if (app.runningUnderARM64Translation) {
return 'arm64';
}
} catch (err) {
log.error(`returnArchitectureToUpdate: ${err}`);
}
return nodeArchitecture;
};
// Query releases url to find latest version
const findLatestVersion = (url) => {
return new Promise((resolve, reject) => {
@@ -38,7 +57,8 @@ const findLatestVersion = (url) => {
// Find zip archive for update
const findUpdateArchive = (version) => {
const url = `${releasesUrl}${version}/boundary-desktop_${version}_darwin_amd64.zip`;
const architecture = returnArchitectureToUpdate();
const url = `${releasesUrl}${version}/boundary-desktop_${version}_darwin_${architecture}.zip`;
return new Promise((resolve, reject) => {
https.get(url, (response) => {
if (response.statusCode === 403)