aboutsummaryrefslogtreecommitdiff
path: root/src/app/main.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2021-12-29 23:33:30 +0100
committer0neGal <mail@0negal.com>2021-12-29 23:33:30 +0100
commit9d4515fd408c38ad081c010e052b2960f5fe3dfe (patch)
treeffd6528723e7fb4e5e6f99027683794226f22a2d /src/app/main.js
parentdcbdadbe3568beca429b0df5caf96156ee43f474 (diff)
parent74cb566e5ea97f62121fbd7b2cc170b94d36f0bb (diff)
downloadViper-9d4515fd408c38ad081c010e052b2960f5fe3dfe.tar.gz
Viper-9d4515fd408c38ad081c010e052b2960f5fe3dfe.zip
Merge branch 'feat/version-indicator' of https://github.com/Alystrasz/viper into feat/icon
Diffstat (limited to 'src/app/main.js')
-rw-r--r--src/app/main.js27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/app/main.js b/src/app/main.js
index 17389b2..ab41af6 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -2,17 +2,25 @@ const fs = require("fs");
const path = require("path");
const { ipcRenderer } = require("electron");
+const lang = require("../lang");
+
var settings = {
gamepath: "",
- file: "viper.json",
zip: "/northstar.zip",
+ lang: navigator.language,
+ excludes: [
+ "ns_startup_args.txt",
+ "ns_startup_args_dedi.txt"
+ ]
}
-if (fs.existsSync(settings.file)) {
- settings = {...settings, ...JSON.parse(fs.readFileSync(settings.file, "utf8"))};
+ipcRenderer.send("setlang", settings.lang);
+
+if (fs.existsSync("viper.json")) {
+ settings = {...settings, ...JSON.parse(fs.readFileSync("viper.json", "utf8"))};
settings.zip = path.join(settings.gamepath + "/northstar.zip");
} else {
- alert("Game path is not set! Please select the path!");
+ alert(lang("gui.missinggamepath"));
setpath();
}
@@ -26,3 +34,14 @@ function launchVanilla() {ipcRenderer.send("launchVanilla")}
ipcRenderer.on("newpath", (event, newpath) => {
settings.gamepath = newpath;
})
+
+ipcRenderer.on('versionInfo', (_, payload) => {
+ document.getElementById('vpVersion').innerText = `Viper version: ${payload.vp}`;
+ document.getElementById('nsVersion').innerText = `Northstar version: ${payload.ns}`;
+});
+ipcRenderer.send('getVersionInfo');
+
+setlang();
+setInterval(() => {
+ ipcRenderer.send("setsize", document.querySelector(".lines").offsetHeight + 20);
+}, 150);