diff --git a/js/app.js b/js/app.js index f48b1c68..96164d47 100644 --- a/js/app.js +++ b/js/app.js @@ -1577,6 +1577,48 @@ app = Sammy('#main', function (sam) { 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 diff --git a/locales/en.json b/locales/en.json index dfd66877..06b6af55 100644 --- a/locales/en.json +++ b/locales/en.json @@ -206,6 +206,10 @@ "tools_adminpw_confirm_placeholder" : "Confirm the new password", "tools_download_ca" : "Download 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_upgrade" : "System upgrade", diff --git a/locales/fr.json b/locales/fr.json index 6fa9554f..cc746ba7 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -206,7 +206,10 @@ "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_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_upgrade" : "Mise à jour du système", diff --git a/views/tools/tools_list.ms b/views/tools/tools_list.ms index 67856b2c..0095773d 100644 --- a/views/tools/tools_list.ms +++ b/views/tools/tools_list.ms @@ -19,4 +19,8 @@

{{t 'tools_download_ca'}}

+ + +

{{t 'tools_security_feed'}}

+
diff --git a/views/tools/tools_security_feed.ms b/views/tools/tools_security_feed.ms new file mode 100644 index 00000000..928e686b --- /dev/null +++ b/views/tools/tools_security_feed.ms @@ -0,0 +1,31 @@ +
+ {{t 'home'}} + {{t 'tools'}} + {{t 'tools_security_feed'}} +
+ +
+ +{{#if items}} +
+ {{#items}} +
+ +

{{title}}

+
{{{desc}}}
+

+ {{t 'read_more'}} +

+
+ {{/items}} +
+{{else}} +
+ {{t 'tools_security_feed_no_items'}} +
+{{/if}} + +
+ + {{t 'tools_security_feed_view_items'}} + {{t 'tools_security_feed_subscribe_rss'}} \ No newline at end of file