[enh] Add security notifications page.

This commit is contained in:
opi 2014-11-15 15:55:26 +01:00
parent f6c786ad57
commit 143928f7c7
5 changed files with 85 additions and 1 deletions

View file

@ -1577,6 +1577,48 @@ app = Sammy('#main', function (sam) {
c.view('tools/tools_ca'); c.view('tools/tools_ca');
}); });
// Security feed
sam.get('#/tools/security-feed', function (c) {
data = {
items: []
};
// Get security feed and display items
var securityUrl = 'https://forum.yunohost.org/c/security';
var securityFeed = 'https://yunohost.org/security.rss';
var securityFeed = 'https://yolo.swag/yunohost/admin/security.rss';
data.url = {
web: securityUrl,
rss: securityFeed
}
$.ajax({
url: securityFeed,
// dataType: (jQuery.browser.msie) ? "text" : "xml",
dataType: "xml"
})
.done(function(xml){
// Loop through items
$('item', xml).each(function(k, v) {
var item = {
guid: $('guid', v)[0].innerHTML,
title: $('title', v)[0].innerHTML,
url: $('link', v)[0].innerHTML,
desc: $('description', v)[0].textContent
}
data.items.push(item);
});
console.log(data);
c.view('tools/tools_security_feed', data);
})
.fail(function() {
c.flash('fail', y18n.t('error_retrieve_feed', [securityFeed]))
});
});
/** /**
* Backup * Backup

View file

@ -206,6 +206,10 @@
"tools_adminpw_confirm_placeholder" : "Confirm the new password", "tools_adminpw_confirm_placeholder" : "Confirm the new password",
"tools_download_ca" : "Download SSL Certificate Authority (CA)", "tools_download_ca" : "Download SSL Certificate Authority (CA)",
"tools_download_ca_desc" : "Click here to download your SSL certificate authority (CA)", "tools_download_ca_desc" : "Click here to download your SSL certificate authority (CA)",
"tools_security_feed" : "Security notifications",
"tools_security_feed_no_items" : "No security notifications",
"tools_security_feed_view_items" : "View all security notifications",
"tools_security_feed_subscribe_rss" : "Subscribe to security notifications RSS",
"system_update" : "System update", "system_update" : "System update",
"system_upgrade" : "System upgrade", "system_upgrade" : "System upgrade",

View file

@ -206,7 +206,10 @@
"tools_adminpw_confirm_placeholder" : "Confirmez le nouveau mot de passe", "tools_adminpw_confirm_placeholder" : "Confirmez le nouveau mot de passe",
"tools_download_ca" : "Télécharger l'autorité de certification SSL (CA)", "tools_download_ca" : "Télécharger l'autorité de certification SSL (CA)",
"tools_download_ca_desc" : "Cliquez ici pour télécharger l'autorité de certification SSL (CA)", "tools_download_ca_desc" : "Cliquez ici pour télécharger l'autorité de certification SSL (CA)",
"tools_security_feed" : "Alertes de sécurité",
"tools_security_feed_no_items" : "Aucune alertes de sécurité",
"tools_security_feed_view_items" : "Voir toutes les alertes de sécurité",
"tools_security_feed_subscribe_rss" : "S'inscrire au flux RSS des alertes de sécurité",
"system_update" : "Mettre à jour le système", "system_update" : "Mettre à jour le système",
"system_upgrade" : "Mise à jour du système", "system_upgrade" : "Mise à jour du système",

View file

@ -19,4 +19,8 @@
<span class="fa-chevron-right pull-right"></span> <span class="fa-chevron-right pull-right"></span>
<h2 class="list-group-item-heading">{{t 'tools_download_ca'}}</h2> <h2 class="list-group-item-heading">{{t 'tools_download_ca'}}</h2>
</a> </a>
<a href="#/tools/security-feed" class="list-group-item slide">
<span class="fa-chevron-right pull-right"></span>
<h2 class="list-group-item-heading">{{t 'tools_security_feed'}}</h2>
</a>
</div> </div>

View file

@ -0,0 +1,31 @@
<div class="btn-breadcrumb">
<a href="#/" ><i class="fa-home"></i><span class="sr-only">{{t 'home'}}</span></a>
<a href="#/tools">{{t 'tools'}}</a>
<a href="#/tools/ca">{{t 'tools_security_feed'}}</a>
</div>
<div class="separator"></div>
{{#if items}}
<div class="list-group">
{{#items}}
<div class="list-group-item">
<!-- <a href="{{url}}" class="fa-chevron-right pull-right"></a> -->
<h2 class="list-group-item-heading"><a href="{{url}}">{{title}}</a></h2>
<div class="list-group-item-text">{{{desc}}}</div>
<p class="text-right">
<a href="{{url}}" class="btn btn-default">{{t 'read_more'}}</a>
</p>
</div>
{{/items}}
</div>
{{else}}
<div class="alert alert-success">
<span class="fa-thumbs-o-up"></span> {{t 'tools_security_feed_no_items'}}
</div>
{{/if}}
<div class="separator"></div>
<a href="{{url.web}}" class="btn btn-success" target="_blank"><span class="fa-list"></span> {{t 'tools_security_feed_view_items'}}</a>
<a href="{{url.rss}}" class="btn btn-warning" target="_blank"><span class="fa-rss"></span> {{t 'tools_security_feed_subscribe_rss'}}</a>