1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-18 15:15:48 +02:00

Add a safeguard to updater to open browser if the update installer is missing

This commit is contained in:
chylex 2017-03-09 00:52:12 +01:00
parent 67a2e40622
commit b0d88a0a37

View File

@ -19,6 +19,11 @@
//
const updateCheckUrlAll = "https://api.github.com/repos/chylex/TweetDuck/releases";
//
// Constant: Fallback url in case the update installer file is missing.
//
const updateDownloadFallback = "https://tweetduck.chylex.com/#download";
//
// Function: Creates the update notification element. Removes the old one if already exists.
//
@ -28,7 +33,7 @@
var ele = $("#tweetduck-update");
var existed = ele.length > 0;
if (existed > 0){
if (existed){
ele.remove();
}
@ -106,7 +111,13 @@
buttonDiv.children(".tdu-btn-download").click(function(){
ele.remove();
$TDU.onUpdateAccepted(version, download);
if (download){
$TDU.onUpdateAccepted(version, download);
}
else{
$TDU.openBrowser(updateDownloadFallback);
}
});
buttonDiv.children(".tdu-btn-unsupported").click(function(){
@ -139,7 +150,7 @@
var hasUpdate = tagName !== versionTag && tagName !== dismissedVersionTag && release.assets.length > 0;
if (hasUpdate){
var obj = release.assets.find(asset => asset.name === updateFileName) || release.assets[0];
var obj = release.assets.find(asset => asset.name === updateFileName) || { browser_download_url: "" };
displayNotification(tagName, obj.browser_download_url);
}