From f3e5e1596a22c3df38a8c00a5ceadf8a5dd2967a Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sat, 16 Sep 2023 18:17:04 +0200 Subject: added buttons for fixing some problems and alike I will likely add more buttons in the future, but for now this is most of the ones a user could need to repair problems. --- src/modules/requests.js | 7 +++++++ src/modules/update.js | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/modules') diff --git a/src/modules/requests.js b/src/modules/requests.js index 94639fa..a67bc26 100644 --- a/src/modules/requests.js +++ b/src/modules/requests.js @@ -27,6 +27,12 @@ function _getRequestsCache() { } } +function delete_cache() { + if (fs.existsSync(cachePath)) { + return fs.rmSync(cachePath); + } +} + // Returns latest Northstar version available from GitHub releases. If // there's no cache result for this request, or if cache exists but is // old, refreshes cache with new data. @@ -182,6 +188,7 @@ async function getVpReleaseNotes() { } module.exports = { + delete_cache, getLatestNsVersion, getLatestNsVersionLink, getNsReleaseNotes, diff --git a/src/modules/update.js b/src/modules/update.js index 087cbd9..c2d10d3 100644 --- a/src/modules/update.js +++ b/src/modules/update.js @@ -150,7 +150,10 @@ update.viper = (autoinstall) => { // as to handle not overwriting files we rename certain files to // .excluded, then rename them back after the extraction. The // unzip module does not support excluding files directly. -update.northstar = async () => { +// +// `force_install` makes this function not care about whether or not +// we're already up-to-date, forcing the install +update.northstar = async (force_install) => { if (await is_running.game()) { console.error(lang("general.auto_updates.game_running")); return false; @@ -170,7 +173,7 @@ update.northstar = async () => { } // Makes sure it is not already the latest version - if (! await northstar_update_available()) { + if (! force_install && ! await northstar_update_available()) { ipcMain.emit("ns-update-event", "cli.update.uptodate_short"); console.ok(lang("cli.update.uptodate").replace("%s", ns_version)); -- cgit v1.2.3