aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2023-09-16 18:17:04 +0200
committer0neGal <mail@0negal.com>2023-09-16 18:17:04 +0200
commitf3e5e1596a22c3df38a8c00a5ceadf8a5dd2967a (patch)
treea5ae56bdc7baedc22930697de9cefc171705410d /src/modules
parent53c19052738a4a9cc43feca31e8231c844b4d2b5 (diff)
downloadViper-f3e5e1596a22c3df38a8c00a5ceadf8a5dd2967a.tar.gz
Viper-f3e5e1596a22c3df38a8c00a5ceadf8a5dd2967a.zip
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.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/requests.js7
-rw-r--r--src/modules/update.js7
2 files changed, 12 insertions, 2 deletions
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
// <file>.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));