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.
+ + {% endif %} + +

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 00000000..490ebc8d Binary files /dev/null and b/img/icon_rss.png differ diff --git a/img/icon_rss.svg b/img/icon_rss.svg new file mode 100644 index 00000000..c3623e04 --- /dev/null +++ b/img/icon_rss.svg @@ -0,0 +1,140 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/img/logo_rss.png b/img/logo_rss.png new file mode 100644 index 00000000..98a0c57d Binary files /dev/null and b/img/logo_rss.png differ