{# Ë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 . #} {% macro colorize_status(status) %} {% if status %} {% set color = "text-success" %} {% elif status is none %} {% set color = "text-warning" %} {% else %} {% set color = "text-danger" %} {% endif %}

{{ status }}

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

{{ obfs }}

{% endmacro %} {% macro create_country(country) %} {% set country_class = "flag-" + country|lower|replace(' ', '-') %} {{ 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 = '//atlas.enn.lu' %} {% endif %} {{ fingerprint|upper}} {% endmacro %} {% macro create_name(name) %} {{ name }} {% endmacro %} {% macro create_date(date) %} {{ moment(date).format(config['ENNSTATUS_MOMENTJS_FORMAT']) }} {% endmacro %} {% macro create_server_table(server_type, servers) %} {% if server_type in ('exit', 'relay') %} {% set headers = ('#', 'Name', 'IP', 'IP6', 'Tor Status', 'Country', 'Fingerprint', 'Last Updated ') %} {% else %} {% set headers = ('#', 'Name', 'Tor Status', 'Country', 'Fingerprint', 'OBFS', 'FTEProxy', 'Flashproxy', 'meek', 'Last Updated ') %} {% endif %}

{{ server_type|title }}

{% for name in headers %} {% endfor %} {% for server in servers|sort(attribute='name')|sort(attribute='country') %} {% if server_type in ('exit', 'relay') %} {% else %} {% endif %} {% if server_type == 'bridge' %} {% endif %} {% endfor %}
{{ name|safe }}
{{ loop.index }}{{ create_name(server.name) }} {{ server.ip }} {{ server.ip6 or 'N/A' }} {% if server.name in config['ENNSTATUS_BRIDGE_PROGRAM'] %} {{ server.name }} {% else %} {{ server.name }} {% endif %} {{ colorize_status(server.status) }} {{ create_country(server.country) }} {{ create_fingerprint(server.fingerprint, server.type) }}{{ colorize_obfs(server.obfs) }} {{ colorize_obfs(server.fteproxy) }} {{ colorize_obfs(server.flashproxy) }} {{ colorize_obfs(server.meek) }}{{ create_date(server.last_updated) }}
{% if server_type == 'bridge' %} {% endif %} {% endmacro %}