aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md20
-rw-r--r--src/cli.js1
-rw-r--r--src/index.js1
-rw-r--r--src/modules/console.js27
-rw-r--r--src/modules/findgame.js8
-rw-r--r--src/modules/launch.js6
-rw-r--r--src/modules/mods.js24
-rw-r--r--src/modules/settings.js4
-rw-r--r--src/modules/update.js28
9 files changed, 77 insertions, 42 deletions
diff --git a/README.md b/README.md
index 1c84c09..ca953c7 100644
--- a/README.md
+++ b/README.md
@@ -37,23 +37,19 @@ Currently Viper is capable of:
* Auto-Update itself
* Be pretty!
-Besides this I've been considering adding some easy to use VPK modding tools so everybody can have fun with VPK modding even if you don't know how to do it the traditional way. However that is not at the top of the todo list right now.
+There are of course many other things that it can do, but summed up very simply, that is what Viper is capable of doing. With every update Viper gets more features and alike, often many optional features are also available in the settings menu.
+
</p>
## Configuration
-All settings take place in the settings page, found in the top right corner of the app, where you can disable auto-updates, and other related settings. You can also manually go in and edit your config file (`viper.json`), if you feel so inclined.
+All settings take place in the settings page, found in the top right corner of the app, where you can change all kinds of settings. You can also manually go in and edit your config file (`viper.json`), if you feel so inclined.
Your configuration file will be found in `%APPDATA%\viper.json` on Windows, and inside either `~/.config` or through your environment variables (`$XDG_CONFIG_HOME`) on Linux, the latter has priority.
-## Contact/Support
-
-To get support either open a GitHub issue.<br>
-Or if you must you can contact a developer through the methods below:
+## Support
-Ways to contact the main developer: [0neGal](https://github.com/0neGal)
- * Twitter: [@0neGal](https://twitter.com/0neGal)
- * Reddit: [/u/0neGal](https://reddit.com/u/0neGal)
+To get support please [open a GitHub issue](https://github.com/0neGal/viper/issues/new/choose), and clearly describe the problem with as many details as possible.
### Frequently Asked Questions (FAQ)
@@ -61,7 +57,7 @@ Many of the questions and problems you may have might be able to be answered by
## Sidenote
-Given that we already have so many Northstar updaters and launchers I urge people to instead of creating new launchers unless there's a very specific reason, just make a pull request on one of the existing, otherwise we'll continue to have new ones.
+Given that we already have so many Northstar updaters and launchers I urge people to instead of creating new launchers unless there's a very specific reason, just make a pull request on one of the existing ones, otherwise we'll continue to have new ones.
<p align="center">
Relevant xkcd:<br>
@@ -79,7 +75,7 @@ Some of the existing launchers are listed below:
## Development
-If you wanna edit Viper's code and run it and so on, you can simply do something along the lines of the below:
+If you wanna edit Viper's code, run it, and so on, you can simply do something along the lines of the below:
```sh
$ git clone https://github.com/0neGal/viper
@@ -99,7 +95,7 @@ Additionally, if you're creating your own fork you easily publish builds and or
$ GH_TOKEN="<your very long, private and wonderful token>" npm run publish
```
-Keep in mind building all Linux builds may take a while on some systems as packaging the `tar.gz` release can take a while on many CPU's, at least from my testing. All other builds should be done quickly. When using the `publish` command it also automatically uploads the needed files to deploy auto-updates, keep in mind you'd need to have the `repository` setting changed to your new fork's location, otherwise it'll fetch from the original.
+Keep in mind building all Linux builds may take a while on some systems, as packaging the `tar.gz` release can take a while on many CPUs, at least from my testing. All other builds should be done quickly. When using the `publish` command it also automatically uploads the needed files to deploy auto-updates, keep in mind you'd need to have the `repository` setting changed to your new fork's location, otherwise it'll fetch from the original.
## Credits
diff --git a/src/cli.js b/src/cli.js
index e332085..34dd8dc 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -7,6 +7,7 @@ const events = new Emitter();
const cli = app.commandLine;
const lang = require("./lang");
const json = require("./modules/json");
+console = require("./modules/console");
function hasArgs() {
// Makes sure the GUI isn't launched.
diff --git a/src/index.js b/src/index.js
index 3d2f65b..259f7cc 100644
--- a/src/index.js
+++ b/src/index.js
@@ -21,6 +21,7 @@ const settings = require("./modules/settings");
const requests = require("./modules/requests");
const is_running = require("./modules/is_running");
+console = require("./modules/console");
var log = console.log;
// Starts the actual BrowserWindow, which is only run when using the
diff --git a/src/modules/console.js b/src/modules/console.js
new file mode 100644
index 0000000..7112071
--- /dev/null
+++ b/src/modules/console.js
@@ -0,0 +1,27 @@
+let new_console = {
+ ...console
+}
+
+let orig_console = console;
+
+new_console.ok = (...args) => {
+ orig_console.log('\x1b[92m%s\x1b[0m', ...args)
+}
+
+new_console.misc = (...args) => {
+ orig_console.warn('\x1b[90m%s\x1b[0m', ...args)
+}
+
+new_console.info = (...args) => {
+ orig_console.warn('\x1b[94m%s\x1b[0m', ...args)
+}
+
+new_console.warn = (...args) => {
+ orig_console.warn('\x1b[93m%s\x1b[0m', ...args)
+}
+
+new_console.error = (...args) => {
+ orig_console.error('\x1b[91m%s\x1b[0m', ...args)
+}
+
+module.exports = new_console;
diff --git a/src/modules/findgame.js b/src/modules/findgame.js
index 1c330df..505595f 100644
--- a/src/modules/findgame.js
+++ b/src/modules/findgame.js
@@ -6,6 +6,8 @@ const { app } = require("electron");
const util = require("util");
const exec = util.promisify(require("child_process").exec);
+console = require("./console");
+
module.exports = async () => {
let gamepath = "";
@@ -40,10 +42,10 @@ module.exports = async () => {
let data_array = Object.values(values[i]);
if (fs.existsSync(data_array[0] + "/steamapps/common/Titanfall2/Titanfall2.exe")) {
- console.log("Found game in:", data_array[0]);
+ console.ok("Found game in:", data_array[0]);
return data_array[0] + "/steamapps/common/Titanfall2";
} else {
- console.log("Game not in:", data_array[0]);
+ console.error("Game not in:", data_array[0]);
}
}
}
@@ -70,7 +72,7 @@ module.exports = async () => {
// searches VDF files
for (let i = 0; i < vdf_files.length; i++) {
if (! fs.existsSync(vdf_files[i])) {continue}
- console.log("Searching VDF file at:", vdf_files[i]);
+ console.info("Searching VDF file at:", vdf_files[i]);
let data = fs.readFileSync(vdf_files[i]);
let read_vdf = readvdf(data.toString());
diff --git a/src/modules/launch.js b/src/modules/launch.js
index 82de109..af9939b 100644
--- a/src/modules/launch.js
+++ b/src/modules/launch.js
@@ -6,6 +6,8 @@ const lang = require("../lang");
const win = require("./window");
const settings = require("./settings");
+console = require("./console");
+
// launches the game
//
// either Northstar or Vanilla. Linux support is not currently a thing,
@@ -25,11 +27,11 @@ function launch(game_version) {
// launch the requested game version
switch(game_version) {
case "vanilla":
- console.log(lang("general.launching"), "Vanilla...");
+ console.info(lang("general.launching"), "Vanilla...");
exec("Titanfall2.exe", {cwd: settings.gamepath});
break;
default:
- console.log(lang("general.launching"), "Northstar...");
+ console.info(lang("general.launching"), "Northstar...");
exec("NorthstarLauncher.exe", {cwd: settings.gamepath});
break;
}
diff --git a/src/modules/mods.js b/src/modules/mods.js
index 095e501..fc2a682 100644
--- a/src/modules/mods.js
+++ b/src/modules/mods.js
@@ -10,6 +10,8 @@ const win = require("./window");
const version = require("./version");
const settings = require("./settings");
+console = require("./console");
+
const cli = require("../cli");
const lang = require("../lang");
@@ -33,7 +35,7 @@ mods.list = () => {
// make sure Northstar is actually installed
if (version.northstar() == "unknown") {
win.log(lang("general.notinstalled"));
- console.log("error: " + lang("general.notinstalled"));
+ console.error("error: " + lang("general.notinstalled"));
cli.exit(1);
return false;
}
@@ -124,7 +126,7 @@ mods.get = (mod) => {
// make sure Northstar is actually installed
if (version.northstar() == "unknown") {
win.log(lang("general.notinstalled"));
- console.log("error: " + lang("general.notinstalled"));
+ console.error("error: " + lang("general.notinstalled"));
cli.exit(1);
return false;
}
@@ -258,20 +260,20 @@ mods.install = (mod, opts) => {
if (version.northstar() == "unknown") {
win.log(lang("general.notinstalled"));
- console.log("error: " + lang("general.notinstalled"));
+ console.error("error: " + lang("general.notinstalled"));
cli.exit(1);
return false;
}
let notamod = () => {
win.log(lang("gui.mods.notamod"));
- console.log("error: " + lang("cli.mods.notamod"));
+ console.error("error: " + lang("cli.mods.notamod"));
cli.exit(1);
return false;
}
let installed = () => {
- console.log(lang("cli.mods.installed"));
+ console.ok(lang("cli.mods.installed"));
cli.exit();
win.log(lang("gui.mods.installedmod"));
@@ -505,7 +507,7 @@ mods.remove = (mod) => {
// make sure Northstar is actually installed
if (version.northstar() == "unknown") {
win.log(lang("general.notinstalled"));
- console.log("error: " + lang("general.notinstalled"));
+ console.error("error: " + lang("general.notinstalled"));
cli.exit(1);
return false;
}
@@ -521,7 +523,7 @@ mods.remove = (mod) => {
let mod_name = mods.get(mod).FolderName;
if (! mod_name) {
- console.log("error: " + lang("cli.mods.cantfind"));
+ console.error("error: " + lang("cli.mods.cantfind"));
cli.exit(1);
return;
}
@@ -544,7 +546,7 @@ mods.remove = (mod) => {
// actually remove the mod itself
fs.rmSync(path_to_mod, {recursive: true});
- console.log(lang("cli.mods.removed"));
+ console.ok(lang("cli.mods.removed"));
cli.exit();
ipcMain.emit("gui-getmods"); // send updated list to renderer
@@ -569,7 +571,7 @@ mods.toggle = (mod, fork) => {
// make sure Northstar is actually installed
if (version.northstar() == "unknown") {
win.log(lang("general.notinstalled"));
- console.log("error: " + lang("general.notinstalled"));
+ console.error("error: " + lang("general.notinstalled"));
cli.exit(1);
return false;
}
@@ -581,7 +583,7 @@ mods.toggle = (mod, fork) => {
mods.toggle(modlist[i].Name, true); // enable mod
}
- console.log(lang("cli.mods.toggledall"));
+ console.ok(lang("cli.mods.toggledall"));
cli.exit(0);
return
}
@@ -590,7 +592,7 @@ mods.toggle = (mod, fork) => {
mods.modfile.toggle(mod);
if (! fork) {
- console.log(lang("cli.mods.toggled"));
+ console.ok(lang("cli.mods.toggled"));
cli.exit();
}
diff --git a/src/modules/settings.js b/src/modules/settings.js
index 76326cc..3b60d7f 100644
--- a/src/modules/settings.js
+++ b/src/modules/settings.js
@@ -5,6 +5,8 @@ const app = require("electron").app;
const json = require("./json");
const lang = require("../lang");
+console = require("./console");
+
var invalid_settings = false;
// base settings
@@ -47,7 +49,7 @@ if (fs.existsSync("viper.json")) {
settings.nsargs = fs.readFileSync(args, "utf8");
}
} else {
- console.log(lang("general.missingpath"));
+ console.error(lang("general.missingpath"));
}
// as to not have to do the same one liner a million times, this
diff --git a/src/modules/update.js b/src/modules/update.js
index e57faf6..02d38c6 100644
--- a/src/modules/update.js
+++ b/src/modules/update.js
@@ -12,6 +12,8 @@ const requests = require("./requests");
const gamepath = require("./gamepath");
const is_running = require("./is_running");
+console = require("./console");
+
const unzip = require("unzipper");
const { https } = require("follow-redirects");
@@ -57,23 +59,23 @@ update.northstar_autoupdate = () => {
async function _checkForUpdates() {
is_auto_updating = true;
- console.log(lang("cli.autoupdates.checking"));
+ console.info(lang("cli.autoupdates.checking"));
// checks if NS is outdated
if (await northstar_update_available()) {
- console.log(lang("cli.autoupdates.available"));
+ console.ok(lang("cli.autoupdates.available"));
if (await is_running.game()) {
- console.log(lang("general.autoupdates.gamerunning"));
+ console.error(lang("general.autoupdates.gamerunning"));
new Notification({
title: lang("gui.nsupdate.gaming.title"),
body: lang("gui.nsupdate.gaming.body")
}).show();
} else {
- console.log(lang("cli.autoupdates.updatingns"));
+ console.status(lang("cli.autoupdates.updatingns"));
update.northstar();
}
} else {
- console.log(lang("cli.autoupdates.noupdate"));
+ console.info(lang("cli.autoupdates.noupdate"));
}
setTimeout(
@@ -150,14 +152,14 @@ update.viper = (autoinstall) => {
// unzip module does not support excluding files directly.
update.northstar = async () => {
if (await is_running.game()) {
- console.log(lang("general.autoupdates.gamerunning"));
+ console.error(lang("general.autoupdates.gamerunning"));
return false;
}
if (! gamepath.exists()) {return}
ipcMain.emit("ns-update-event", "cli.update.checking");
- console.log(lang("cli.update.checking"));
+ console.info(lang("cli.update.checking"));
let ns_version = version.northstar();
const latest_version = await requests.getLatestNsVersion();
@@ -170,14 +172,14 @@ update.northstar = async () => {
// Makes sure it is not already the latest version
if (! await northstar_update_available()) {
ipcMain.emit("ns-update-event", "cli.update.uptodate.short");
- console.log(lang("cli.update.uptodate"), ns_version);
+ console.ok(lang("cli.update.uptodate"), ns_version);
win.log(lang("gui.update.uptodate"));
cli.exit();
return;
} else {
if (ns_version != "unknown") {
- console.log(lang("cli.update.current"), ns_version);
+ console.info(lang("cli.update.current"), ns_version);
};
}
@@ -188,11 +190,11 @@ update.northstar = async () => {
// cancel out if zip can't be retrieved and or found
if (res.statusCode !== 200) {
ipcMain.emit("ns-update-event", "cli.update.uptodate.short");
- console.log(lang("cli.update.uptodate"), ns_version);
+ console.ok(lang("cli.update.uptodate"), ns_version);
return false;
}
- console.log(lang("cli.update.downloading") + ":", latest_version);
+ console.info(lang("cli.update.downloading") + ":", latest_version);
ipcMain.emit("ns-update-event", "cli.update.downloading");
let tmp = path.dirname(settings.zip);
@@ -225,7 +227,7 @@ update.northstar = async () => {
win.log(lang("gui.update.extracting"));
ipcMain.emit("ns-update-event", "gui.update.extracting");
- console.log(lang("cli.update.downloaddone"));
+ console.ok(lang("cli.update.downloaddone"));
// extracts the zip, this is the part where we're actually
// installing Northstar.
extract.pipe(unzip.Extract({path: settings.gamepath}))
@@ -249,7 +251,7 @@ update.northstar = async () => {
ipcMain.emit("get-version");
ipcMain.emit("ns-update-event", "cli.update.uptodate.short");
win.log(lang("gui.update.finished"));
- console.log(lang("cli.update.finished"));
+ console.ok(lang("cli.update.finished"));
cli.exit();
})
})