[AsarUpdate] Minor source cleanup, remove updatePrompt
This commit is contained in:
parent
9ed1b0b01b
commit
2e4b8e2bc9
1 changed files with 2 additions and 17 deletions
|
@ -14,7 +14,7 @@ const getAsarHash = () => createHash('sha512').update(fs.readFileSync(asarPath))
|
||||||
module.exports = async () => { // (Try) update asar
|
module.exports = async () => { // (Try) update asar
|
||||||
log('AsarUpdate', 'Updating...');
|
log('AsarUpdate', 'Updating...');
|
||||||
|
|
||||||
if (!oaVersion.includes('-')) return log('AsarUpdate', 'Non-standard version');
|
if (!oaVersion.includes('-')) return;
|
||||||
|
|
||||||
const originalHash = getAsarHash();
|
const originalHash = getAsarHash();
|
||||||
|
|
||||||
|
@ -29,23 +29,8 @@ module.exports = async () => { // (Try) update asar
|
||||||
request.get(asarUrl).on('response', r => r.pipe(file));
|
request.get(asarUrl).on('response', r => r.pipe(file));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (fs.readFileSync(downloadPath, 'utf8').startsWith('<Error>')) return log('AsarUpdate', 'Download error');
|
if (fs.readFileSync(downloadPath, 'utf8').startsWith('<')) return log('AsarUpdate', 'Download error');
|
||||||
|
|
||||||
fs.copyFileSync(downloadPath, asarPath); // Overwrite actual app.asar
|
fs.copyFileSync(downloadPath, asarPath); // Overwrite actual app.asar
|
||||||
fs.unlinkSync(downloadPath); // Delete downloaded temp file
|
fs.unlinkSync(downloadPath); // Delete downloaded temp file
|
||||||
|
|
||||||
|
|
||||||
if (oaConfig.updatePrompt === true && originalHash !== getAsarHash()) {
|
|
||||||
const { response } = await dialog.showMessageBox(null, {
|
|
||||||
message: 'Updated OpenAsar',
|
|
||||||
detail: `Restart required to use new version.`,
|
|
||||||
buttons: ['Restart', 'Later'],
|
|
||||||
defaultId: 0
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response === 0) {
|
|
||||||
app.relaunch();
|
|
||||||
app.exit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
Loading…
Reference in a new issue