From ec44853934fff1d6a913dea56b080dfa8208b193 Mon Sep 17 00:00:00 2001 From: Saivann Date: Tue, 18 Jun 2013 23:50:37 -0400 Subject: [PATCH] Add "Network status and alerts" page and RSS feed (fixes #170) Generate alerts pages through alerts.rb plugin Allow to keep short alias urls for each alert Move alert pages in _alerts Update sitemap plugin to include alerts --- README.md | 30 +++- .../2012-02-18-protocol-change.html | 13 +- .../2012-03-16-critical-vulnerability.html | 14 +- dos.html => _alerts/2012-05-14-dos.html | 13 +- .../2013-03-11-chain-fork.html | 13 +- .../2013-03-15-upgrade-deadline.html | 13 +- _layouts/alert.html | 17 +++ _layouts/base.html | 2 +- _less/screen.less | 24 +++ _plugins/alerts.rb | 49 ++++++ _plugins/catpage_for.rb | 49 ++++++ _plugins/sitemap.rb | 7 + css/ie.css | 3 + en/alerts.html | 31 ++++ en/rss/alerts.rss | 21 +++ img/icon_rss.png | Bin 0 -> 1060 bytes img/icon_rss.svg | 140 ++++++++++++++++++ img/logo_rss.png | Bin 0 -> 3132 bytes 18 files changed, 385 insertions(+), 54 deletions(-) rename feb20.html => _alerts/2012-02-18-protocol-change.html (85%) rename critfix.html => _alerts/2012-03-16-critical-vulnerability.html (98%) rename dos.html => _alerts/2012-05-14-dos.html (86%) rename chainfork.html => _alerts/2013-03-11-chain-fork.html (82%) rename may15.html => _alerts/2013-03-15-upgrade-deadline.html (91%) create mode 100644 _layouts/alert.html create mode 100644 _plugins/alerts.rb create mode 100644 _plugins/catpage_for.rb create mode 100644 en/alerts.html create mode 100644 en/rss/alerts.rss create mode 100644 img/icon_rss.png create mode 100644 img/icon_rss.svg create mode 100644 img/logo_rss.png diff --git a/README.md b/README.md index 6a58e30a..dc3ad966 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,9 @@ Any change in the english texts can be done through a pull request on github. If ## Advanced Usage -### Alerts +### Alert banner -You can easily put an alert on the website by changing the ALERT and ALERT\_CLASS variables in _config.yml. +You can put an alert banner on the website by changing the ALERT and ALERT\_CLASS variables in _config.yml. You can both set one fallback alert for all languages and many translated alerts for specific languages. Example: @@ -88,6 +88,32 @@ ALERT_CLASS: This will produce an english red alert box for all languages, and a translated red alert box for french language. Possible classes are: **error** (red), **info** (blue), **success** (green) and **warning** (yellow) +### Network alerts + +Network alerts should be placed in `_alerts/YYYY-MM-DD-SHORTITLE.html` and adhere to this format: + +``` +--- +title: "11/12 March 2013 Chain Fork" +lastmod: "Fri Mar 16 22:58:00 UTC 2012" +alias: "chainfork" +active: true +--- + +

+A chain fork is happening. Please stop mining on bitcoin version 0.8.0. Your bitcoins are safe but it is recommended that you postpone your Bitcoin transactions for the next hours. +

+

+More information will follow. +

+ +``` +* `SHORTTITLE` is used to construct the URL. +* `title: ...` will be used as the title in the layout. +* `lastmod: ...` will be used as the last modification date in the layout. +* `alias: ...` (optional) a short alias to be used for Bitcoin-Qt alerts. Ex. "dos" will produce /dos.html +* `active: ...` (true or false) define if the alert should appear as ongoing in the network status page. + ### Release Notes Release notes should be placed in `_posts/releases/YEAR-MONTH-DAY-SHORTTITLE.md` and adhere to this format: diff --git a/feb20.html b/_alerts/2012-02-18-protocol-change.html similarity index 85% rename from feb20.html rename to _alerts/2012-02-18-protocol-change.html index 7faa1309..7e6a8a0a 100644 --- a/feb20.html +++ b/_alerts/2012-02-18-protocol-change.html @@ -1,11 +1,9 @@ --- -layout: base -lang: en title: "February 20, 2012 Protocol Changes" +lastmod: "Mon Feb 20 00:10:00 UTC 2012" +alias: "feb20" +active: false --- -
-
-

February 20, 2012 Protocol Changes

In June 2010 the Bitcoin reference software version 0.2.10 introduced a change to the protocol: the 'version' messages exchanged by nodes @@ -36,8 +34,3 @@ channel on Freenode IRC. If there are unexpected difficulties this page will be updated with relevant information.

-
-This notice last updated: Mon Feb 20 00:10:00 UTC 2012 -
-
-
diff --git a/critfix.html b/_alerts/2012-03-16-critical-vulnerability.html similarity index 98% rename from critfix.html rename to _alerts/2012-03-16-critical-vulnerability.html index d31b3892..80a6d57e 100644 --- a/critfix.html +++ b/_alerts/2012-03-16-critical-vulnerability.html @@ -1,11 +1,9 @@ --- -layout: base -lang: en title: "Potentially Critical Security Vulnerability" +lastmod: "Fri Mar 16 22:58:00 UTC 2012" +alias: "critfix" +active: false --- -
-
-

Potentially Critical Security Vulnerability

A potential security vulnerability has been discovered in the Windows version of Bitcoin-Qt. If you are running Bitcoin-Qt versions 0.5 @@ -227,9 +225,3 @@ href="https://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.6.0/test/ href="https://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.5.3/"> 0.5.3.1 för Windows och 0.5.3 för Linux

- -
-This notice last updated: Fri Mar 16 22:58:00 UTC 2012 -
-
-
diff --git a/dos.html b/_alerts/2012-05-14-dos.html similarity index 86% rename from dos.html rename to _alerts/2012-05-14-dos.html index 848d0044..019140ac 100644 --- a/dos.html +++ b/_alerts/2012-05-14-dos.html @@ -1,11 +1,9 @@ --- -layout: base -lang: en title: "CVE-2012-2459: Critical Vulnerability (denial-of-service)" +lastmod: "Mon May 14 17:00:00 UTC 2012" +alias: "dos" +active: false --- -
-
-

CVE-2012-2459: Critical Vulnerability (denial-of-service)

Risks

A denial-of-service vulnerability that affects all versions of @@ -61,8 +59,3 @@ Could this bug be used to install malware on my system?

No.

-
- This notice last updated: Mon May 14 17:00:00 UTC 2012 -
-
-
diff --git a/chainfork.html b/_alerts/2013-03-11-chain-fork.html similarity index 82% rename from chainfork.html rename to _alerts/2013-03-11-chain-fork.html index 17816c7c..d79889fc 100644 --- a/chainfork.html +++ b/_alerts/2013-03-11-chain-fork.html @@ -1,11 +1,9 @@ --- -layout: base -lang: en title: "11/12 March 2013 Chain Fork Information" +lastmod: "16 May 2013 01:37 UTC" +alias: "chainfork" +active: false --- -
-
-

11/12 March 2013 Chain Fork Information

What happened

A bitcoin miner running version 0.8.0 created a large block (at height 225,430) that is incompatible @@ -37,8 +35,3 @@ The core developers have investigated what caused the old versions to reject the blocks, and have released a 0.8.1 version that avoids creating blocks that are incompatible with older versions. A full post-mortem document has been published.

-
- This notice last updated: 16 May 2013 01:37 UTC -
-
-
diff --git a/may15.html b/_alerts/2013-03-15-upgrade-deadline.html similarity index 91% rename from may15.html rename to _alerts/2013-03-15-upgrade-deadline.html index c419aee3..60fe5ae5 100644 --- a/may15.html +++ b/_alerts/2013-03-15-upgrade-deadline.html @@ -1,11 +1,9 @@ --- -layout: base -lang: en title: "15 May 2013 Upgrade Deadline" +lastmod: "10 May 2013 21:30 UTC" +alias: "may15" +active: false --- -
-
-

15 May 2013 Upgrade Deadline

What is happening

If you are using an old version of Bitcoin-Qt (or bitcoind, the server bitcoin software), @@ -68,8 +66,3 @@ that bug, we determined that the bug can happen even if the entire network was still running old versions of Bitcoin-Qt/bitcoind. Therefore, the only option is to require everybody to either upgrade or workaround the bug.

-
- This notice last updated: 10 May 2013 21:30 UTC -
-
-
diff --git a/_layouts/alert.html b/_layouts/alert.html new file mode 100644 index 00000000..8ccd8579 --- /dev/null +++ b/_layouts/alert.html @@ -0,0 +1,17 @@ +--- +layout: base +lang: en +--- +{% if page.redirect != nil %} + + +{% endif %} + +
+

{{ page.title }}
{{ page.date | date:"%e %B %Y" }}

+ {{ content }} +
+ This notice last updated: {{ page.lastmod }} +
+
+Go back to the network alerts history diff --git a/_layouts/base.html b/_layouts/base.html index c82863c0..9f1220cd 100644 --- a/_layouts/base.html +++ b/_layouts/base.html @@ -95,7 +95,7 @@ menu: Icon{% translate button-support layout %} - + diff --git a/_less/screen.less b/_less/screen.less index ed693f08..2fb54c80 100644 --- a/_less/screen.less +++ b/_less/screen.less @@ -382,6 +382,9 @@ li p{ #footer div{ padding-top:6px; } +#footer>div>a{ + margin-right:15px; +} /*Styles specific to elements in pages*/ @@ -624,6 +627,27 @@ li p{ text-align:left; margin-bottom:40px; } +.rssicon{ + vertical-align:bottom; + margin-bottom:9px; + margin-left:10px; +} +.alertstatusinactive{ + font-size:130%; + color:#0d579b; + margin-bottom:30px; +} +.alertstatusactive{ + font-size:130%; + color:#d57700; + margin-bottom:30px; +} +.alertsactive{ + margin-bottom:20px; +} +.alertsactive a{ + font-weight:bold; +} .download a{ font-size:125%; diff --git a/_plugins/alerts.rb b/_plugins/alerts.rb new file mode 100644 index 00000000..104fe38c --- /dev/null +++ b/_plugins/alerts.rb @@ -0,0 +1,49 @@ +require 'yaml' + +module Jekyll + + class AlertPage < Page + def initialize(site, base, lang, srcdir, src, dstdir, dst, date) + @site = site + @base = base + @dir = '/'+dstdir + @name = dst + self.process(dst) + self.read_yaml(File.join(base, srcdir), src) + self.data['lang'] = lang + self.data['date'] = date + self.data['layout'] = 'alert' + if dstdir == '' + self.data['redirect'] = src.split('.')[0] + else + self.data['category'] = 'alert' + if self.data.has_key?('alias') + site.pages << AlertPage.new(site, base, lang, srcdir, src, '', self.data['alias']+'.html', date) + end + end + end + end + + class AlertPageGenerator < Generator + def generate(site) + #generate each alert based on templates + Dir.foreach('_alerts') do |file| + next if file == '.' or file == '..' + lang = 'en' + src = file + dst = file + srcdir = '_alerts' + dstdir = lang + '/alert' + date = dst.split('-') + next if date.length < 4 + date = date[0] + '-' + date[1] + '-' + date[2] + next if !/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.match(date) + site.pages << AlertPage.new(site, site.source, lang, '_alerts', src, dstdir, dst, date) + end + #TODO alerts are only generated for english language, + #but they could also be translated at some point. They would however + #need to fallback to english when no translation is available. + end + end + +end diff --git a/_plugins/catpage_for.rb b/_plugins/catpage_for.rb new file mode 100644 index 00000000..4bdd7fe6 --- /dev/null +++ b/_plugins/catpage_for.rb @@ -0,0 +1,49 @@ +#catpage_for allows to loop in site.pages sorted by custom page +#variables and filtered by page.category. +#Example : {% catpage_for p in site.pages sort_by:date category:release %} + +module Jekyll + module SortedForImpl + def render(context) + sorted_collection = collection_to_sort context + return if sorted_collection.empty? + sort_attr = @attributes['sort_by'] + category_attr = @attributes['category'] + #filter page by given category + s = [] + for x in sorted_collection + if x.to_liquid.has_key?('category') && x.to_liquid['category'] == category_attr + s.push(x) + end + end + sorted_collection = s + #sort collection by given variable + sorted_collection = sorted_collection.sort_by { |i| i.to_liquid[sort_attr] } + #return modified array + original_name = @collection_name + result = nil + context.stack do + sorted_collection_name = "#{@collection_name}_sorted".sub('.', '_') + context[sorted_collection_name] = sorted_collection + @collection_name = sorted_collection_name + result = super + @collection_name = original_name + end + result + end + end + + class SortedForTag < Liquid::For + include SortedForImpl + + def collection_to_sort(context) + return context[@collection_name].dup + end + + def end_tag + 'endcatpage_for' + end + end +end + +Liquid::Template.register_tag('catpage_for', Jekyll::SortedForTag) diff --git a/_plugins/sitemap.rb b/_plugins/sitemap.rb index 622736b0..4444d8a3 100644 --- a/_plugins/sitemap.rb +++ b/_plugins/sitemap.rb @@ -66,6 +66,13 @@ module Jekyll sitemap.puts ' http://bitcoin.org/'+file1.gsub('.html','')+'' sitemap.puts '' end + #Add english alerts pages + Dir.foreach('_alerts') do |file| + next if file == '.' or file == '..' + sitemap.puts '' + sitemap.puts ' http://bitcoin.org/en/alert/'+file.gsub('.html','')+'' + sitemap.puts '' + end #Add posts site.posts.each do |post| sitemap.puts '' diff --git a/css/ie.css b/css/ie.css index db145b39..e254c0fa 100644 --- a/css/ie.css +++ b/css/ie.css @@ -21,6 +21,9 @@ h3 .ieimg{ #footer{ width:800px; } +#footer div a{ + margin-right:expression(this.parentNode.nodeName=='DIV'?'15px':''); +} #content{ width: 690px; overflow:hidden; diff --git a/en/alerts.html b/en/alerts.html new file mode 100644 index 00000000..30f3c242 --- /dev/null +++ b/en/alerts.html @@ -0,0 +1,31 @@ +--- +layout: base +lang: en +id: alerts +title: Network status and alerts - Bitcoin +--- + +
+

Network status and alertsrss

+ {% assign active = false %}{% catpage_for p in site.pages reversed sort_by:date category:alert %}{% if p.active == true %}{% assign active = true %}{% endif %}{% endcatpage_for %} + {% if active == false %} +
There is no ongoing event on the Bitcoin network.
+ {% else %} +
The following network event is ongoing.
+
    + {% catpage_for p in site.pages reversed sort_by:date category:alert %}{% if p.active == true %} +
  • + {{ p.date | date:"%Y-%m-%d" }} - {{ p.title }} +
  • + {% endif %}{% endcatpage_for %} +
+ {% endif %} +
    + {% catpage_for p in site.pages reversed sort_by:date category:alert %}{% if p.active == false %} +
  • + {{ p.date | date:"%Y-%m-%d" }} - {{ p.title }} +
  • + {% endif %}{% endcatpage_for %} +
+

See the complete CVE list.

+
diff --git a/en/rss/alerts.rss b/en/rss/alerts.rss new file mode 100644 index 00000000..24f54f7e --- /dev/null +++ b/en/rss/alerts.rss @@ -0,0 +1,21 @@ +--- +--- + + + + Bitcoin network status and alerts + http://bitcoin.org/en/alerts + This RSS feed allows to follow events and alerts surrounding the Bitcoin network and software. + + http://bitcoin.org/img/logo_rss.png + http://bitcoin.org/en/alerts + + {% catpage_for p in site.pages reversed sort_by:date category:alert %} + + {{ p.title }} + http://bitcoin.org{{ p.url | replace:'.html','' }} + {{ p.date | date: "%a, %d %b %Y" }} + + {% endcatpage_for %} + + diff --git a/img/icon_rss.png b/img/icon_rss.png new file mode 100644 index 0000000000000000000000000000000000000000..490ebc8d521ee8140f2649dae2daaa8b4a8d21a0 GIT binary patch literal 1060 zcmV+<1l#+GP)K@#DcW5r+g~c(Vk+Kb zE8b=>;Akx3Y%St)I^uja;(ayaa4qA0HsgObem2T>LG3tIX>WDzy1$C zfHLfXGVFsl?4Nb*gfs1lKkbc8?U!Bdm09keaPNgP?}jt)hBWV*UhkrD@QF0=lSA;h zobie^@svaHmrwDXUGbk}@vMRJj5YF)J@S%5^N%+3kT~;`JoBSr^Q?OFy`S^Pv-Fli z^p`~Rn@jYaPW6&D^`&9;xQX?;j`hZ>_LMjFl{fa4Jod45_OW^P$ENny$M=^w_nblZ zokRDfR`;}d_sz5TnK<~FIry4A_?tWUn>_flbNI%b_{gI8%&Pd*y!o0r`Jzhsw{`ix zhWXB^`O&fY+sXQzIr^hV`lL+ys8#x~Wcssg`o@&{(5m~MI{Te~I%rv2Ho{oAizcd{_fuX z@#OyV=>GNV{`Kzu_w@hu>;Lxc|M>F%`Sbt#`2YO*|NZ*^{rms@{Qv&_|Ns8~|No=n zR)7Ei00(qZPE!D5wAA_e`7D1=r2qf{j!8s8R2WxP$jxrkKokbhZ{|+MI#C+h-E$@Nh3p)i%zrD9aM@csu{LE)3Ga_O@-Dw;Re!Dld%e z?Ut%QFTJ^Q-UhEgN&hYIaJ8wzxNk0gc^kSYk*E|v@#@UPDP#1)hOPsZ!<76M27`Pt z=Mj!S+s-l-&&jx^-shy_8N8w eFe1Pkj*P#+YR!XBlPrAz0000 + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/img/logo_rss.png b/img/logo_rss.png new file mode 100644 index 0000000000000000000000000000000000000000..98a0c57d06d01be96c2f67fd5d41a63660aae3ee GIT binary patch literal 3132 zcmV-C48!w@P)Jzr66@$#i?5H zK`kms(INwdDi0sEP8=nz&}k`Z3x*p=AP^oBAUp!$X%P|(&+w8*fM7~M2!RCTxqJ8S zyB)M~U_xo|qcg}ad^PL+2;09mbm!}_I`k?JsQQc6F zqeh_KLCr+1L2W`6p*Ew6QCsNGOHct+8fql!NmM7)SA3A}fx81W7&Qg84JD(%Azh`g z(@{fFcljWl1J@GO2Q?XW+(BqoRYAc%Oj^GWk`3OCs0UGVP&FLjndver57iIV!Ut&% z@D|iq)DeN;HP%v7QMdXazXX_q%A`IDJSLg;99^0%NPPL*P*YKg2LVPajLJc^Z#E$D zWxs_QkGhfo0F7GcB-D2j8YI5pQ>dy01Q@Lgs9^~Q5?`tfYGE?~7_HT)wg~|eU!;FC zX@!lo&gVP}5+A-5YI-vU7_CL9Z+HqMnO~s_eRvJD2bJszkocfoIfc`_qDoXRp+VvU zK9-=<3a2HZ1_}w1#vm0R5>pUih)^Kunw}5Q9?a*307<78Ass=@A!2HIAIq3xbOt1!-z~FAactx(bqp+&&Z8FrgjqgLWxbAY8EtLR&)uo0XS3g_L^F69b7DYTj&i2Z1KK%I>WB-UPt-~L*BE=5Kzwvx<^}sxc`-Q&N@Ym(*M4eh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