aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlystrasz <contact@remyraes.com>2022-08-06 22:47:27 +0200
committerAlystrasz <contact@remyraes.com>2022-08-06 22:47:27 +0200
commit64fb444ad72bdba342a7345644a5b55d94c7f696 (patch)
treee58e97a96372e65b6c48020cc3a0d024783c0ff4
parentc4e77a0f19804c94bc21c6d90dd3c49a37d4d5cb (diff)
downloadViper-64fb444ad72bdba342a7345644a5b55d94c7f696.tar.gz
Viper-64fb444ad72bdba342a7345644a5b55d94c7f696.zip
feat: prevent Northstar update and update download link text if no Internet
-rw-r--r--src/app/main.js1
-rw-r--r--src/lang/en.json1
-rw-r--r--src/lang/fr.json1
-rw-r--r--src/utils.js5
4 files changed, 8 insertions, 0 deletions
diff --git a/src/app/main.js b/src/app/main.js
index 9fb3191..4288d1d 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -122,6 +122,7 @@ ipcRenderer.on("ns-update-event", (event, key) => {
console.log(lang(key));
switch(key) {
case "cli.update.uptodate.short":
+ case "cli.update.noInternet":
setButtons(true);
playNsBtn.innerText = lang("gui.launch");
break;
diff --git a/src/lang/en.json b/src/lang/en.json
index 8cece10..9817a70 100644
--- a/src/lang/en.json
+++ b/src/lang/en.json
@@ -22,6 +22,7 @@
"cli.update.finished": "Installation/Update finished!",
"cli.update.uptodate": "Latest version (%s) is already installed, skipping update.",
"cli.update.uptodate.short": "Up-to-date",
+ "cli.update.noInternet": "No Internet connection",
"cli.autoupdates.checking": "Checking for Northstar updates...",
"cli.autoupdates.available": "Northstar update available!",
diff --git a/src/lang/fr.json b/src/lang/fr.json
index 1fde982..9d45e1a 100644
--- a/src/lang/fr.json
+++ b/src/lang/fr.json
@@ -22,6 +22,7 @@
"cli.update.finished": "Mise à jour terminée !",
"cli.update.uptodate": "La dernière version (%s) est déjà installée.",
"cli.update.uptodate.short": "Votre client est à jour",
+ "cli.update.noInternet": "Pas de connexion Internet",
"cli.autoupdates.checking": "Vérifications des mises à jour de Northstar...",
"cli.autoupdates.available": "Une mise à jour de Northstar est disponible !",
diff --git a/src/utils.js b/src/utils.js
index e8d14cc..b5978b6 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -155,6 +155,7 @@ function handleNorthstarUpdating() {
async function _checkForUpdates() {
let localVersion = getNSVersion();
let distantVersion = await requests.getLatestNsVersion();
+ if (distantVersion == false) return;
console.log(lang("cli.autoupdates.checking"));
// Checks if NS is outdated
@@ -361,6 +362,10 @@ async function update() {
const latestAvailableVersion = await requests.getLatestNsVersion();
console.log(latestAvailableVersion)
+ if (latestAvailableVersion == false) {
+ ipcMain.emit("ns-update-event", "cli.update.noInternet");
+ return;
+ }
// Makes sure it is not already the latest version
if (version === latestAvailableVersion) {