mirror of
https://github.com/OpenFusionProject/Client.git
synced 2024-11-13 02:10:04 +00:00
Get version number from package.json on app start
This is easy to miss when prepping a new release so I figured we might as well automate it
This commit is contained in:
parent
5da0da1981
commit
d554b6b968
@ -54,7 +54,7 @@ body {
|
||||
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
}
|
||||
|
||||
#of-versionnumber {
|
||||
#of-versionnumberdiv {
|
||||
position: fixed;
|
||||
bottom: 4px;
|
||||
right: 8px;
|
||||
|
@ -25,6 +25,23 @@ function disableServerListButtons() {
|
||||
$("#of-deleteserver-button").prop("disabled", true);
|
||||
}
|
||||
|
||||
function getAppVersion() {
|
||||
appversion = remote.require("app").getVersion();
|
||||
|
||||
// simplify version, ex. 1.4.0 -> 1.4,
|
||||
// but only if a revision number isn't present
|
||||
if(appversion.endsWith(".0")){
|
||||
return appversion.substr(0, appversion.length - 2)
|
||||
} else {
|
||||
return appversion
|
||||
}
|
||||
}
|
||||
|
||||
function setAppVersionText() {
|
||||
$("#of-aboutversionnumber").text("Version " + getAppVersion());
|
||||
$("#of-versionnumber").text("v" + getAppVersion());
|
||||
}
|
||||
|
||||
function addServer() {
|
||||
var jsontomodify = JSON.parse(
|
||||
remotefs.readFileSync(userdir + "\\servers.json")
|
||||
|
@ -1,5 +1,5 @@
|
||||
const fs = require('fs');
|
||||
const dir = './dist/win-ia32-unpacked/resources/default_app'
|
||||
const defaultdir = './dist/win-ia32-unpacked/resources/default_app'
|
||||
const exefile = './dist/win-ia32-unpacked/OpenFusionClient.exe'
|
||||
|
||||
exports.default = function() {
|
||||
|
@ -151,7 +151,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="text-monospace">Version 1.4</p>
|
||||
<p id="of-aboutversionnumber" class="text-monospace">APP_VERSION_NUMBER</p>
|
||||
<p>
|
||||
©2020-2023 OpenFusion Contributors<br />OpenFusion
|
||||
is licensed under MIT.<br />
|
||||
@ -447,13 +447,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="of-versionnumber">
|
||||
<div id="of-versionnumberdiv">
|
||||
<a
|
||||
id="of-versionnumber"
|
||||
class="text-monospace text-secondary"
|
||||
href="#of-aboutmodal"
|
||||
data-toggle="modal"
|
||||
data-target="#of-aboutmodal"
|
||||
>v1.4</a
|
||||
>v0</a
|
||||
>
|
||||
</div>
|
||||
</section>
|
||||
|
1
index.js
1
index.js
@ -174,6 +174,7 @@ function showMainWindow() {
|
||||
|
||||
// Reduces white flash when opening the program
|
||||
mainWindow.webContents.on("did-finish-load", function () {
|
||||
mainWindow.webContents.executeJavaScript("setAppVersionText();");
|
||||
mainWindow.show();
|
||||
// everything's loaded, tell the renderer process to do its thing
|
||||
mainWindow.webContents.executeJavaScript("loadConfig();");
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "OpenFusionClient",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.1",
|
||||
"description": "OpenFusionClient",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
Loading…
Reference in New Issue
Block a user