mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-29 03:15:51 +02:00
Add a safeguard to updater to open browser if the update installer is missing
This commit is contained in:
parent
67a2e40622
commit
b0d88a0a37
@ -19,6 +19,11 @@
|
|||||||
//
|
//
|
||||||
const updateCheckUrlAll = "https://api.github.com/repos/chylex/TweetDuck/releases";
|
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.
|
// Function: Creates the update notification element. Removes the old one if already exists.
|
||||||
//
|
//
|
||||||
@ -28,7 +33,7 @@
|
|||||||
var ele = $("#tweetduck-update");
|
var ele = $("#tweetduck-update");
|
||||||
var existed = ele.length > 0;
|
var existed = ele.length > 0;
|
||||||
|
|
||||||
if (existed > 0){
|
if (existed){
|
||||||
ele.remove();
|
ele.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +111,13 @@
|
|||||||
|
|
||||||
buttonDiv.children(".tdu-btn-download").click(function(){
|
buttonDiv.children(".tdu-btn-download").click(function(){
|
||||||
ele.remove();
|
ele.remove();
|
||||||
$TDU.onUpdateAccepted(version, download);
|
|
||||||
|
if (download){
|
||||||
|
$TDU.onUpdateAccepted(version, download);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$TDU.openBrowser(updateDownloadFallback);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
buttonDiv.children(".tdu-btn-unsupported").click(function(){
|
buttonDiv.children(".tdu-btn-unsupported").click(function(){
|
||||||
@ -139,7 +150,7 @@
|
|||||||
var hasUpdate = tagName !== versionTag && tagName !== dismissedVersionTag && release.assets.length > 0;
|
var hasUpdate = tagName !== versionTag && tagName !== dismissedVersionTag && release.assets.length > 0;
|
||||||
|
|
||||||
if (hasUpdate){
|
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);
|
displayNotification(tagName, obj.browser_download_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user