1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Fixed auto-update download url

This commit is contained in:
Laurent Cozic 2018-05-14 12:18:00 +01:00
parent 4e032c0c55
commit b45185780f
2 changed files with 6 additions and 4 deletions

View File

@ -64,12 +64,11 @@ async function fetchLatestRelease() {
}
}
if (!downloadUrl) throw new Error('Cannot find download Url: ' + JSON.stringify(json).substr(0,500));
return {
version: version,
downloadUrl: downloadUrl,
notes: json.body,
pageUrl: json.html_url,
};
}
@ -93,6 +92,9 @@ function checkForUpdates(inBackground, window, logFilePath) {
checkInBackground_ = inBackground;
fetchLatestRelease().then(release => {
autoUpdateLogger_.info('Current version: ' + packageInfo.version);
autoUpdateLogger_.info('Latest version: ' + release.version);
if (compareVersions(release.version, packageInfo.version) <= 0) {
if (!checkInBackground_) dialog.showMessageBox({ message: _('Current version is up-to-date.') })
} else {
@ -104,7 +106,7 @@ function checkForUpdates(inBackground, window, logFilePath) {
buttons: [_('Yes'), _('No')]
});
if (buttonIndex === 0) require('electron').shell.openExternal(release.downloadUrl);
if (buttonIndex === 0) require('electron').shell.openExternal(release.downloadUrl ? release.downloadUrl : release.pageUrl);
}
}).catch(error => {
autoUpdateLogger_.error(error);

View File

@ -51,7 +51,7 @@ shim.isElectron = () => {
}
shim.isPortable = function() {
return typeof process !== 'undefined' && typeof process.env === 'object' && !!process.env.PORTABLE_EXECUTABLE_DIR;
return typeof process !== 'undefined' && typeof process.env === 'object' && !!process.env.PORTABLE_EXECUTABLE_DIR;
}
// Node requests can go wrong is so many different ways and with so