aboutsummaryrefslogtreecommitdiff
path: root/tor-metrics/templates/base.html
blob: 4f75ab191b57da590054bc8f5f9dbf3540b046df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html lang="en">
    {% block head %}
    <head>
        <title>{% block title %}{% endblock %}</title>
        <meta name="description" content="Javascript-free Tor metrics generated from an hourly API request.">
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="{{ path_prefix }}static/css/bootstrap.min.css">
    </head>
    {% endblock %}
    <body>
        <div class="container">
            <h2>{% block header %}{% endblock %}</h2>
            <p>{% block description %}{% endblock %}</p>
            <table class="table table-condensed">
                <tr>
                    <th>Nickname</th>
                    <th>Bandwidth</th>
                    <th class="visible-md visible-lg">IP Address</th>
                    <th>AS Number</th>
                    <th>AS Name</th>
                    <th>Country</th>
                    <th>Platform</th>
                    <th>Flags</th>
                    <th class="visible-md visible-lg">Running</th>
                    <th class="visible-md visible-lg">First Seen</th>
                </tr>
                <tbody>
                    {% if is_index %}{% set relay_list = relays.json['relays'][:500] %}
                    {% else %}{% set relay_list = relays %}{% endif %}
                    {% for relay in relay_list %}
                    <tr>
                        {% if relay['observed_bandwidth'] > 1000000 %}
                        {% set obs_bandwidth = '%s %s'|format((relay['observed_bandwidth'] / 1000000)|round(2, 'common'), 'MB/s') %}
                        {% else %}
                        {% set obs_bandwidth = '%s %s'|format((relay['observed_bandwidth'] / 1000)|round(2, 'common'), 'KB/s') %}{% endif %}

                        {% if category != 'family' and relay['effective_family']|length > 1 %}
                        <td>{{ relay['nickname'] }} (<a href="{{ path_prefix }}family/{{ relay['effective_family'][0] }}/">{{ relay['effective_family']|length }}</a>)</td>
                        {% else %}
                        <td>{{ relay['nickname'] }}</td>{% endif %}
                        <td>{{ obs_bandwidth }}</td>
                        <td class="visible-md visible-lg">{{ relay['or_addresses'][0].split(':', 1)[0] }}</td>

                        {% if relay['as'] %}{% if focused != 'as' %}
                        <td><a href="{{ path_prefix }}as/{{ relay['as'] }}/">{{ relay['as'] }}</a></td>
                        {% else %}
                        <td>{{ relay['as'] }}</td>{% endif %}
                        {% else %}
                        <td>Unknown</td>{% endif %}
                        
                        {% if relay['as_name'] %}
                        <td><a href="https://bgp.he.net/{{ relay['as'] }}" title="{{ relay['as_name'] }}">{{ relay['as_name'] |truncate(length=20) }}</a></td>
                        {% else %}
                        <td>Unknown</td>{% endif %}
                        
                        {% if relay['country'] %}{% if focused != 'country' %}
                        <td><a href="{{ path_prefix }}country/{{ relay['country'] }}/"><img src="{{ path_prefix }}static/images/cc/{{ relay['country'] }}.png" title="{{ relay['country_name'] }}" alt="{{ relay['country_name'] }}"></a></td>
                        {% else %}
                        <td><img src="{{ path_prefix }}static/images/cc/{{ relay['country'] }}.png" title="{{ relay['country_name'] }}" alt="{{ relay['country_name'] }}"></td>{% endif %}
                        {% else %}
                        <td>X</td>{% endif %}
                        
                        {% if focused != 'platform' %}
                        <td><a href="{{ path_prefix }}platform/{{ relay['platform'] }}/">{{ relay['platform'] }}</a></td>
                        {% else %}
                        <td>{{ relay['platform'] }}</td>{% endif %}
                        
                        <td>{% for flag in relay['flags'] %}{% if flag != 'StaleDesc' %}<img src="{{ path_prefix}}static/images/flags/{{ flag.lower() }}.png" title="{{ flag }}" alt="{{ flag }}"> {% endif %}{% endfor %}</td>

                        {% if relay['running'] %}
                        <td class="visible-md visible-lg"><font color="green">True</font></td>
                        {% else %}
                        <td class="visible-md visible-lg"><font color="red">False</font></td>{% endif %}
                        
                        <td class="visible-md visible-lg">{{ relay['first_seen'].split(' ', 1)[0] }}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            <p>Country flags provided by <a href="https://github.com/gosquared/flags">GoSquared</a>, relay flags by the <a href="https://gitweb.torproject.org/metrics-web.git/">Tor Project</a>.</p>
        </div>
    </body>
</html>