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/utils.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/utils.js') 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