Changeset - d9a38445fd8f
[Not reviewed]
README.rst
Show inline comments
 
@@ -54,7 +54,7 @@ branching model, but with some modificat
 
Description of the branches:
 

	
 
- **default**: This is the stable branch.
 
- **stable**: This is the main development branch.
 
- **dev**: This is the main development branch.
 
- **hotfix-***: These branches branch off from the default branch and are used to
 
  fix bugs which are in the stable version. They will be merged back into
 
  *default* and *dev*. After the bug is fixed, the *PATCH* number must be
ennstatus/__init__.py
Show inline comments
 
@@ -82,7 +82,10 @@ def create_app():
 
    app.register_blueprint(status_page, url_prefix='/status')
 

	
 
    from .statistics.views import statistics_page
 
    app.register_blueprint(statistics_page, url_prefix='/stats')
 
    app.register_blueprint(statistics_page, url_prefix='/statistics')
 

	
 
    from .data.views import data_page
 
    app.register_blueprint(data_page, url_prefix='/data')
 

	
 
    from .log import init_logging
 
    init_logging(app)
ennstatus/data/__init__.py
Show inline comments
 
new file 100644
 
# Ënnstatus
 
# Copyright (C) 2015  Dennis Fink
 
#
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
ennstatus/data/views.py
Show inline comments
 
new file 100644
 
# Ënnstatus
 
# Copyright (C) 2015  Dennis Fink
 
#
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
from collections import defaultdict
 

	
 
from flask import Blueprint, jsonify
 

	
 
from ennstatus.status.functions import split_all_servers_to_types
 

	
 
data_page = Blueprint('data', __name__)
 

	
 

	
 
@data_page.route('/worldmap')
 
def worldmap():
 
    servers = split_all_servers_to_types()
 
    countries = {}
 

	
 
    for key, value in servers.items():
 
        for server in value:
 
            if server.country not in countries:
 
                countries[server.country] = defaultdict(int)
 
            countries[server.country][server.type] += 1
 
            countries[server.country]['total'] += 1
 

	
 
    maximum = max(i['total'] for i in countries.values())
 

	
 
    countries['max'] = maximum
 

	
 
    return jsonify(countries)
ennstatus/static/css/map.css
Show inline comments
 
@@ -20,3 +20,14 @@
 
	stroke-linejoin: round;
 
	stroke-width: 0.1px;
 
}
 

	
 
.tooltip {
 
    color: #222;
 
    background: #fff;
 
    padding: .5em;
 
    text-shadow: #f5f5f5 0 1px 0;
 
    border-radius: 2px;
 
    box-shadow: 0px 0px 2px 0px #a6a6a6;
 
    opacity: 0.9;
 
    position: absolute;
 
}
ennstatus/static/js/worldmap.js
Show inline comments
 
@@ -35,9 +35,9 @@ setup(width, height);
 

	
 
function setup(width, height) {
 
	projection = d3.geo.mercator()
 
		.translate([(width / 2), (height / 2)])
 
		.scale(width / 2 / Math.PI)
 

	
 
	 	.translate([(width / 2), (height / 2)])
 
	 	.scale(width / 2 / Math.PI)
 
	
 
	path = d3.geo.path().projection(projection);
 

	
 
	svg = d3.select("#chart").append("svg")
 
@@ -70,44 +70,60 @@ function draw(topo) {
 
		.attr("d", path);
 

	
 
	var country = g.selectAll(".country").data(topo);
 
	d3.json("/stats/data/worldmap", function(err, data) {
 
	d3.json("/data/worldmap", function(err, data) {
 

	
 

	
 
		var colorscale = d3.scale.threshold().domain([2, 4, 8, 16, 32, 48]).range(["#f2f0f7", "#dadaeb", "#bcbddc", "#9e9ac8", "#756bb1", "#54278f"])
 
		var colorscale = d3.scale.threshold().domain(d3.range(1, (data.max+1)/3).map(function(n) { var a=1, b=1, f=1; for(var i = 2; i <= n; i++) { f = a+b; a=b; b=f } return f;})).range([
 
			"#aeffb9",
 
			"#87ff97",
 
			"#60ff76",
 
			"#38ff54",
 
			"#11ff32",
 
			"#00e920",
 
			"#00c21b",
 
			"#009a15",
 
			"#008713",
 
			"#007310",
 
			"#00600d",
 
			"#004c0a"
 
		])
 

	
 
		country.enter().insert("path")
 
			.attr("class", "country")
 
			.attr("d", path)
 
			.attr("id", function(d, i) { return d.id; })
 
			.attr("title", function(d, i) { 
 
				if (d.properties.name in data) {
 
					return "<p>" + d.properties.name + "</p>" + data[d.properties.name];
 
				} else {
 
					return d.properties.name;
 
				}
 
			})
 
			.style("fill", function(d, i) { 
 
				if (d.properties.name in data) {
 
					return colorscale(data[d.properties.name]);
 
					return colorscale(data[d.properties.name]['total']);
 
				} else {
 
					return "#fdf6e3";
 
				}
 
			});
 

	
 
		var offsetL = document.getElementById('chart').offsetLet+20;
 
		var offsetT = document.getElementById('chart').offsetTop+10;
 
		var tooltip = d3.select('#chart').append('div')
 
			.attr('class', 'tooltip')
 

	
 
		country.on("mousemove", function(d, i) {
 
	
 
			var mouse = d3.mouse(svg.node()).map(function(d) { return parseInt(d); });
 

	
 
			tooltip.classed("hidden", false)
 
				.attr("style", "left:"+(mouse[0]+offsetL)+"px;top:"+(mouse[1]+offsetT)+"px")
 
				.html(function(d, i) {
 
				.attr("style", "left:"+(mouse[0]+40)+"px;top:"+mouse[1]+"px")
 
				.html(function() {
 
					if (d.properties.name in data) {
 
						return d.properties.name + " " + data[d.properties.name];
 
						var text = "<b>" + d.properties.name + "</b>" + "<br>Total servers: " + data[d.properties.name]['total']
 
						if ('bridge' in data[d.properties.name]) {
 
							text = text + "<br>Bridge servers: " + data[d.properties.name]['bridge']
 
						}
 
						if ('exit' in data[d.properties.name]) {
 
							text = text + "<br>Exit servers: " + data[d.properties.name]['exit']
 
						}
 
						if ('relay' in data[d.properties.name]) {
 
							text = text + "<br>Relay server: " + data[d.properties.name]['relay']
 
						}
 
						return text
 
					} else {
 
						return d.properties.name;
 
						return "<b>" + d.properties.name + "</b>"
 
					}
 
				})
 
		})
ennstatus/statistics/views.py
Show inline comments
 
@@ -14,11 +14,7 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
from collections import defaultdict
 

	
 
from flask import Blueprint, render_template, current_app, jsonify
 

	
 
from ennstatus.status.functions import split_all_servers_to_types
 
from flask import Blueprint, render_template
 

	
 
statistics_page = Blueprint('statistics', __name__)
 

	
 
@@ -26,19 +22,3 @@ statistics_page = Blueprint('statistics'
 
@statistics_page.route('/worldmap')
 
def worldmap():
 
    return render_template('statistics/worldmap.html')
 

	
 

	
 
@statistics_page.route('/data/worldmap')
 
def data_worldmap():
 
    servers = split_all_servers_to_types()
 
    countries = defaultdict(int)
 

	
 
    for key, value in servers.items():
 
        for server in value:
 
            countries[server['country']] += 1
 

	
 
    maximum = max(countries.values())
 

	
 
    countries['max'] = maximum
 

	
 
    return jsonify(countries)
ennstatus/templates/base.html
Show inline comments
 
@@ -108,6 +108,12 @@
 
            <li><a href="http://lists.enn.lu/listinfo/discuss" target="blank">Mailing List</a></li>
 
          </ul>
 
        </li>
 
        <li class="dropdown">
 
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Statistics <b class="caret"></b></a>
 
          <ul class="dropdown-menu">
 
            <li><a href="{{ url_for('statistics.worldmap') }}">Worldmap</a></li>
 
          </ul>
 
        </li>
 
      </ul>
 
    </div>
 
  </div>
ennstatus/templates/donate/index.html
Show inline comments
 
@@ -111,63 +111,63 @@
 
          <p>
 
            <strong>Bitcoin Address:</strong> 1EYZCq2ZL6chWXYYkJoDo7fz39UC7do5cC
 
          </p>
 
        </div>
 
        <form class="bitpay-donate form-horizontal" action="https://bitpay.com/checkout" method="POST" onsubmit="return checkRequiredFields(this);">
 
          <input name="action" type="hidden" value="checkout">
 
          <div class="form-group">
 
            <label class="col-sm-2 control-label">Email:</label>
 
            <div class="col-sm-10">
 
              <input class="bitpay-donate-field-email form-control" name="orderID" type="email" placeholder="Email address (optional)" maxlenght=50 autocapitalize=off autocorrect=off />
 
          <form class="bitpay-donate form-horizontal" action="https://bitpay.com/checkout" method="POST" onsubmit="return checkRequiredFields(this);">
 
            <input name="action" type="hidden" value="checkout">
 
            <div class="form-group">
 
              <label class="col-sm-2 control-label">Email:</label>
 
              <div class="col-sm-10">
 
                <input class="bitpay-donate-field-email form-control" name="orderID" type="email" placeholder="Email address (optional)" maxlenght=50 autocapitalize=off autocorrect=off />
 
              </div>
 
            </div>
 
          </div>
 
          <div class="form-group">
 
            <label class="col-sm-2 control-label">Amount:</label>
 
            <div class="col-sm-10">
 
              <input class="bitpay-donate-field-price form-control" style="display: inline;" name="price" type="number" value="0.1" placeholder="Amount" maxlenght="10" min="0.000006" step="0.000001" />
 
              <select class="bitpay-donate-field-currency form-control" style="display: inline;" value="" name="currency">
 
                <option selected="selected" value="BTC">BTC</option>
 
                <option value="USD">USD</option>
 
                <option value="EUR">EUR</option>
 
                <option value="GBP">GBP</option>
 
                <option value="AUD">AUD</option>
 
                <option value="BGN">BGN</option>
 
                <option value="BRL">BRL</option>
 
                <option value="CAD">CAD</option>
 
                <option value="CHF">CHF</option>
 
                <option value="CNY">CNY</option>
 
                <option value="CZK">CZK</option>
 
                <option value="DKK">DKK</option>
 
                <option value="HKD">HKD</option>
 
                <option value="HRK">HRK</option>
 
                <option value="HUF">HUF</option>
 
                <option value="IDR">IDR</option>
 
                <option value="ILS">ILS</option>
 
                <option value="INR">INR</option>
 
                <option value="JPY">JPY</option>
 
                <option value="KRW">KRW</option>
 
                <option value="LTL">LTL</option>
 
                <option value="LVL">LVL</option>
 
                <option value="MXN">MXN</option>
 
                <option value="MYR">MYR</option>
 
                <option value="NOK">NOK</option>
 
                <option value="NZD">NZD</option>
 
                <option value="PHP">PHP</option>
 
                <option value="PLN">PLN</option>
 
                <option value="RON">RON</option>
 
                <option value="RUB">RUB</option>
 
                <option value="SEK">SEK</option>
 
                <option value="SGD">SGD</option>
 
                <option value="THB">THB</option>
 
                <option value="TRY">TRY</option>
 
                <option value="ZAR">ZAR</option>
 
              </select>
 
            <div class="form-group">
 
              <label class="col-sm-2 control-label">Amount:</label>
 
              <div class="col-sm-10">
 
                <input class="bitpay-donate-field-price form-control" style="display: inline;" name="price" type="number" value="0.1" placeholder="Amount" maxlenght="10" min="0.000006" step="0.000001" />
 
                <select class="bitpay-donate-field-currency form-control" style="display: inline;" value="" name="currency">
 
                  <option selected="selected" value="BTC">BTC</option>
 
                  <option value="USD">USD</option>
 
                  <option value="EUR">EUR</option>
 
                  <option value="GBP">GBP</option>
 
                  <option value="AUD">AUD</option>
 
                  <option value="BGN">BGN</option>
 
                  <option value="BRL">BRL</option>
 
                  <option value="CAD">CAD</option>
 
                  <option value="CHF">CHF</option>
 
                  <option value="CNY">CNY</option>
 
                  <option value="CZK">CZK</option>
 
                  <option value="DKK">DKK</option>
 
                  <option value="HKD">HKD</option>
 
                  <option value="HRK">HRK</option>
 
                  <option value="HUF">HUF</option>
 
                  <option value="IDR">IDR</option>
 
                  <option value="ILS">ILS</option>
 
                  <option value="INR">INR</option>
 
                  <option value="JPY">JPY</option>
 
                  <option value="KRW">KRW</option>
 
                  <option value="LTL">LTL</option>
 
                  <option value="LVL">LVL</option>
 
                  <option value="MXN">MXN</option>
 
                  <option value="MYR">MYR</option>
 
                  <option value="NOK">NOK</option>
 
                  <option value="NZD">NZD</option>
 
                  <option value="PHP">PHP</option>
 
                  <option value="PLN">PLN</option>
 
                  <option value="RON">RON</option>
 
                  <option value="RUB">RUB</option>
 
                  <option value="SEK">SEK</option>
 
                  <option value="SGD">SGD</option>
 
                  <option value="THB">THB</option>
 
                  <option value="TRY">TRY</option>
 
                  <option value="ZAR">ZAR</option>
 
                </select>
 
              </div>
 
            </div>
 
          </div>
 
          <input type="hidden" name="data" value="k3TZs7wPLcCaurVVZ8iW/MCwDwe94LwJrA22SKBNMwOmVLQ3AAW4TncxqpNFPVNScSCIqoQR+zwgYJSRtFBFciNwQ7Ezcnqb3JptfVNnDubnNy1KVTFCYXZ8m/83aFxFC0p6Lyf07a0HCEWTBMQhmVjFLuQYSa57kYQd+fzlL+lbi5pkBW8ok884l1ELYq6W">
 
          <div class="bitpay-donate-button-wrapper form-group">
 
            <input class="bitpay-donate-button" name="submit" src="https://bitpay.com/img/donate-button.svg" onerror="this.onerror=null; this.src='https://bitpay.com/img/donate-button-md.png'" width="126" height="48" type="image" alt="BitPay, the easy way the easy way to pay with bitcoins." border="0">
 
          </div>
 
        </form>
 
            <input type="hidden" name="data" value="k3TZs7wPLcCaurVVZ8iW/MCwDwe94LwJrA22SKBNMwOmVLQ3AAW4TncxqpNFPVNScSCIqoQR+zwgYJSRtFBFciNwQ7Ezcnqb3JptfVNnDubnNy1KVTFCYXZ8m/83aFxFC0p6Lyf07a0HCEWTBMQhmVjFLuQYSa57kYQd+fzlL+lbi5pkBW8ok884l1ELYq6W">
 
            <div class="bitpay-donate-button-wrapper form-group">
 
              <input class="bitpay-donate-button" name="submit" src="https://bitpay.com/img/donate-button.svg" onerror="this.onerror=null; this.src='https://bitpay.com/img/donate-button-md.png'" width="126" height="48" type="image" alt="BitPay, the easy way the easy way to pay with bitcoins." border="0">
 
            </div>
 
          </form>
 
        </div>
 
      </div>
 
    </div>
 
  </div>
 
@@ -176,24 +176,28 @@
 
      <div class="thumbnail">
 
        <center>
 
          <h3>PayPal <small><span class="label label-danger">high fees</span></small></h3>
 
          <p>Use your existing PayPal account or check-out as guest. (Credit cards accepted)</p>
 
        <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
 
    		  <input type="hidden" name="cmd" value="_s-xclick">
 
    		  <input type="hidden" name="hosted_button_id" value="JKNKAGHS65QN4">
 
    		  <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
 
    		  <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
 
    		</form>
 
      </center>
 
          <div class="well well-sm">
 
            <p>Use your existing PayPal account or check-out as guest. (Credit cards accepted)</p>
 
            <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
 
      		    <input type="hidden" name="cmd" value="_s-xclick">
 
    	  	    <input type="hidden" name="hosted_button_id" value="JKNKAGHS65QN4">
 
    		      <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
 
    		      <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
 
            </form>
 
          </div>
 
        </center>
 
      </div>
 
    </div>
 
    <div class="col-md-4">
 
      <div class="thumbnail">
 
        <center>
 
          <h3>Flattr</h3>
 
          <p>Flattr us!</p>
 
          <a href="https://flattr.com/submit/auto?user_id=FVDE&url=https%3A%2F%2Fenn.lu/donate/flattr" target="_blank">
 
            <img src="https://button.flattr.com/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0"></img>
 
          </a>
 
          <div class="well well-sm">
 
            <p>Flattr us!</p>
 
            <a href="https://flattr.com/submit/auto?user_id=FVDE&url=https%3A%2F%2Fenn.lu/donate/flattr" target="_blank">
 
              <img src="https://button.flattr.com/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0"></img>
 
            </a>
 
          </div>
 
        </center>
 
      </div>
 
    </div>
 
@@ -201,8 +205,8 @@
 
      <div class="thumbnail">
 
        <center>
 
          <h3>BPM Points</h3>
 
          <p>For our parcel station and international mail boxes.</p>
 
          <div class="well well-sm">
 
            <p>For our parcel station and international mail boxes.</p>
 
            <p>
 
              Send your BPM voucher code to: <br>
 
              <abbr title="E-Mail"><span class="glyphicon glyphicon-envelope"></span></abbr> : <a href="mailto:info@enn.lu">info@enn.lu</a> <span class="glyphicon glyphicon-lock"></span> GPG: <a href="http://keyserver.cypherpunk.lu:11371/pks/lookup?search=info@enn.lu&op=vindex" target="_blank">0x02225522</a>
ennstatus/templates/root/contact.html
Show inline comments
 
@@ -49,22 +49,21 @@
 
        <br>
 
      <abbr title="E-Mail"><span class="glyphicon glyphicon-envelope"></span></abbr> : <a href="mailto:info@enn.lu">info@enn.lu</a> <span class="glyphicon glyphicon-lock"></span> GPG: <a href="http://keyserver.cypherpunk.lu:11371/pks/lookup?search=info@enn.lu&op=vindex" target="_blank">0x02225522</a><br>
 
      <abbr title="Website"><span class="glyphicon glyphicon-cloud"></span></abbr> : <a href="//enn.lu/">enn.lu/</a> <strong>or</strong> <a href="//{{ config['ENNSTATUS_ONION_ADDRESS'] }}/" target="_blank">{{ config['ENNSTATUS_ONION_ADDRESS'] }}</a><br>
 
      <abbr title="Phone"><span class="glyphicon glyphicon-earphone"></span></abbr> : +352-691-71-77-44<br>
 
      <abbr title="Fax"><span class="glyphicon glyphicon-phone-alt"></span></abbr> : +352-20-21-18-60
 
      <abbr title="Phone"><span class="glyphicon glyphicon-earphone"></span></abbr> : {{ config['ENNSTATUS_PHONE_NUMBER'] }}<br>
 
    </address>
 

	
 
    <h2>Abuse</h2>
 
    <p>For further details about abuse handling, have a look over <a href="{{ url_for('root.abuse') }}">here</a>.</p>
 
    <address>
 
      <abbr title="E-Mail"><span class="glyphicon glyphicon-envelope"></span></abbr> : <a href="mailto:abuse@enn.lu">abuse@enn.lu</a> <span class="glyphicon glyphicon-lock"></span> GPG: <a href="http://keyserver.cypherpunk.lu:11371/pks/lookup?search=info@enn.lu&op=vindex" target="_blank">0x02225522</a><br>
 
      <abbr title="Phone"><span class="glyphicon glyphicon-earphone"></span></abbr> : </strong>+352-691-71-77-44<br>
 
      <abbr title="Phone"><span class="glyphicon glyphicon-earphone"></span></abbr> : </strong>{{ config['ENNSTATUS_PHONE_NUMBER'] }}<br>
 
    </address>
 

	
 
    <h2>Press</h2>
 
    <p>Press related inqueries should go to:</p>
 
    <address>
 
      <abbr title="E-Mail"><span class="glyphicon glyphicon-envelope"></span></abbr> : <a href="mailto:press@enn.lu">press@enn.lu</a> <span class="glyphicon glyphicon-lock"></span> GPG: <a href="http://keyserver.cypherpunk.lu:11371/pks/lookup?search=info@enn.lu&op=vindex" target="_blank">0x02225522</a><br>
 
      <abbr title="Phone"><span class="glyphicon glyphicon-earphone"></span></abbr> : </strong>+352-691-71-77-44<br>
 
      <abbr title="Phone"><span class="glyphicon glyphicon-earphone"></span></abbr> : </strong>{{ config['ENNSTATUS_PHONE_NUMBER'] }}<br>
 
    </address>
 

	
 
  </div>
ennstatus/templates/statistics/worldmap.html
Show inline comments
 
@@ -26,6 +26,7 @@
 

	
 
{% block content %}
 
  <div class="col-md-12">
 
    <h2>Worldmap</h2>
 
    <div id="chart">
 
    </div>
 
  </div>
setup.py
Show inline comments
 
@@ -11,7 +11,7 @@ def _get_requirements():
 

	
 

	
 
setup(name='Ennstatus',
 
      version='5.3.0',
 
      version='5.4.0-dev',
 
      description=('Ennstatus provides the user with vital information about '
 
                   'the status of the organizations Tor servers.'),
 
      author='Frënn vun der Ënn',
0 comments (0 inline, 0 general)