Skip to content

Commit

Permalink
fix app updating
Browse files Browse the repository at this point in the history
  • Loading branch information
sylviiu committed Mar 5, 2024
1 parent b99c27c commit 8ebbbff
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions core/checkForUpdates.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ module.exports = (manual) => new Promise(async res => {
if(global.testrun) return res(null);

// if the last check was less than 15 minutes ago, don't check again unless it's a manual check
if(Date.now() - lastChecked > 900000/* && !manual*/) return res(null);
if(Date.now() - lastChecked > 900000 && !manual) return res(null);

const { nightlyUpdates } = await require(`../getConfig`)()

Expand All @@ -149,7 +149,7 @@ module.exports = (manual) => new Promise(async res => {
if((!nightlyUpdates && pkg.version.includes(`-dev.`))) {
autoUpdater.currentVersion = `1.0.0`;
AppUpdater.currentVersion = `1.0.0`;
} else if((nightlyUpdates && !pkg.version.includes(`-dev.`))) {
} else {
autoUpdater.currentVersion = pkg.version;
AppUpdater.currentVersion = pkg.version;
}
Expand Down Expand Up @@ -187,14 +187,15 @@ module.exports = (manual) => new Promise(async res => {
headingText: `Already checking for updates!`,
bodyText: `ezytdl is already checking for updates!`,
});
return res(null)
}

if(!global.updateAvailable || manual) {
res(null)
} else if(!global.updateAvailable || manual) {
promises.push({res});
setProgress({ progress: -1, status: `Checking for updates...` });
autoUpdater.checkForUpdates();
} else res(null);
} else {
console.log(`refusing to check for updates; updateavailable? ${global.updateAvailable}; manual? ${manual}; checking? ${checkingForUpdates}`)
res(null);
}
});

module.exports.setProgress = setProgress;

0 comments on commit 8ebbbff

Please sign in to comment.