mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Web: Dashboard version comparison (#196)
* update version * update version * update * add update echeck
This commit is contained in:
@@ -345,10 +345,6 @@
|
||||
<h4 lang="en" data-lang-token="dashboard_label_intro">The dashboard give you a quick overview about the status of Hyperion and show you the latest news of the Hyperion Blog.</h4>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="alert alert-info alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<strong>Info!</strong> A newer version of Hyperion is available!
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
@@ -356,9 +352,24 @@
|
||||
<span lang="en" data-lang-token="dashboard_label_infobox_title">Information</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p lang="en" data-lang-token="dashboard_label_infobox_currenthyp">Your Hyperion version:</p>
|
||||
<p lang="en" data-lang-token="dashboard_label_infobox_latesthyp">Latest version:</p>
|
||||
<p lang="en" data-lang-token="dashboard_label_infobox_device">Device:</p>
|
||||
<table class="table borderless">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td lang="en" data-lang-token="dashboard_label_infobox_currenthyp">Your Hyperion version:</td>
|
||||
<td id="currentversion"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td lang="en" data-lang-token="dashboard_label_infobox_latesthyp">Latest version:</td>
|
||||
<td id="latestversion"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td lang="en" data-lang-token="dashboard_label_infobox_device">Device:</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<hr>
|
||||
<span id="versioninforesult"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -462,6 +473,47 @@
|
||||
//Change all Checkboxes to Switches
|
||||
$("[type='checkbox']").bootstrapSwitch();
|
||||
|
||||
// vesion check
|
||||
var currentVersion;
|
||||
var cleanCurrentVersion;
|
||||
var latestVersion;
|
||||
var cleanLatestVersion;
|
||||
|
||||
webSocket = new WebSocket('ws://'+document.location.hostname+':19444');
|
||||
var serverInfo;
|
||||
|
||||
webSocket.onerror = function(event) {
|
||||
alert(event.data);
|
||||
};
|
||||
|
||||
|
||||
webSocket.onopen = function(event) {
|
||||
webSocket.send('{"command":"serverinfo"}');
|
||||
};
|
||||
|
||||
webSocket.onmessage = function(response){
|
||||
responseJSON = JSON.parse(response.data );
|
||||
currentVersion = responseJSON.info.hyperion[0].version;
|
||||
cleanCurrentVersion = currentVersion.replace(/\./g, '');
|
||||
|
||||
$.get( "https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/version.json", function( data ) {
|
||||
var responseJSON = JSON.parse(data);
|
||||
latestVersion = responseJSON[0].versionnr;
|
||||
cleanLatestVersion = latestVersion.replace(/\./g, '');
|
||||
|
||||
$('#currentversion').append(' V'+currentVersion);
|
||||
$('#latestversion').append(' V'+latestVersion);
|
||||
|
||||
if ( cleanCurrentVersion < cleanLatestVersion ) {
|
||||
$('#versioninforesult').append('<div lang="en" data-lang-token="dashboard_message_infobox_updatewarning" style="margin:0px;" class="alert alert-warning">A newer version of Hyperion is available!</div>');
|
||||
}
|
||||
else{
|
||||
$('#versioninforesult').append('<div lang="en" data-lang-token="dashboard_message_infobox_updatesuccess" style="margin:0px;" class="alert alert-success">You run the latest version of Hyperion.</div>');
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
$(function(){
|
||||
var sidebar = $('#side-menu'); // cache sidebar to a variable for performance
|
||||
|
Reference in New Issue
Block a user