Use the new diagnosis system to display the version number

This commit is contained in:
Alexandre Aubin 2019-11-06 23:47:23 +01:00
parent 3c9c3fc926
commit e39d00956b
3 changed files with 8 additions and 11 deletions

View file

@ -54,7 +54,6 @@
// We want filter_args to be something like "dnsrecords,domain=yolo.test,category=xmpp" // 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; data.reports[i].items[j].filter_args = data.reports[i].id;
for (prop in data.reports[i].items[j].meta) { 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]; data.reports[i].items[j].filter_args = data.reports[i].items[j].filter_args + ","+prop+"="+data.reports[i].items[j].meta[prop];
} }
}; };

View file

@ -69,13 +69,10 @@
c.flash('fail', y18n.t('error_retrieve_feed', [securityFeed])); c.flash('fail', y18n.t('error_retrieve_feed', [securityFeed]));
}); });
c.api("GET", "/diagnosis", {}, function(data) { c.api("GET", "/diagnosis/show?full", {}, function(data) {
versions = data.packages; basesystem = data.reports.filter(function(r) { return r.id == "basesystem"; })[0];
$('#yunohost-version').html(y18n.t('footer_version', [versions.yunohost.version, versions.yunohost.repo])); version_info = basesystem.items.filter(function(i) { return (i.meta && i.meta.test && i.meta.test == "ynh_versions"); })[0];
if (data.security["CVE-2017-5754"].vulnerable) { $('#yunohost-version').html(y18n.t('footer_version', [version_info.data.main_version, version_info.data.repo]));
c.flash('danger', y18n.t('meltdown'));
}
c.hideLoader();
}); });
}); });
}); });

View file

@ -181,9 +181,10 @@
sam.store.set('url', window.location.hostname + '/yunohost/api'); sam.store.set('url', window.location.hostname + '/yunohost/api');
if (sam.store.get('connected')) { if (sam.store.get('connected')) {
this.api('GET', '/diagnosis', {}, function(diagnosis) { this.api('GET', '/diagnosis/show?full', {}, function(data) {
versions = diagnosis.packages; basesystem = data.reports.filter(function(r) { return r.id == "basesystem"; })[0];
$('#yunohost-version').html(y18n.t('footer_version', [versions.yunohost.version, versions.yunohost.repo])); 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]));
}); });
} }