mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
New version function
This commit is contained in:
@@ -80,43 +80,21 @@ $(document).ready( function() {
|
||||
$('#dash_ports').html(window.serverConfig.flatbufServer.port+' | '+window.serverConfig.protoServer.port);
|
||||
$('#dash_versionbranch').html(window.serverConfig.general.versionBranch);
|
||||
|
||||
$.get( window.gitHubReleaseApiUrl, function( releases ) {
|
||||
window.gitHubVersionList = releases;
|
||||
getReleases(function(){
|
||||
var cleanLatestVersion = window.latestVersion.tag_name.replace(/\./g, '');
|
||||
var cleanCurrentVersion = window.currentVersion.replace(/\./g, '');
|
||||
|
||||
for(var i in releases)
|
||||
{
|
||||
if(releases[i].prerelease == true)
|
||||
{
|
||||
window.latestBetaVersion = releases[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$('#dash_latev').html(window.currentVersion);
|
||||
$('#dash_latev').html(window.latestVersion.tag_name + ' (' + (window.latestVersion.prerelease == true ? "Beta" : "Stable") + ')');
|
||||
|
||||
$.get( window.gitHubReleaseApiUrl + "/latest", function( latest ) {
|
||||
window.latestStableVersion = latest;
|
||||
|
||||
if(window.serverConfig.general.versionBranch == "Beta" && window.latestStableVersion.tag_name.replace(/\./g, '') <= window.latestBetaVersion.tag_name.replace(/\./g, ''))
|
||||
{
|
||||
window.latestVersion = window.latestBetaVersion;
|
||||
}
|
||||
else
|
||||
{
|
||||
window.latestVersion = window.latestStableVersion;
|
||||
}
|
||||
|
||||
var cleanLatestVersion = window.latestVersion.tag_name.replace(/\./g, '');
|
||||
var cleanCurrentVersion = window.currentVersion.replace(/\./g, '');
|
||||
|
||||
$('#dash_latev').html(window.currentVersion);
|
||||
$('#dash_latev').html(window.latestVersion.tag_name + ' (' + (window.latestVersion.prerelease == true ? "Beta" : "Stable") + ')');
|
||||
|
||||
if ( cleanCurrentVersion < cleanLatestVersion )
|
||||
$('#versioninforesult').html('<div class="bs-callout bs-callout-warning" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatewarning', window.latestVersion.tag_name) + ' (' + (window.latestVersion.prerelease == true ? "Beta" : "Stable") + ')</div>');
|
||||
else
|
||||
$('#versioninforesult').html('<div class="bs-callout bs-callout-success" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatesuccess')+'</div>');
|
||||
});
|
||||
if ( cleanCurrentVersion < cleanLatestVersion )
|
||||
$('#versioninforesult').html('<div class="bs-callout bs-callout-warning" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatewarning', window.latestVersion.tag_name) + ' (' + (window.latestVersion.prerelease == true ? "Beta" : "Stable") + ')</div>');
|
||||
else
|
||||
$('#versioninforesult').html('<div class="bs-callout bs-callout-success" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatesuccess')+'</div>');
|
||||
});
|
||||
|
||||
|
||||
|
||||
//determine platform
|
||||
var grabbers = window.serverInfo.grabbers.available;
|
||||
var html = "";
|
||||
|
@@ -198,7 +198,7 @@ function showInfoDialog(type,header,message)
|
||||
$('#id_body').append(message);
|
||||
$('#id_footer').html('<button type="button" class="btn btn-primary" data-dismiss="modal">'+$.i18n('general_btn_ok')+'</button>');
|
||||
}
|
||||
|
||||
|
||||
$('#id_body').append('<h4 style="font-weight:bold;text-transform:uppercase;">'+header+'</h4>');
|
||||
$('#id_body').append(message);
|
||||
|
||||
@@ -709,3 +709,51 @@ function encode_utf8(s)
|
||||
{
|
||||
return unescape(encodeURIComponent(s));
|
||||
}
|
||||
|
||||
function getReleases(callback)
|
||||
{
|
||||
$.ajax({
|
||||
url: window.gitHubReleaseApiUrl,
|
||||
method: 'get',
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
callback(false);
|
||||
},
|
||||
success: function(releases)
|
||||
{
|
||||
window.gitHubVersionList = releases;
|
||||
|
||||
for(var i in releases)
|
||||
{
|
||||
if(releases[i].prerelease == true)
|
||||
{
|
||||
window.latestBetaVersion = releases[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: window.gitHubReleaseApiUrl + "/latest",
|
||||
method: 'get',
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
callback(false);
|
||||
},
|
||||
success: function(latest)
|
||||
{
|
||||
window.latestStableVersion = latest;
|
||||
|
||||
if(window.serverConfig.general.versionBranch == "Beta" && window.latestStableVersion.tag_name.replace(/\./g, '') <= window.latestBetaVersion.tag_name.replace(/\./g, ''))
|
||||
{
|
||||
window.latestVersion = window.latestBetaVersion;
|
||||
}
|
||||
else
|
||||
{
|
||||
window.latestVersion = window.latestStableVersion;
|
||||
}
|
||||
callback(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user