mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
New version function
This commit is contained in:
parent
2efbaa6175
commit
e9f8309b50
@ -127,4 +127,5 @@
|
||||
<script type="text/javascript">
|
||||
performTranslation();
|
||||
createHintH("intro", $.i18n('support_label_intro'), "supp_intro");
|
||||
removeOverlay();
|
||||
</script>
|
||||
|
@ -16,11 +16,13 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// performTranslation('trans_update');
|
||||
$(document).ready( function(error) {
|
||||
performTranslation();
|
||||
if(Array.isArray(window.gitHubVersionList) && window.gitHubVersionList.length)
|
||||
getReleases(function (callback){
|
||||
|
||||
if(callback)
|
||||
{
|
||||
for (key in window.gitHubVersionList)
|
||||
for (var key in window.gitHubVersionList)
|
||||
{
|
||||
|
||||
if(window.gitHubVersionList[key].name == null || (window.serverConfig.general.versionBranch == "Stable" && window.gitHubVersionList[key].prerelease == true))
|
||||
@ -36,5 +38,7 @@ else
|
||||
{
|
||||
$('#versionlist').append($.i18n('update_error_getting_versions'));
|
||||
}
|
||||
|
||||
});
|
||||
removeOverlay();
|
||||
});
|
||||
</script>
|
||||
|
@ -80,30 +80,7 @@ $(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;
|
||||
|
||||
for(var i in releases)
|
||||
{
|
||||
if(releases[i].prerelease == true)
|
||||
{
|
||||
window.latestBetaVersion = releases[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$.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;
|
||||
}
|
||||
|
||||
getReleases(function(){
|
||||
var cleanLatestVersion = window.latestVersion.tag_name.replace(/\./g, '');
|
||||
var cleanCurrentVersion = window.currentVersion.replace(/\./g, '');
|
||||
|
||||
@ -115,7 +92,8 @@ $(document).ready( function() {
|
||||
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;
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user