aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2022-01-11 20:06:41 +0100
committer0neGal <mail@0negal.com>2022-01-11 20:06:41 +0100
commit84c62584f03126bf23b5c2899e05359d7bfc4471 (patch)
tree860d7ef63238a9355c42b17d01d68e2c8efa2b4c
parentfe6dd267136f09bab721d3f02d43b991ac2bad3d (diff)
downloadViper-84c62584f03126bf23b5c2899e05359d7bfc4471.tar.gz
Viper-84c62584f03126bf23b5c2899e05359d7bfc4471.zip
formatting, and localized logs
-rw-r--r--src/lang/en.json6
-rw-r--r--src/utils.js22
2 files changed, 18 insertions, 10 deletions
diff --git a/src/lang/en.json b/src/lang/en.json
index 2003bee..bb5cf09 100644
--- a/src/lang/en.json
+++ b/src/lang/en.json
@@ -19,6 +19,12 @@
"cli.update.finished": "Installation/Update finished!",
"cli.update.uptodate": "Latest version (%s) is already installed, skipping update.",
+ "cli.autoupdates.checking": "Checking for Northstar updates...",
+ "cli.autoupdates.available": "Northstar update available!",
+ "cli.autoupdates.gamerunning": "Game is running, refusing to update Northstar",
+ "cli.autoupdates.updatingns": "Launching update process...",
+ "cli.autoupdates.noupdate": "No Northstar update available.",
+
"cli.launch.linuxerror": "Launching the game is not currently supported on Linux",
"cli.mods.failed": "Failed to install mod!",
diff --git a/src/utils.js b/src/utils.js
index 95e54e0..87499ae 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -36,7 +36,7 @@ if (fs.existsSync("viper.json")) {
}
-async function _isGameRunning() {
+async function isGameRunning() {
return new Promise(resolve => {
let procs = ["Titanfall2.exe", "Titanfall2-unpacked.exe", "NorthstarLauncher.exe"];
let cmd = (() => {
@@ -60,28 +60,29 @@ async function _isGameRunning() {
}
northstar_auto_updates: {
- if (!settings.autoupdate || !fs.existsSync("viper.json") || settings.gamepath.length === 0)
+ if (!settings.autoupdate || !fs.existsSync("viper.json") || settings.gamepath.length === 0) {
break northstar_auto_updates;
+ }
async function _checkForUpdates() {
- const localVersion = getNSVersion();
- const distantVersion = await requests.getLatestNsVersion();
- console.log('Checking for Northstar updates...');
+ let localVersion = getNSVersion();
+ let distantVersion = await requests.getLatestNsVersion();
+ console.log(lang("cli.autoupdates.checking"));
if (localVersion !== distantVersion) {
- console.log('Northstar update available!');
- if (await _isGameRunning()) {
- console.log('Not installing update since game is running.');
+ console.log(lang("cli.autoupdates.available"));
+ if (await isGameRunning()) {
+ console.log(lang("cli.autoupdates.gamerunning"));
new Notification({
title: lang("gui.nsupdate.gaming.title"),
body: lang("gui.nsupdate.gaming.body")
}).show();
} else {
- console.log('Launching update process.');
+ console.log(lang("cli.autoupdates.updatingns"));
update();
}
} else {
- console.log('No Northstar update available.')
+ console.log(lang("cli.autoupdates.noupdate"))
}
setTimeout(
@@ -486,6 +487,7 @@ module.exports = {
updatevp,
settings,
getNSVersion,
+ isGameRunning,
setlang: (lang) => {
settings.lang = lang;
saveSettings();