This commit is contained in:
2021-08-04 17:17:16 -05:00
parent ce6d96e59b
commit e23c0086c2
75 changed files with 1255 additions and 1246 deletions

View File

@@ -3,7 +3,7 @@ const fs = require('fs');
const helpers = require('../../helpers');
const os = require('os');
const addListeners = (ipcMain, { setIsInstalling, unmountAllDrives, standardIPCReply }) => {
const addListeners = (ipcMain, {setIsInstalling, unmountAllDrives, standardIPCReply}) => {
ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => {
let allowSkipVerification = true;
@@ -19,7 +19,8 @@ const addListeners = (ipcMain, { setIsInstalling, unmountAllDrives, standardIPCR
if (tempPub) {
fs.unlinkSync(tempPub);
}
} catch (e) {}
} catch (e) {
}
};
const errorHandler = (err) => {
@@ -75,35 +76,35 @@ const addListeners = (ipcMain, { setIsInstalling, unmountAllDrives, standardIPCR
const executeInstall = () => {
setIsInstalling(true);
helpers
.executeAsync(command, args)
.then(() => {
cleanupFiles();
standardIPCReply(event, Constants.IPC_Install_Upgrade_Reply);
})
.catch((error) => {
setIsInstalling(false);
errorHandler(error);
});
.executeAsync(command, args)
.then(() => {
cleanupFiles();
standardIPCReply(event, Constants.IPC_Install_Upgrade_Reply);
})
.catch((error) => {
setIsInstalling(false);
errorHandler(error);
});
};
if (hasSignature) {
helpers
.verifySignature(data.Source, tempSig, tempPub)
.then(() => {
executeInstall();
})
.catch(() => {
errorHandler(Error('Failed to verify installation package signature'));
});
.verifySignature(data.Source, tempSig, tempPub)
.then(() => {
executeInstall();
})
.catch(() => {
errorHandler(Error('Failed to verify installation package signature'));
});
} else if (hasHash) {
helpers
.verifyHash(data.Source, data.Sha256)
.then(() => {
executeInstall();
})
.catch(() => {
errorHandler(Error('Failed to verify installation package hash'));
});
.verifyHash(data.Source, data.Sha256)
.then(() => {
executeInstall();
})
.catch(() => {
errorHandler(Error('Failed to verify installation package hash'));
});
} else {
if (platform === 'darwin') {
setTimeout(executeInstall, 3000);
@@ -117,4 +118,4 @@ const addListeners = (ipcMain, { setIsInstalling, unmountAllDrives, standardIPCR
});
};
module.exports = { addListeners };
module.exports = {addListeners};