From e39d00956bdb69c39e6236735a1ddb1ca6d8976d Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 6 Nov 2019 23:47:23 +0100 Subject: [PATCH] Use the new diagnosis system to display the version number --- src/js/yunohost/controllers/diagnosis.js | 1 - src/js/yunohost/events.js | 11 ++++------- src/js/yunohost/main.js | 7 ++++--- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/js/yunohost/controllers/diagnosis.js b/src/js/yunohost/controllers/diagnosis.js index 807e2cb9..6fb48f7b 100644 --- a/src/js/yunohost/controllers/diagnosis.js +++ b/src/js/yunohost/controllers/diagnosis.js @@ -54,7 +54,6 @@ // We want filter_args to be something like "dnsrecords,domain=yolo.test,category=xmpp" data.reports[i].items[j].filter_args = data.reports[i].id; for (prop in data.reports[i].items[j].meta) { - console.log(prop) data.reports[i].items[j].filter_args = data.reports[i].items[j].filter_args + ","+prop+"="+data.reports[i].items[j].meta[prop]; } }; diff --git a/src/js/yunohost/events.js b/src/js/yunohost/events.js index 5cfb10c4..a6cde272 100644 --- a/src/js/yunohost/events.js +++ b/src/js/yunohost/events.js @@ -69,13 +69,10 @@ c.flash('fail', y18n.t('error_retrieve_feed', [securityFeed])); }); - c.api("GET", "/diagnosis", {}, function(data) { - versions = data.packages; - $('#yunohost-version').html(y18n.t('footer_version', [versions.yunohost.version, versions.yunohost.repo])); - if (data.security["CVE-2017-5754"].vulnerable) { - c.flash('danger', y18n.t('meltdown')); - } - c.hideLoader(); + c.api("GET", "/diagnosis/show?full", {}, function(data) { + basesystem = data.reports.filter(function(r) { return r.id == "basesystem"; })[0]; + version_info = basesystem.items.filter(function(i) { return (i.meta && i.meta.test && i.meta.test == "ynh_versions"); })[0]; + $('#yunohost-version').html(y18n.t('footer_version', [version_info.data.main_version, version_info.data.repo])); }); }); }); diff --git a/src/js/yunohost/main.js b/src/js/yunohost/main.js index 5219715b..72615a31 100644 --- a/src/js/yunohost/main.js +++ b/src/js/yunohost/main.js @@ -181,9 +181,10 @@ sam.store.set('url', window.location.hostname + '/yunohost/api'); if (sam.store.get('connected')) { - this.api('GET', '/diagnosis', {}, function(diagnosis) { - versions = diagnosis.packages; - $('#yunohost-version').html(y18n.t('footer_version', [versions.yunohost.version, versions.yunohost.repo])); + this.api('GET', '/diagnosis/show?full', {}, function(data) { + basesystem = data.reports.filter(function(r) { return r.id == "basesystem"; })[0]; + version_info = basesystem.items.filter(function(i) { return (i.meta && i.meta.test && i.meta.test == "ynh_versions"); })[0]; + $('#yunohost-version').html(y18n.t('footer_version', [version_info.data.main_version, version_info.data.repo])); }); }