diff options
author | Rémy Raes <contact@remyraes.com> | 2022-09-16 07:51:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-16 07:51:42 +0200 |
commit | a504dbe5e3a1dacb90a60409bbfb784f243a9413 (patch) | |
tree | cd3ed238357f4a82575b498608a2f144cf33cd23 /src | |
parent | 16c658e245074dc2e5c9ccf09d4e5f421602fa95 (diff) | |
parent | 096c54e746def93eb6ee1b2a8d91e1e62555d610 (diff) | |
download | Viper-a504dbe5e3a1dacb90a60409bbfb784f243a9413.tar.gz Viper-a504dbe5e3a1dacb90a60409bbfb784f243a9413.zip |
Merge branch '0neGal:main' into feat/ci-builds
Diffstat (limited to 'src')
-rw-r--r-- | src/app/index.html | 2 | ||||
-rw-r--r-- | src/app/main.js | 4 | ||||
-rw-r--r-- | src/cli.js | 6 | ||||
-rw-r--r-- | src/extras/requests.js | 2 | ||||
-rw-r--r-- | src/index.js | 8 | ||||
-rw-r--r-- | src/utils.js | 15 |
6 files changed, 18 insertions, 19 deletions
diff --git a/src/app/index.html b/src/app/index.html index 819caac..1b3944d 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -220,7 +220,7 @@ <button id="playNsBtn" class="playBtn" onclick="launch()">%%gui.launch%%</button> <div class="inline"> <div id="nsversion"></div> - <a id="update" href="#" onclick="update()">(%%gui.update.check%%)</a> + <a id="update" href="#" onclick="updateNorthstar()">(%%gui.update.check%%)</a> <div id="serverstatus" class="checking"></div> </div> </div> diff --git a/src/app/main.js b/src/app/main.js index d6a57d6..bd25071 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -69,7 +69,7 @@ if (!navigator.onLine) { } function exit() {ipcRenderer.send("exit")} -function update() {ipcRenderer.send("update")} +function updateNorthstar() {ipcRenderer.send("update-northstar")} // Reports to the main process about game path status. // @param {boolean} value is game path loaded @@ -80,7 +80,7 @@ function setpath(value = false) { // Tells the main process to launch or install Northstar function launch() { if (shouldInstallNorthstar) { - update(); + updateNorthstar(); shouldInstallNorthstar = false; } else { ipcRenderer.send("launch-ns"); @@ -18,11 +18,11 @@ function hasArgs() { cli.hasSwitch("launch") || cli.hasSwitch("setpath") || cli.hasSwitch("version") || - cli.hasSwitch("updatevp") || cli.hasSwitch("gamepath") || cli.hasSwitch("togglemod") || cli.hasSwitch("removemod") || - cli.hasSwitch("installmod")) { + cli.hasSwitch("installmod") || + cli.hasSwitch("update-viper")) { return true; } else {return false} } @@ -64,7 +64,7 @@ async function init() { --cli ${lang("cli.help.cli")} --update ${lang("cli.help.update")} - --updatevp ${lang("cli.help.updatevp")} + --update-viper ${lang("cli.help.updatevp")} --setpath ${lang("cli.help.setpath")} --no-vp-updates ${lang("cli.help.novpupdates")} diff --git a/src/extras/requests.js b/src/extras/requests.js index 7509e9e..a5f3121 100644 --- a/src/extras/requests.js +++ b/src/extras/requests.js @@ -6,7 +6,7 @@ const lang = require("../lang"); // all requests results are stored in this file -const cachePath = path.join(app.getPath("cache"), "requests.json"); +const cachePath = path.join(app.getPath("cache"), "viper-requests.json"); const NORTHSTAR_LATEST_RELEASE_KEY = "nsLatestRelease"; const NORTHSTAR_RELEASE_NOTES_KEY = "nsReleaseNotes"; const VIPER_RELEASE_NOTES_KEY = "vpReleaseNotes"; diff --git a/src/index.js b/src/index.js index e01a635..30e36f5 100644 --- a/src/index.js +++ b/src/index.js @@ -105,7 +105,7 @@ function start() { if (cli.hasParam("no-vp-updates")) { utils.handleNorthstarUpdating(); } else { - utils.updatevp(false) + utils.updateViper(false) } } else { utils.handleNorthstarUpdating(); @@ -146,7 +146,7 @@ ipcMain.on("launch-vanilla", () => {utils.launch("vanilla")}); ipcMain.on("setlang", (event, lang) => {utils.setlang(lang)}); -ipcMain.on("update", () => {utils.update()}) +ipcMain.on("update-northstar", () => {utils.updateNorthstar()}) ipcMain.on("setpath-cli", () => {utils.setpath()}); ipcMain.on("setpath", (event, value) => { if (! value) { @@ -224,8 +224,8 @@ process.chdir(app.getPath("appData")); // starts the GUI or CLI if (cli.hasArgs()) { - if (cli.hasParam("updatevp")) { - utils.updatevp(true); + if (cli.hasParam("update-viper")) { + utils.updateViper(true); } else { cli.init(); } diff --git a/src/utils.js b/src/utils.js index 31a2b28..b69c957 100644 --- a/src/utils.js +++ b/src/utils.js @@ -13,7 +13,6 @@ const findgame = require("./extras/findgame"); const unzip = require("unzipper"); const repair = require("jsonrepair"); -const run = require("child_process").spawn; const exec = require("child_process").exec; const { https } = require("follow-redirects"); @@ -169,7 +168,7 @@ function handleNorthstarUpdating() { }).show(); } else { console.log(lang("cli.autoupdates.updatingns")); - update(); + updateNorthstar(); } } else { console.log(lang("cli.autoupdates.noupdate")); @@ -353,7 +352,7 @@ restoreExcludedFiles(); // 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. -async function update() { +async function updateNorthstar() { if (! gamepathExists()) {return} ipcMain.emit("ns-update-event", "cli.update.checking"); @@ -446,7 +445,7 @@ async function update() { // This uses electron updater to easily update and publish releases, it // simply fetches it from GitHub and updates if it's outdated, very // useful. Not much we have to do on our side. -function updatevp(autoinstall) { +function updateViper(autoinstall) { const { autoUpdater } = require("electron-updater"); if (! autoUpdater.isUpdaterActive()) { @@ -491,11 +490,11 @@ function launch(version) { switch(version) { case "vanilla": console.log(lang("general.launching"), "Vanilla..."); - run(path.join(settings.gamepath + "/Titanfall2.exe")); + exec("Titanfall2.exe", {cwd: settings.gamepath}); break; default: console.log(lang("general.launching"), "Northstar..."); - run(path.join(settings.gamepath + "/NorthstarLauncher.exe")); + exec("NorthstarLauncher.exe", {cwd: settings.gamepath}); break; } } @@ -939,10 +938,10 @@ module.exports = { mods, winLog, - update, - updatevp, + updateViper, getNSVersion, getTF2Version, + updateNorthstar, handleNorthstarUpdating, launch, |