From 28c788f38e6d7aedfcd12553b7643bf64ed9ffb7 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 4 Feb 2019 23:55:21 +0000 Subject: [PATCH] Remove calls to /version, use /diagnosis instead --- src/js/yunohost/controllers/home.js | 2 ++ src/js/yunohost/controllers/monitor.js | 6 +++--- src/js/yunohost/controllers/tools.js | 4 ++-- src/js/yunohost/events.js | 3 --- src/js/yunohost/main.js | 7 ------- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/js/yunohost/controllers/home.js b/src/js/yunohost/controllers/home.js index fb3159fc..03dd69ee 100644 --- a/src/js/yunohost/controllers/home.js +++ b/src/js/yunohost/controllers/home.js @@ -78,6 +78,8 @@ }); c.api("/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')); } diff --git a/src/js/yunohost/controllers/monitor.js b/src/js/yunohost/controllers/monitor.js index a7e8c664..527e466c 100644 --- a/src/js/yunohost/controllers/monitor.js +++ b/src/js/yunohost/controllers/monitor.js @@ -30,8 +30,8 @@ delete monitorData.network.usage.lo; // Get YunoHost versions too - c.api('/version', function(versions) { - monitorData.versions = versions; + c.api('/diagnosis', function(diagnosis) { + monitorData.versions = diagnosis.packages; c.view('tools/tools_monitoring', monitorData); }); }); @@ -47,4 +47,4 @@ }, 'GET'); }); -})(); \ No newline at end of file +})(); diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js index d24566db..09f8687a 100644 --- a/src/js/yunohost/controllers/tools.js +++ b/src/js/yunohost/controllers/tools.js @@ -223,8 +223,8 @@ // Packages version app.get('#/tools/versions', function (c) { - c.api('/version', function(versions) { - c.view('tools/tools_versions', {'versions' : versions}); + c.api('/diagnosis', function(diagnosis) { + c.view('tools/tools_versions', {'versions' : diagnosis.packages }); }); }); diff --git a/src/js/yunohost/events.js b/src/js/yunohost/events.js index cde91e94..505bb140 100644 --- a/src/js/yunohost/events.js +++ b/src/js/yunohost/events.js @@ -8,9 +8,6 @@ * */ app.bind('login', function(e, data) { - this.api('/version', function(versions) { - $('#yunohost-version').html(y18n.t('footer_version', [versions.yunohost.version, versions.yunohost.repo])); - }); }); app.bind('logout', function(e, data) { diff --git a/src/js/yunohost/main.js b/src/js/yunohost/main.js index 8ca70af2..c1e14ecf 100644 --- a/src/js/yunohost/main.js +++ b/src/js/yunohost/main.js @@ -149,13 +149,6 @@ // Store url sam.store.set('url', window.location.hostname + '/yunohost/api'); - // Get YunoHost version - if (sam.store.get('connected')) { - this.api('/version', function(versions) { - $('#yunohost-version').html(y18n.t('footer_version', [versions.yunohost.version, versions.yunohost.repo])); - }); - } - // Flash messages var flashMessage = $('#flashMessage'); $('#toggle-btn', flashMessage).click(function(e) {