Fix #4 Added version with app name.

This commit is contained in:
Quentin Decaunes 2019-03-01 15:38:59 +01:00
parent f2458d2466
commit f78bdd9eff
3 changed files with 15 additions and 9 deletions

View File

@ -9,7 +9,7 @@
<script src="./node_modules/uikit/dist/js/uikit-icons.min.js"></script> <script src="./node_modules/uikit/dist/js/uikit-icons.min.js"></script>
</head> </head>
<body class="uk-animation-fade"> <body class="uk-animation-fade">
<h1>Ryzen Controller</h1> <h1>Ryzen Controller <span id="version" class="uk-badge"></span></h1>
<ul uk-switcher uk-tab uk-sticky class="uk-background-default"> <ul uk-switcher uk-tab uk-sticky class="uk-background-default">
<li><a href="#">Controller</a></li> <li><a href="#">Controller</a></li>

View File

@ -4,6 +4,7 @@ ready(function(){
checkForAdminRights(); checkForAdminRights();
preFillSettings(); preFillSettings();
loadLatestUsedSettings(); loadLatestUsedSettings();
displayVersion();
}); });
/** /**

View File

@ -26,7 +26,7 @@ function decimalToHexString(number) {
{ {
number = 0xFFFFFFFF + number + 1; number = 0xFFFFFFFF + number + 1;
} }
return number.toString(16).toUpperCase(); return number.toString(16).toUpperCase();
} }
@ -44,7 +44,7 @@ function ready(fn) {
/** /**
* Will make sure inputs are repeated when needed. * Will make sure inputs are repeated when needed.
* *
* Use the "repeat" html attribute to define where the current value must be repeated. * Use the "repeat" html attribute to define where the current value must be repeated.
*/ */
function registerRepeaterForAllInput() { function registerRepeaterForAllInput() {
@ -62,11 +62,11 @@ function registerRepeaterForAllInput() {
/** /**
* Check that the app is running with admin right. * Check that the app is running with admin right.
* *
* Will display a warning if not. * Will display a warning if not.
*/ */
function checkForAdminRights() { function checkForAdminRights() {
var exec = require('child_process').exec; var exec = require('child_process').exec;
exec('NET SESSION', function(err,so,se) { exec('NET SESSION', function(err,so,se) {
if (se.length !== 0) { if (se.length !== 0) {
notification('warning', notification('warning',
@ -110,9 +110,9 @@ function getRyzenAdjExecutablePath() {
*/ */
function preFillSettings() { function preFillSettings() {
var ryzen_adj_path = document.getElementById('ryzen_adj_path'); var ryzen_adj_path = document.getElementById('ryzen_adj_path');
var fs = require('fs'); var fs = require('fs');
ryzen_adj_path.value = getRyzenAdjExecutablePath(); ryzen_adj_path.value = getRyzenAdjExecutablePath();
if (!fs.existsSync(ryzen_adj_path.value)) { if (!fs.existsSync(ryzen_adj_path.value)) {
notification('danger', "Path to ryzenadj.exe is wrong, please fix it in settings tab."); notification('danger', "Path to ryzenadj.exe is wrong, please fix it in settings tab.");
} }
const settings = require('electron-settings'); const settings = require('electron-settings');
@ -125,7 +125,7 @@ function preFillSettings() {
function askingForRyzenAdjExecutablePath() { function askingForRyzenAdjExecutablePath() {
var remote = require('electron').remote; var remote = require('electron').remote;
var dialog = remote.require('electron').dialog; var dialog = remote.require('electron').dialog;
var path = dialog.showOpenDialog({ var path = dialog.showOpenDialog({
properties: ['openFile'] properties: ['openFile']
}, function (filePaths) { }, function (filePaths) {
@ -173,7 +173,7 @@ function saveLatestUsedSettings() {
/** /**
* Will load the latest settings and refresh the controller tab's values. * Will load the latest settings and refresh the controller tab's values.
* *
* Will also apply latest settings if settings.apply_last_settings_on_launch is true. * Will also apply latest settings if settings.apply_last_settings_on_launch is true.
*/ */
function loadLatestUsedSettings() { function loadLatestUsedSettings() {
@ -205,3 +205,8 @@ function registerEventListenerForSettingsInput() {
}); });
}); });
} }
function displayVersion() {
const pjson = require('./package.json');
document.getElementById('version').innerHTML = `v${pjson.version}`;
}