From b430d92573619ffce82362cc2a682addc6c958ab Mon Sep 17 00:00:00 2001 From: Alystrasz Date: Wed, 29 Dec 2021 12:10:40 +0100 Subject: [feat] adding version indicators on the UI --- src/app/index.html | 8 +++++++- src/app/main.css | 6 ++++++ src/index.js | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/app/index.html b/src/app/index.html index 1c34360..a73422f 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -6,7 +6,13 @@
-
%%gui.welcome%%
+
+
%%gui.welcome%%
+
+
Viper version: x.x.x
+
Northstar version: x.x.x
+
+
diff --git a/src/app/main.css b/src/app/main.css index 854c47a..f3cd7c5 100644 --- a/src/app/main.css +++ b/src/app/main.css @@ -61,3 +61,9 @@ button:active { #setpath {background: #5E81AC} #northstar {background: #C7777F} #vanilla, #exit {background: #656E7F} + +.versions { + height: 15px; + font-size: 12px; + color: #afafaf; +} \ No newline at end of file diff --git a/src/index.js b/src/index.js index fead15b..3520914 100644 --- a/src/index.js +++ b/src/index.js @@ -11,7 +11,7 @@ const cli = require("./cli"); function start() { win = new BrowserWindow({ width: 600, - height: 115, + height: 130, show: false, title: "Viper", resizable: false, -- cgit v1.2.3 From e2d7efc2f00eae07dd5228f9c963533358edd56d Mon Sep 17 00:00:00 2001 From: Alystrasz Date: Thu, 30 Dec 2021 00:03:04 +0100 Subject: [feat] exporting utils.getInstalledVersion method --- src/utils.js | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/utils.js b/src/utils.js index 7e9dbac..b5767da 100644 --- a/src/utils.js +++ b/src/utils.js @@ -146,4 +146,5 @@ module.exports = { settings.lang = lang; saveSettings(); }, + getInstalledVersion } -- cgit v1.2.3 From d402e6236b6d0523a1dfce0c9203f1cbeb907e4f Mon Sep 17 00:00:00 2001 From: Alystrasz Date: Thu, 30 Dec 2021 00:03:53 +0100 Subject: [feat] adding div ids to version indicators --- src/app/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/app/index.html b/src/app/index.html index a73422f..c486f28 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -9,8 +9,8 @@
%%gui.welcome%%
-
Viper version: x.x.x
-
Northstar version: x.x.x
+
Viper version: x.x.x
+
Northstar version: x.x.x
-- cgit v1.2.3 From 93482ac6169a62854e360fde92abf7640389361b Mon Sep 17 00:00:00 2001 From: Alystrasz Date: Thu, 30 Dec 2021 00:04:55 +0100 Subject: [feat] displaying installed northstar version --- src/app/main.js | 5 +++++ src/index.js | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/app/main.js b/src/app/main.js index 579f785..684cb5a 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -34,3 +34,8 @@ function launchVanilla() {ipcRenderer.send("launchVanilla")} ipcRenderer.on("newpath", (event, newpath) => { settings.gamepath = newpath; }) + +ipcRenderer.on('versionInfo', (_, payload) => { + document.getElementById('nsVersion').innerText = `Northstar version: ${payload.ns}` +}); +ipcRenderer.send('getVersionInfo'); diff --git a/src/index.js b/src/index.js index 3520914..c20e8e0 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ const fs = require("fs"); const path = require("path"); -const { app, dialog, ipcMain, BrowserWindow } = require("electron"); +const { app, dialog, ipcMain, BrowserWindow, ipcRenderer } = require("electron"); const Emitter = require("events"); const events = new Emitter(); @@ -37,7 +37,13 @@ ipcMain.on("setlang", (event, lang) => {utils.setlang(lang)}) ipcMain.on("launchVanilla", (event) => {utils.launch("vanilla")}) ipcMain.on("update", (event) => {utils.update()}) -ipcMain.on("setpathcli", (event) => {utils.setpath()}) +ipcMain.on("setpathcli", (event) => {utils.setpath()}); + +ipcMain.on('getVersionInfo', () => { + win.webContents.send('versionInfo', { + ns: utils.getInstalledVersion() + }); +}); process.chdir(app.getPath("appData")); -- cgit v1.2.3 From 9df37da13c5eeba92ceeed7a5e9ffbaed976a615 Mon Sep 17 00:00:00 2001 From: Alystrasz Date: Thu, 30 Dec 2021 00:12:05 +0100 Subject: [feat] displaying viper version --- src/app/main.js | 3 ++- src/index.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/app/main.js b/src/app/main.js index 684cb5a..a059671 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -36,6 +36,7 @@ ipcRenderer.on("newpath", (event, newpath) => { }) ipcRenderer.on('versionInfo', (_, payload) => { - document.getElementById('nsVersion').innerText = `Northstar version: ${payload.ns}` + document.getElementById('vpVersion').innerText = `Viper version: ${payload.vp}`; + document.getElementById('nsVersion').innerText = `Northstar version: ${payload.ns}`; }); ipcRenderer.send('getVersionInfo'); diff --git a/src/index.js b/src/index.js index c20e8e0..56b0df4 100644 --- a/src/index.js +++ b/src/index.js @@ -41,7 +41,8 @@ ipcMain.on("setpathcli", (event) => {utils.setpath()}); ipcMain.on('getVersionInfo', () => { win.webContents.send('versionInfo', { - ns: utils.getInstalledVersion() + ns: utils.getInstalledVersion(), + vp: 'v' + require('../package.json').version }); }); -- cgit v1.2.3 From 74cb566e5ea97f62121fbd7b2cc170b94d36f0bb Mon Sep 17 00:00:00 2001 From: Alystrasz Date: Thu, 30 Dec 2021 00:24:57 +0100 Subject: [fix] displaying welcome message on one line --- src/app/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/app/index.html b/src/app/index.html index 3eadd96..6e31f0c 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -7,7 +7,7 @@
-
%%gui.welcome%%
+
%%gui.welcome%%
Viper version: x.x.x
Northstar version: x.x.x
-- cgit v1.2.3 From e199d2b6bbe48d51704156607c9e91d82ed2747f Mon Sep 17 00:00:00 2001 From: 0neGal Date: Wed, 29 Dec 2021 23:47:49 +0100 Subject: replaced single quotes, renamed a few things Simply code style changes, also removed the content of the version divs since they'll be replaced anyway. --- src/app/index.html | 4 ++-- src/app/main.js | 8 ++++---- src/index.js | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/app/index.html b/src/app/index.html index 6e31f0c..4c31255 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -9,8 +9,8 @@
%%gui.welcome%%
-
Viper version: x.x.x
-
Northstar version: x.x.x
+
+
diff --git a/src/app/main.js b/src/app/main.js index ab41af6..765b143 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -35,11 +35,11 @@ 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.on("version", (_, payload) => { + document.getElementById("vpVersion").innerText = "Viper version:" + payload.vp; + document.getElementById("nsVersion").innerText = "Northstar version: " + payload.ns; }); -ipcRenderer.send('getVersionInfo'); +ipcRenderer.send("getversion"); setlang(); setInterval(() => { diff --git a/src/index.js b/src/index.js index b41971d..51449af 100644 --- a/src/index.js +++ b/src/index.js @@ -17,7 +17,7 @@ function start() { title: "Viper", resizable: false, titleBarStyle: "hidden", - icon: path.join(__dirname, 'assets/icons/512x512.png'), + icon: path.join(__dirname, "assets/icons/512x512.png"), webPreferences: { nodeIntegration: true, contextIsolation: false, @@ -46,10 +46,10 @@ ipcMain.on("launchVanilla", (event) => {utils.launch("vanilla")}) ipcMain.on("update", (event) => {utils.update()}) ipcMain.on("setpathcli", (event) => {utils.setpath()}); -ipcMain.on('getVersionInfo', () => { - win.webContents.send('versionInfo', { +ipcMain.on("getversion", () => { + win.webContents.send("version", { ns: utils.getInstalledVersion(), - vp: 'v' + require('../package.json').version + vp: "v" + require("../package.json").version }); }); -- cgit v1.2.3 From 40bba8b31cfbef319553920d9fa678ffc1a99597 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Thu, 30 Dec 2021 03:43:37 +0100 Subject: version now refreshes, fixed and renamed stuff The version now refreshes when you update/install Northstar, I renamed vpVersion/nsVersion to just vpversion/nsversion and getInstalledVersion() to getNSVersion(), removed uses of getElementById() with just the ID. I also added English localization. The versions text color is now bound by a CSS variable (we may use it in the future again). I'm also not sure what the point of `style="white-space: nowrap;"` was, as I don't see much of a difference? Rather instead use `` in the lang file if needed. Besides that I did tiny code cleanup. --- src/app/index.html | 6 +++--- src/app/main.css | 5 +++-- src/app/main.js | 6 +++--- src/index.js | 2 +- src/lang/en.json | 2 ++ src/utils.js | 11 +++++------ 6 files changed, 17 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/app/index.html b/src/app/index.html index 4c31255..80f7701 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -7,10 +7,10 @@
-
%%gui.welcome%%
+
%%gui.welcome%%
-
-
+
+
diff --git a/src/app/main.css b/src/app/main.css index c86e08d..cd6c001 100644 --- a/src/app/main.css +++ b/src/app/main.css @@ -1,6 +1,7 @@ :root { --background: #4C515B; --foreground: #DDE2EB; + --subforeground: #AFAFAF; --btnforeground: var(--foreground); } @@ -72,5 +73,5 @@ button:active { .versions { height: 15px; font-size: 12px; - color: #afafaf; -} \ No newline at end of file + color: var(--subforeground); +} diff --git a/src/app/main.js b/src/app/main.js index 765b143..59b28f2 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -35,9 +35,9 @@ ipcRenderer.on("newpath", (event, newpath) => { settings.gamepath = newpath; }) -ipcRenderer.on("version", (_, payload) => { - document.getElementById("vpVersion").innerText = "Viper version:" + payload.vp; - document.getElementById("nsVersion").innerText = "Northstar version: " + payload.ns; +ipcRenderer.on("version", (event, versions) => { + vpversion.innerText = lang("gui.versions.viper") + ": " + versions.vp; + nsversion.innerText = lang("gui.versions.northstar") + ": " + versions.ns; }); ipcRenderer.send("getversion"); diff --git a/src/index.js b/src/index.js index 51449af..660d3a0 100644 --- a/src/index.js +++ b/src/index.js @@ -48,7 +48,7 @@ ipcMain.on("setpathcli", (event) => {utils.setpath()}); ipcMain.on("getversion", () => { win.webContents.send("version", { - ns: utils.getInstalledVersion(), + ns: utils.getNSVersion(), vp: "v" + require("../package.json").version }); }); diff --git a/src/lang/en.json b/src/lang/en.json index e88079e..a89f848 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -17,6 +17,8 @@ "cli.launch.linuxerror": "Launching the game is not currently supported on Linux", "gui.welcome": "Welcome to Viper!", + "gui.versions.viper": "Viper version", + "gui.versions.northstar": "Northstar version", "gui.exit": "Exit", "gui.update": "Update", "gui.setpath": "Game Path", diff --git a/src/utils.js b/src/utils.js index b5767da..277c729 100644 --- a/src/utils.js +++ b/src/utils.js @@ -52,8 +52,8 @@ function saveSettings() { fs.writeFileSync(app.getPath("appData") + "/viper.json", JSON.stringify(settings)); } -function getInstalledVersion() { - const versionFilePath = path.join(settings.gamepath, "ns_version.txt"); +function getNSVersion() { + var versionFilePath = path.join(settings.gamepath, "ns_version.txt"); if (fs.existsSync(versionFilePath)) { return fs.readFileSync(versionFilePath, "utf8"); @@ -72,7 +72,7 @@ function update() { } console.log(lang("cli.update.checking")); - const version = getInstalledVersion(); + var version = getNSVersion(); request({ json: true, @@ -101,8 +101,7 @@ function update() { console.log(lang("cli.update.finished")); fs.writeFileSync(path.join(settings.gamepath, "ns_version.txt"), tag); - - events.emit("updated"); + ipcMain.emit("getversion"); for (let i = 0; i < settings.excludes.length; i++) { let exclude = path.join(settings.gamepath + "/" + settings.excludes[i]); @@ -142,9 +141,9 @@ module.exports = { update, setpath, settings, + getNSVersion, setlang: (lang) => { settings.lang = lang; saveSettings(); }, - getInstalledVersion } -- cgit v1.2.3 From 4a0ce8d918007a3ed39bd15c28fc1c7931080271 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Thu, 30 Dec 2021 03:55:32 +0100 Subject: added northstar version to --version --- src/cli.js | 7 +------ src/index.js | 8 ++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/cli.js b/src/cli.js index 6696d36..f7d2141 100644 --- a/src/cli.js +++ b/src/cli.js @@ -39,12 +39,7 @@ async function init() { } if (cli.hasSwitch("update")) {ipcMain.emit("update")} - if (cli.hasSwitch("version")) { - console.log("Viper: v" + require("../package.json").version); - console.log("Node: " + process.version); - console.log("Electron: v" + process.versions.electron); - exit(); - } + if (cli.hasSwitch("version")) {ipcMain.emit("versioncli")} if (cli.hasSwitch("setpath")) { if (cli.getSwitchValue("setpath") != "") { diff --git a/src/index.js b/src/index.js index 660d3a0..063e4df 100644 --- a/src/index.js +++ b/src/index.js @@ -53,6 +53,14 @@ ipcMain.on("getversion", () => { }); }); +ipcMain.on("versioncli", () => { + console.log("Viper: v" + require("../package.json").version); + console.log("Northstar: " + utils.getNSVersion()); + console.log("Node: " + process.version); + console.log("Electron: v" + process.versions.electron); + cli.exit(); +}) + process.chdir(app.getPath("appData")); if (cli.hasArgs()) { -- cgit v1.2.3 From addc349189f582a1d8a833ba554f7b8df9205dd4 Mon Sep 17 00:00:00 2001 From: Alystrasz Date: Fri, 31 Dec 2021 13:25:18 +0100 Subject: [fix] adding missing french translations --- src/lang/fr.json | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/lang/fr.json b/src/lang/fr.json index c3e7027..26648c4 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -1,6 +1,7 @@ { "cli.help.help": "affiche ce message d'aide", "cli.help.debug": "affiche les outils de développement", + "cli.help.version": "retourne des informations sur la version du logiciel", "cli.help.cli": "force l'activation de la CLI", "cli.help.update": "met à jour Northstar sur le chemin du jeu précisé", "cli.help.setpath": "enregistre le chemin du client de jeu", @@ -17,10 +18,17 @@ "cli.launch.linuxerror": "Le support du jeu sur Linux n'est pas encore implémenté.", "gui.welcome": "Bienvenue sur Viper !", + "gui.versions.viper": "Version de Viper", + "gui.versions.northstar": "Version de Northstar", "gui.exit": "Fermer", "gui.update": "Mise à jour", "gui.setpath": "Chemin du jeu", + "gui.update.downloading": "Téléchargement de la mise à jour...", + "gui.update.extracting": "Extraction des fichiers...", + "gui.update.finished": "Terminé, vous pouvez jouer !", + "gui.update.uptodate": "Déjà à jour !", + "gui.launch": "Jouer", "gui.launchvanilla": "Vanilla", "gui.launchnorthstar": "Northstar", -- cgit v1.2.3 From 10c786da5be323c0b2e7042e79bcee8849e25ef4 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Fri, 31 Dec 2021 15:39:10 +0100 Subject: fixed padding on welcome text and added 's --- src/app/main.css | 4 +++- src/lang/fr.json | 41 ----------------------------------------- 2 files changed, 3 insertions(+), 42 deletions(-) delete mode 100644 src/lang/fr.json (limited to 'src') diff --git a/src/app/main.css b/src/app/main.css index dfa5633..c2ca627 100644 --- a/src/app/main.css +++ b/src/app/main.css @@ -62,6 +62,8 @@ button, .text { transition: 0.2s ease-in-out; } +#welcome {padding: 0px} + button { margin-bottom: 10px; color: var(--btnforeground); @@ -79,4 +81,4 @@ button:active { #setpath {background: #5E81AC} #northstar {background: #C7777F} #vanilla, #exit {background: #656E7F} -button:disabled {background: var(--disabled) !important; opacity: 0.5} \ No newline at end of file +button:disabled {background: var(--disabled) !important; opacity: 0.5} diff --git a/src/lang/fr.json b/src/lang/fr.json deleted file mode 100644 index 26648c4..0000000 --- a/src/lang/fr.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "cli.help.help": "affiche ce message d'aide", - "cli.help.debug": "affiche les outils de développement", - "cli.help.version": "retourne des informations sur la version du logiciel", - "cli.help.cli": "force l'activation de la CLI", - "cli.help.update": "met à jour Northstar sur le chemin du jeu précisé", - "cli.help.setpath": "enregistre le chemin du client de jeu", - - "cli.setpath.noarg": "Aucun argument donné à --setpath", - - "cli.update.current": "Version actuelle :", - "cli.update.downloading": "Téléchargement en cours ", - "cli.update.checking": "Vérification des mises à jour ...", - "cli.update.downloaddone": "Téléchargement terminé ! Extraction des fichiers...", - "cli.update.finished": "Mise à jour terminée !", - "cli.update.uptodate": "La dernière version (%s) est déjà installée.", - - "cli.launch.linuxerror": "Le support du jeu sur Linux n'est pas encore implémenté.", - - "gui.welcome": "Bienvenue sur Viper !", - "gui.versions.viper": "Version de Viper", - "gui.versions.northstar": "Version de Northstar", - "gui.exit": "Fermer", - "gui.update": "Mise à jour", - "gui.setpath": "Chemin du jeu", - - "gui.update.downloading": "Téléchargement de la mise à jour...", - "gui.update.extracting": "Extraction des fichiers...", - "gui.update.finished": "Terminé, vous pouvez jouer !", - "gui.update.uptodate": "Déjà à jour !", - - "gui.launch": "Jouer", - "gui.launchvanilla": "Vanilla", - "gui.launchnorthstar": "Northstar", - - "gui.selectpath": "Veuillez sélectionner le dossier où se trouve le client Titanfall 2.", - - - "general.launching": "Lancement", - "general.missingpath": "Le chemin du client n'est pas défini !" -} -- cgit v1.2.3