Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dialog.showMessageBox(win, messageBoxOptions, (responseIndex) => {
if (responseIndex === messageBoxOptions.defaultId) {
autoUpdater.downloadUpdate(updateCheckResult.cancellationToken)
} else if (responseIndex !== -1) {
fs.writeFile(
path.join(app.getPath("userData"), "skip_version"),
info.version.toString(),
(err) => {
if (err) {
console.log("Error writing to skip_version file")
} else {
console.log("Wrote to skip_version file")
}
}
)
}
})
} catch (e) {
}, function (res) {
if (res === 0) {
autoUpdater.downloadUpdate();
}
});
});
const downloadUpdate = () => {
autoUpdater.downloadUpdate();
isDownloadingUpdate = true;
};
function startDownload() {
autoUpdater.checkForUpdates();
autoUpdater.downloadUpdate();
}
ipcMain.on('mt::NEED_UPDATE', (e, { needUpdate }) => {
if (needUpdate) {
autoUpdater.downloadUpdate()
} else {
runningUpdate = false
}
})
buttonIndex => {
if (buttonIndex === 0) {
autoUpdater.downloadUpdate();
} else {
updater.enabled = true;
updater = null;
}
}
);
return;
}
const { response, checkboxChecked } = await dialog.showMessageBox(win, {
type: "info",
message: `A new version of Padloc is available! (v${versionInfo.version})`,
detail: htmlToText(versionInfo.releaseNotes as string),
checkboxLabel: "Automatically download and install updates in the future (recommended)",
buttons: ["Remind Me Later", "Download And Install"],
defaultId: 1
});
settings.set("autoDownloadUpdates", checkboxChecked);
if (response === 1) {
autoUpdater.downloadUpdate();
dialog.showMessageBox(win, {
message: "Downloading Update...",
detail: "The new version is being downloaded. You'll be notified when it is ready to be installed!"
});
}
}
(buttonIndex) => {
if (buttonIndex === 0) {
autoUpdater.downloadUpdate();
} else {
updater.enabled = true;
updater = null;
}
}
);
ipcMain.on('autoUpdate-start', () => {
autoUpdater.downloadUpdate();
});
ipcMain.on('windowFocusEvents', (event) => {
}, (buttonIndex) => {
if (buttonIndex === 0) {
autoUpdater.downloadUpdate()
} else {
updater.enabled = true
updater = null
}
})
})