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