From c1d794cd021eea2053a66b484f9f547c28da8911 Mon Sep 17 00:00:00 2001 From: birdhouse Date: Thu, 20 Jun 2019 19:27:22 +0200 Subject: [PATCH 01/12] WebUI: Update Check, Cleanup and Hyperion Switcher IPv6 Fix Update Check: - New Property which allows you to select stable or beta branch checks. - This would rely on current versions.json. It selects the first version in list with you branch (stable, beta). If it is newer hyperion tells you that a update is available - For this we should keep our deployment pipeline in mind to format the json this way. Cleanup: - I cleaned up the WebUI from dead links and the support page with the affiliate links and donation adresses as we don't have them under our control. Currently only disabled, not deleated Switcher: - If the address which is published via bonjour serve is IPv6 the Switcher was bugged. Fixed that. --- assets/webconfig/content/about.html | 16 ++-- assets/webconfig/content/conf_logging.html | 2 + assets/webconfig/content/dashboard.html | 10 ++- assets/webconfig/content/support.html | 88 +++++++++++----------- assets/webconfig/i18n/de.json | 5 +- assets/webconfig/i18n/en.json | 7 +- assets/webconfig/js/content_dashboard.js | 23 ++++-- assets/webconfig/js/settings.js | 50 ++++++------ config/hyperion.config.json.commented | 2 + config/hyperion.config.json.default | 1 + libsrc/hyperion/schema/schema-general.json | 15 +++- 11 files changed, 132 insertions(+), 87 deletions(-) diff --git a/assets/webconfig/content/about.html b/assets/webconfig/content/about.html index aaaf8a10..30fe9972 100644 --- a/assets/webconfig/content/about.html +++ b/assets/webconfig/content/about.html @@ -20,33 +20,33 @@ var libh = ""; var lang = []; var dcount = 0; - + for(var i = 0; i'+key+', '; libh += "
"+$.i18n("about_credits"); - + lang = lang.toString().replace(/,/g,", "); - + var fc = [''+$.i18n("about_version")+'',$.i18n("about_build"),$.i18n("about_builddate"),$.i18n("about_translations"),$.i18n("about_resources", $.i18n("general_webui_title"))]; - var sc = [currentVersion,si.build,si.time,'('+availLang.length+')

'+lang+'

'+$.i18n("about_contribute")+'

',libh]; + var sc = [currentVersion,si.build,si.time,'('+availLang.length+')

'+lang+'

'+$.i18n("about_contribute")+'

',libh]; createTable("","atb","about_cont"); for(var i = 0; i 2) $('#danger_act').toggle(true); }); - + $('#reset_cache').off().on('click',function(){ localStorage.clear(); }); - + $('#hyp_restart').off().on('click',function(){ initRestart(); }); - \ No newline at end of file + diff --git a/assets/webconfig/content/conf_logging.html b/assets/webconfig/content/conf_logging.html index e8fa472d..a9995b2f 100644 --- a/assets/webconfig/content/conf_logging.html +++ b/assets/webconfig/content/conf_logging.html @@ -7,11 +7,13 @@

+

Bericht

+
diff --git a/assets/webconfig/content/dashboard.html b/assets/webconfig/content/dashboard.html index 2014d403..ca873ab7 100644 --- a/assets/webconfig/content/dashboard.html +++ b/assets/webconfig/content/dashboard.html @@ -37,6 +37,10 @@ Hyperion version: unknown + + Version Branch: + unknown + Latest version: unknown @@ -71,7 +75,7 @@ -
+ '); + $('#versioninforesult').html('
'+$.i18n('dashboard_infobox_message_updatewarning', window.latestVersion.versionnr) + ' (' + window.latestVersion.channel + ')
'); else $('#versioninforesult').html('
'+$.i18n('dashboard_infobox_message_updatesuccess')+'
'); }); diff --git a/assets/webconfig/js/hyperion.js b/assets/webconfig/js/hyperion.js index 5c9a5f95..8f8a7b95 100644 --- a/assets/webconfig/js/hyperion.js +++ b/assets/webconfig/js/hyperion.js @@ -4,6 +4,8 @@ window.webOrigin = "Web Configuration"; window.showOptHelp = true; window.currentVersion = null; window.latestVersion = null; +window.latestStableVersion = null; +window.latestBetaVersion = null; window.serverInfo = {}; window.parsedUpdateJSON = {}; window.serverSchema = {}; From ab3f803060c264d98c5873067939d8e1e6e74d0d Mon Sep 17 00:00:00 2001 From: birdhouse Date: Thu, 20 Jun 2019 21:07:40 +0200 Subject: [PATCH 05/12] Delete console.log ... --- assets/webconfig/js/content_dashboard.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/assets/webconfig/js/content_dashboard.js b/assets/webconfig/js/content_dashboard.js index ee4bb32b..fc8d4be1 100644 --- a/assets/webconfig/js/content_dashboard.js +++ b/assets/webconfig/js/content_dashboard.js @@ -97,9 +97,6 @@ $(document).ready( function() { } } - console.log("Stable"+ window.latestStableVersion.versionnr.replace(/\./g, '')) - console.log("Beta"+ window.latestBetaVersion.versionnr.replace(/\./g, '')) - if(window.serverConfig.general.versionBranch == "Beta" && window.latestStableVersion.versionnr.replace(/\./g, '') <= window.latestBetaVersion.versionnr.replace(/\./g, '')) { window.latestVersion = window.latestBetaVersion; } @@ -107,8 +104,6 @@ $(document).ready( function() { window.latestVersion = window.latestStableVersion; } - console.log(latestVersion) - var cleanLatestVersion = window.latestVersion.versionnr.replace(/\./g, ''); var cleanCurrentVersion = window.currentVersion.replace(/\./g, ''); From e37abbb62dd004e911d67d59a272d25a0f477bbe Mon Sep 17 00:00:00 2001 From: birdhouse Date: Sat, 22 Jun 2019 21:30:17 +0200 Subject: [PATCH 06/12] Version determination now with github api --- assets/webconfig/content/update.html | 20 ++++++-- assets/webconfig/i18n/de.json | 1 + assets/webconfig/i18n/en.json | 1 + assets/webconfig/index.html | 5 +- assets/webconfig/js/content_dashboard.js | 65 +++++++++++++++--------- assets/webconfig/js/hyperion.js | 3 +- 6 files changed, 63 insertions(+), 32 deletions(-) diff --git a/assets/webconfig/content/update.html b/assets/webconfig/content/update.html index 08aec6cb..282dea24 100644 --- a/assets/webconfig/content/update.html +++ b/assets/webconfig/content/update.html @@ -4,6 +4,7 @@

Overview about all available Hyperion versions. On top you could update or downgrade your version of Hyperion whenever you want. Sorted from newest to oldest

+

At the moment the install buttons are not working. Development is still ongoing here.


@@ -17,10 +18,23 @@ diff --git a/assets/webconfig/i18n/de.json b/assets/webconfig/i18n/de.json index 41fbfabb..4df08d03 100644 --- a/assets/webconfig/i18n/de.json +++ b/assets/webconfig/i18n/de.json @@ -256,6 +256,7 @@ "update_button_changelog" : "Zeige Änderungsprotokoll", "update_label_type" : "Art:", "update_versreminder" : "Deine Version: $1", + "update_error_getting_versions" : "Wir hatten Probleme die verfügbaren Versionen zu ermitteln.", "about_version" : "Version", "about_build" : "Build", "about_builddate" : "Build Datum", diff --git a/assets/webconfig/i18n/en.json b/assets/webconfig/i18n/en.json index bd118cf1..9bc35d80 100644 --- a/assets/webconfig/i18n/en.json +++ b/assets/webconfig/i18n/en.json @@ -256,6 +256,7 @@ "update_button_changelog" : "Full changelog", "update_label_type" : "Type:", "update_versreminder" : "Your version: $1", + "update_error_getting_versions" : "We had trouble to determinate the available Versions.", "about_version" : "Version", "about_build" : "Build", "about_builddate" : "Build date", diff --git a/assets/webconfig/index.html b/assets/webconfig/index.html index 55e97eb3..6b5b54f6 100644 --- a/assets/webconfig/index.html +++ b/assets/webconfig/index.html @@ -179,11 +179,8 @@ diff --git a/assets/webconfig/js/content_dashboard.js b/assets/webconfig/js/content_dashboard.js index fc8d4be1..8a3d313c 100644 --- a/assets/webconfig/js/content_dashboard.js +++ b/assets/webconfig/js/content_dashboard.js @@ -80,40 +80,57 @@ $(document).ready( function() { $('#dash_ports').html(window.serverConfig.flatbufServer.port+' | '+window.serverConfig.protoServer.port); $('#dash_versionbranch').html(window.serverConfig.general.versionBranch); - $.get( "https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/version.json", function( data ) { - window.parsedUpdateJSON = JSON.parse(data); + $.get( window.gitHubReleaseApiUrl, function( releases ) { + window.gitHubVersionList = releases; - for(let i=0; i -1) + //{ + window.latestBetaVersion = releases[i]; + //break; + //} + //} break; } } - for(let i=0; i'+$.i18n('dashboard_infobox_message_updatewarning', window.latestVersion.versionnr) + ' (' + window.latestVersion.channel + ')
'); - else - $('#versioninforesult').html('
'+$.i18n('dashboard_infobox_message_updatesuccess')+'
'); + if ( cleanCurrentVersion < cleanLatestVersion ) + $('#versioninforesult').html('
'+$.i18n('dashboard_infobox_message_updatewarning', window.latestVersion.tag_name) + ' (' + (window.latestVersion.prerelease == true ? "Beta" : "Stable") + ')
'); + else + $('#versioninforesult').html('
'+$.i18n('dashboard_infobox_message_updatesuccess')+'
'); + }); }); //determine platform diff --git a/assets/webconfig/js/hyperion.js b/assets/webconfig/js/hyperion.js index 8f8a7b95..e56867c4 100644 --- a/assets/webconfig/js/hyperion.js +++ b/assets/webconfig/js/hyperion.js @@ -2,12 +2,13 @@ window.webPrio = 1; window.webOrigin = "Web Configuration"; window.showOptHelp = true; +window.gitHubReleaseApiUrl = "https://api.github.com/repos/b1rdhous3/hyperion.ng/releases"; window.currentVersion = null; window.latestVersion = null; window.latestStableVersion = null; window.latestBetaVersion = null; +window.gitHubVersionList = null; window.serverInfo = {}; -window.parsedUpdateJSON = {}; window.serverSchema = {}; window.serverConfig = {}; window.schema = {}; From 9d9999b861c8604e3e8c7cbe2b3b44689b5cd4df Mon Sep 17 00:00:00 2001 From: birdhouse Date: Sun, 23 Jun 2019 00:38:06 +0200 Subject: [PATCH 07/12] Final points. Ready to merge --- assets/webconfig/content/update.html | 2 +- assets/webconfig/js/content_dashboard.js | 26 +++++------------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/assets/webconfig/content/update.html b/assets/webconfig/content/update.html index 282dea24..9ed48fc9 100644 --- a/assets/webconfig/content/update.html +++ b/assets/webconfig/content/update.html @@ -18,7 +18,7 @@ diff --git a/assets/webconfig/content/update.html b/assets/webconfig/content/update.html index 9ed48fc9..80e9cd46 100644 --- a/assets/webconfig/content/update.html +++ b/assets/webconfig/content/update.html @@ -16,25 +16,29 @@ diff --git a/assets/webconfig/js/content_dashboard.js b/assets/webconfig/js/content_dashboard.js index c94eef9b..19813502 100644 --- a/assets/webconfig/js/content_dashboard.js +++ b/assets/webconfig/js/content_dashboard.js @@ -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('
'+$.i18n('dashboard_infobox_message_updatewarning', window.latestVersion.tag_name) + ' (' + (window.latestVersion.prerelease == true ? "Beta" : "Stable") + ')
'); - else - $('#versioninforesult').html('
'+$.i18n('dashboard_infobox_message_updatesuccess')+'
'); - }); + if ( cleanCurrentVersion < cleanLatestVersion ) + $('#versioninforesult').html('
'+$.i18n('dashboard_infobox_message_updatewarning', window.latestVersion.tag_name) + ' (' + (window.latestVersion.prerelease == true ? "Beta" : "Stable") + ')
'); + else + $('#versioninforesult').html('
'+$.i18n('dashboard_infobox_message_updatesuccess')+'
'); }); + + //determine platform var grabbers = window.serverInfo.grabbers.available; var html = ""; diff --git a/assets/webconfig/js/ui_utils.js b/assets/webconfig/js/ui_utils.js index b7f43d53..70340828 100644 --- a/assets/webconfig/js/ui_utils.js +++ b/assets/webconfig/js/ui_utils.js @@ -198,7 +198,7 @@ function showInfoDialog(type,header,message) $('#id_body').append(message); $('#id_footer').html(''); } - + $('#id_body').append('

'+header+'

'); $('#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); + } + }); + } + }) +} From f53dfe7e8759d54c8d9eb48933ea2d8ee84f8e5e Mon Sep 17 00:00:00 2001 From: birdhouse Date: Wed, 26 Jun 2019 19:04:03 +0200 Subject: [PATCH 12/12] "If" fehlte (FIX) fix --- assets/webconfig/js/content_dashboard.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/assets/webconfig/js/content_dashboard.js b/assets/webconfig/js/content_dashboard.js index 19813502..cafb3bdd 100644 --- a/assets/webconfig/js/content_dashboard.js +++ b/assets/webconfig/js/content_dashboard.js @@ -80,17 +80,20 @@ $(document).ready( function() { $('#dash_ports').html(window.serverConfig.flatbufServer.port+' | '+window.serverConfig.protoServer.port); $('#dash_versionbranch').html(window.serverConfig.general.versionBranch); - getReleases(function(){ - var cleanLatestVersion = window.latestVersion.tag_name.replace(/\./g, ''); - var cleanCurrentVersion = window.currentVersion.replace(/\./g, ''); + getReleases(function(callback){ + if(callback) + { + 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") + ')'); + $('#dash_latev').html(window.currentVersion); + $('#dash_latev').html(window.latestVersion.tag_name + ' (' + (window.latestVersion.prerelease == true ? "Beta" : "Stable") + ')'); - if ( cleanCurrentVersion < cleanLatestVersion ) - $('#versioninforesult').html('
'+$.i18n('dashboard_infobox_message_updatewarning', window.latestVersion.tag_name) + ' (' + (window.latestVersion.prerelease == true ? "Beta" : "Stable") + ')
'); - else - $('#versioninforesult').html('
'+$.i18n('dashboard_infobox_message_updatesuccess')+'
'); + if ( cleanCurrentVersion < cleanLatestVersion ) + $('#versioninforesult').html('
'+$.i18n('dashboard_infobox_message_updatewarning', window.latestVersion.tag_name) + ' (' + (window.latestVersion.prerelease == true ? "Beta" : "Stable") + ')
'); + else + $('#versioninforesult').html('
'+$.i18n('dashboard_infobox_message_updatesuccess')+'
'); + } });