diff options
-rw-r--r-- | src/app/index.html | 8 | ||||
-rw-r--r-- | src/app/main.css | 6 | ||||
-rw-r--r-- | src/app/main.js | 8 | ||||
-rw-r--r-- | src/index.js | 13 | ||||
-rw-r--r-- | src/utils.js | 1 |
5 files changed, 31 insertions, 5 deletions
diff --git a/src/app/index.html b/src/app/index.html index 426b4c5..4c31255 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -6,7 +6,13 @@ <body> <div class="lines"> <div class="line"> - <div class="text">%%gui.welcome%%</div> + <div class="text"> + <div style="white-space: nowrap;">%%gui.welcome%%</div> + <div class="versions"> + <div id="vpVersion"></div> + <div id="nsVersion"></div> + </div> + </div> <div class="buttons"> <button id="exit" onclick="exit()">%%gui.exit%%</button> <button id="update" onclick="update()">%%gui.update%%</button> diff --git a/src/app/main.css b/src/app/main.css index f49cc98..c86e08d 100644 --- a/src/app/main.css +++ b/src/app/main.css @@ -68,3 +68,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/app/main.js b/src/app/main.js index 9bafaa5..765b143 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -35,7 +35,13 @@ 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.send("getversion"); + setlang(); setInterval(() => { ipcRenderer.send("setsize", document.querySelector(".lines").offsetHeight + 20); -}, 150) +}, 150); diff --git a/src/index.js b/src/index.js index 8343ba9..51449af 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(); @@ -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, @@ -44,7 +44,14 @@ 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("getversion", () => { + win.webContents.send("version", { + ns: utils.getInstalledVersion(), + vp: "v" + require("../package.json").version + }); +}); process.chdir(app.getPath("appData")); 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 } |