Changeset - 7f9dc38d8318
[Not reviewed]
default
0 2 0
Dennis Fink - 10 years ago 2014-12-14 12:01:47
dennis.fink@c3l.lu
Added preliminary support for .bit addresses
2 files changed with 6 insertions and 0 deletions:
0 comments (0 inline, 0 general)
ennstatus/templates/base.html
Show inline comments
 
{% extends "bootstrap/base.html" %}
 

	
 
{% block title %}
 
  Frënn vun der Ënn - {{ title }}
 
{% endblock %}
 

	
 
{% block metas %}
 
  {{ super() }}
 
  <meta charset="utf-8">
 
  <meta name="application-name" content="Ënnstatus">
 
  <meta name="author" content="Frënn vun der Ënn">
 
{% endblock %}
 

	
 
{% block styles %}
 
  {{ super() }}
 
  <link rel="stylesheet" href="{{ url_for('static', filename='css/ennstatus.css') }}" />
 
  <link rel="shortcut icon" href="{{ url_for('static', filename='images/favicon.png') }}">
 
{% endblock %}
 

	
 
{% block body %}
 
<a href="#content" class="sr-only">Skip to main content</a>
 
<div class="container">
 
  {% block navbar %}
 
  <div class="navbar navbar-default">
 
    <div class="navbar-header">
 
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
 
        <span class="icon-bar"></span>
 
        <span class="icon-bar"></span>
 
        <span class="icon-bar"></span>
 
      </button>
 
      <a class="navbar-brand" href="{{ url_for('root.index') }}">Enn.lu</a>
 
    </div>
 
    <div class="navbar-collapse collapse">
 
      <ul class="nav navbar-nav navbar-left">
 
        <li>
 
          {% if '.onion' in request.url_root %}
 
            <a href="//{{ config['ENNSTATUS_WIKI_ONION_ADDRESS'] }}/doku.php?id=news">News</a>
 
          {% elif '.bit' in request.url_root %}
 
            <a href="//{{ config['ENNSTATUS_WIKI_BIT_ADDRESS'] }}/doku.php?id=news">News</a>
 
          {% else %}
 
            <a href="//wiki.enn.lu/doku.php?id=news">News</a>
 
          {% endif %}
 
        </li>
 
        <li>
 
          <a href="{{ url_for('root.about') }}">About</a>
 
        </li>
 
        <li>
 
          <a href="{{ url_for('root.services') }}">Services</a>
 
        </li>
 
        <li class="dropdown">
 
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Donate <b class="caret"></b></a>
 
          <ul class="dropdown-menu">
 
            <li><a href="{{ url_for('donate.index') }}">Support us</a></li>
 
            <li><a href="{{ url_for('donate.wiretransfer') }}">Wiretransfer</a></li>
 
            <li><a href="{{ url_for('donate.snailmail') }}">Snailmail</a></li>
 
            <li><a href="{{ url_for('donate.paypal') }}">PayPal</a></li>
 
            <li><a href="{{ url_for('donate.bitcoin') }}">Bitcoin</a></li>
 
            <li><a href="{{ url_for('donate.flattr') }}">Flattr</a></li>
 
            <li><a href="{{ url_for('donate.bpm') }}">BPM</a></li>
 
            <li class="divider"></li>
 
            <li><a href="{{ url_for('donate.received') }}">Received Donations</a></li>
 
          </ul>
 
        </li>
 
        <li class="dropdown">
 
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Partners <b class="caret"></b/></a>
 
          <ul class="dropdown-menu">
 
            <li><a href="{{ url_for('root.partners') }}">Official Partners</a></li>
 
            <li><a href="{{ url_for('root.bridgeprogram') }}">Bridge Program</a></li>
 
          </ul>
 
        </li>
 
        <li>
 
          <a href="{{ url_for('root.contact') }}">Contact</a>
 
        </li>
 
        <li>
 
          <a href="{{ url_for('root.abuse') }}">Abuse</a>
 
        </li>
 
        <li>
 
          {% if '.onion' in request.url_root %}
 
            <a href="//{{ config['ENNSTATUS_WIKI_ONION_ADDRESS'] }}">Wiki</a>
 
          {% elif '.bit' in request.url_root %}
 
            <a href="//{{ config['ENNSTATUS_WIKI_BIT_ADDRESS'] }}">Wiki</a>
 
          {% else %}
 
            <a href="//wiki.enn.lu">Wiki</a>
 
          {% endif %}
 
       </li>
 
        <li class="dropdown">
 
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Servers <b class="caret"></b></a>
 
          <ul class="dropdown-menu">
 
            <li><a href="{{ url_for('status.index') }}">All nodes</a></li>
 
            <li><a href="{{ url_for('status.exit') }}">Exit nodes</a></li>
 
            <li><a href="{{ url_for('status.relay') }}">Relay nodes</a></li>
 
            <li><a href="{{ url_for('status.bridge') }}">Bridge nodes</a></li>
 
            <li class="divider"></li>
 
            <li><a href="{{ url_for('status.about') }}">Ënnstatus About</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 class="disabled"><a href="#">Statistics</a></li>
 
            <li class="divider"></li>
 
            <li class="dropdown-header">Worldmaps</li>
 
            <li><a href="{{ url_for('stats.worldmap') }}">All nodes</a></li>
 
            <li><a href="{{ url_for('stats.worldmap', server_type='exit') }}">Exit nodes</a></li>
 
            <li><a href="{{ url_for('stats.worldmap', server_type='relay') }}">Relay nodes</a></li>
 
            <li><a href="{{ url_for('stats.worldmap', server_type='bridge') }}">Bridge nodes</a></li>
 
          </ul>
 
        </li>
 
      </ul>
 
      <ul class="nav navbar-nav navbar-right">
 
        <li class="bg-success">
 
          <a href="{{ url_for('root.member') }}">Become a member</a>
 
        </li>
 
      </ul>
 
    </div>
 
  </div>
 
  {% endblock %}
 
  <div class="row" id="content">
 
  {% block content %}
 
  {% endblock %}
 
  </div>
 
  <footer>
 
    <hr style="margin-bottom: 0.5%;">
 
    <div class="col-md-12 text-center">
 
      <a class="pull-left" href="https://twitter.com/FrennVunDerEnn/" target="_blank"><img src="{{ url_for('static', filename='images/Twitter.png') }}" width="45" height="45"></img></a>
 
      <a href="https://bitbucket.org/fvde/ennstatus-relaunched" target="_blank"><img src="{{ url_for('static', filename='images/BitBucket_Logo.png') }}"></img></a>
 
      <a class="pull-right" rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-sa/3.0/88x31.png" /></a>
 
    </div>
 
    <div class="col-md-12 text-center" style="margin-top: 0.5%; margin-bottom: 0.5%;">
ennstatus/templates/status/macros.html
Show inline comments
 
{% macro colorize_status(status) %}
 
  {% if status == "Online" %}
 
    {% set color = "text-success" %}
 
  {% elif status == "Unknown" %}
 
    {% set color = "text-warning" %}
 
  {% else %}
 
    {% set color = "text-danger" %}
 
  {% endif %}
 
  <p class={{ color }}>{{ status }}</p>
 
{% endmacro %}
 

	
 
{% macro colorize_obfs(obfs) %}
 
  {% if obfs %}
 
    {% set color = "text-success" %}
 
  {% else %}
 
    {% set color = "text-danger" %}
 
  {% endif %}
 
  <p class={{ color }}>{{ obfs }}</p>
 
{% endmacro %}
 

	
 
{% macro create_country(country) %}
 
  {% set country_class = "flag-" + country|lower|replace(' ', '-') %}
 
  <i class={{ country_class }}></i> {{ country|title }}
 
{% endmacro %}
 

	
 
{% macro create_fingerprint(fingerprint, server_type) %}
 
  {% if server_type in ('Exit', 'Relay') %}
 
    {% set url_type = 'relay' %}
 
  {% else %}
 
    {% set url_type = 'bridge' %}
 
  {% endif %}
 
  {% if '.onion' in request.url_root %}
 
    {% set url_root = '//%s' % config['ENNSTATUS_GLOBE_ONION_ADDRESS'] %}
 
  {% elif '.bit' in request.url_root %}
 
    {% set url_root = '//%s' % config['ENNSTATUS_GLOBE_BIT_ADDRESS'] %}
 
  {% else %}
 
    {% set url_root = '//globe.enn.lu' %}
 
  {% endif %}
 
  <a href="{{ url_root }}/#/{{ url_type }}/{{ fingerprint }}">{{ fingerprint|upper}}</a>
 
{% endmacro %}
 

	
 
{% macro create_name(name) %}
 
  <a href="http://{{ name|lower }}.enn.lu">{{ name }}</a>
 
{% endmacro %}
 

	
 
{% macro create_server_table(server_type, servers) %}
 
  {% if server_type in ('Exit', 'Relay') %}
 
    {% set headers = ('#', 'Name', 'IP', 'IP6', 'Server Status', 'Tor Status', 'Country', 'Fingerprint', 'Last Updated (UTC)') %}
 
  {% else %}
 
    {% set headers = ('#', 'Name', 'Server Status', 'Tor Status', 'Country', 'Fingerprint', 'OBFS', 'FTEProxy', 'Flashproxy', 'meek', 'Last Updated (UTC)') %}
 
  {% endif %}
 
  <h2>{{ server_type }}</h2>
 
  <table class="table table-bordered table-striped">
 
    <thead>
 
      <tr>
 
        {% for name in headers %}
 
          <th>{{ name }}</th>
 
        {% endfor %}
 
      </tr>
 
    </thead>
 
    <tbody>
 
      {% for server in servers|sort(attribute='server_name')|sort(attribute='country') %}
 
      <tr {% if server['server_name'] in config['ENNSTATUS_BRIDGE_PROGRAM'] %}class="info"{% endif %}>
 
          <td>{{ loop.index }}</td>
 
          {% if server_type in ('Exit', 'Relay') %}
 
            <td>{{ create_name(server['server_name']) }}</td>
 
            <td>{{ server['ip'] }}</td>
 
            <td>{{ server.get('ip6', 'N/A') }}</td>
 
          {% else %}
 
            {% if server['server_name'] in config['ENNSTATUS_BRIDGE_PROGRAM'] %}
 
              <td><a href="{{ url_for('root.bridgeprogram') }}">{{ server['server_name'] }}</a></td>
 
            {% else %}
 
              <td>{{ server['server_name'] }}</td>
 
            {% endif %}
 
          {% endif %}
 
          {% for status in (server['server_status'], server['tor_status']) %}
 
            <td>{{ colorize_status(status) }}</td>
 
          {% endfor %}
 
          <td>{{ create_country(server['country']) }}</td>
 
          <td>{{ create_fingerprint(server['fingerprint'], server['server_type']) }}</td>
 
          {% if server_type == 'Bridge' %}
 
            <td>{{ colorize_obfs(server['obfs']) }}</td>
 
            <td>{{ colorize_obfs(server['fteproxy']) }}</td>
0 comments (0 inline, 0 general)