aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2022-02-23 18:33:59 +0100
committer0neGal <mail@0negal.com>2022-02-23 18:44:27 +0100
commit5193485b5c66170330b920d891e3fe1442cc1f3d (patch)
treef1a64a3fccc64774d527165fc5d6c68d4cf5d4f6
parent70309583c81622ff5f5d41e2a9b85df287792326 (diff)
downloadViper-5193485b5c66170330b920d891e3fe1442cc1f3d.tar.gz
Viper-5193485b5c66170330b920d891e3fe1442cc1f3d.zip
implement ability to disable NS auto-updates
Albeit with some caveats, due to the way electron-updater is setup, if you're not on a version of Viper which supports auto-updates the event which runs the NS Updater code will never be run, and hence it'll never auto-update. This was also an issue before, but I only noticed it now.
-rw-r--r--src/index.js8
-rw-r--r--src/utils.js10
2 files changed, 14 insertions, 4 deletions
diff --git a/src/index.js b/src/index.js
index fa2a35f..0e8364f 100644
--- a/src/index.js
+++ b/src/index.js
@@ -59,7 +59,13 @@ function start() {
win.webContents.send("mods", utils.mods.list());
});
- if (utils.settings.autoupdate) {utils.updatevp(false)}
+ if (utils.settings.autoupdate) {
+ utils.updatevp(false)
+ } else {
+ if (utils.settings.nsupdate) {
+ utils.update();
+ }
+ }
autoUpdater.on("update-downloaded", () => {
win.webContents.send("updateavailable")
diff --git a/src/utils.js b/src/utils.js
index 2449a73..655eee0 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -75,7 +75,7 @@ async function isGameRunning() {
//
// It uses isGameRunning() to ensure it doesn't run while the game is
// running, as that may have all kinds of issues.
-function handleNorthstarAutoUpdating() {
+function handleNorthstarUpdating() {
if (!settings.autoupdate || !fs.existsSync("viper.json") || settings.gamepath.length === 0) {
return;
}
@@ -314,8 +314,11 @@ function updatevp(autoinstall) {
autoUpdater.on("error", (info) => {cli.exit(1)});
autoUpdater.on("update-not-available", (info) => {
- // only check for N* updates if Viper itself has no updates
- handleNorthstarAutoUpdating();
+ // only check for NS updates if Viper itself has no updates and
+ // if NS auto updates is enabled.
+ if (settings.nsupdate || cli.hasArgs()) {
+ handleNorthstarUpdating();
+ }
cli.exit();
});
@@ -767,6 +770,7 @@ module.exports = {
getNSVersion,
getTF2Version,
isGameRunning,
+ handleNorthstarUpdating,
setlang: (lang) => {
settings.lang = lang;
saveSettings();