aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan <me@jordan.im>2020-02-17 14:36:27 -0700
committerJordan <me@jordan.im>2020-02-17 14:36:27 -0700
commit243e126fb80a475aef51f9b0cbe3dd8c7b228f20 (patch)
treef723fc81b0293067a9fdd1253ffb0fe01fbd4cb6
parent0881b659d967a2d7f1725a32e2e95a8cbaf6d401 (diff)
downloadallium-243e126fb80a475aef51f9b0cbe3dd8c7b228f20.tar.gz
allium-243e126fb80a475aef51f9b0cbe3dd8c7b228f20.zip
truncate long platforms, flag links globally
-rw-r--r--tor-metrics/relays.py1
-rw-r--r--tor-metrics/templates/relay-info.html2
-rw-r--r--tor-metrics/templates/relay-list.html4
3 files changed, 4 insertions, 3 deletions
diff --git a/tor-metrics/relays.py b/tor-metrics/relays.py
index c8b94ea..8b28f56 100644
--- a/tor-metrics/relays.py
+++ b/tor-metrics/relays.py
@@ -69,6 +69,7 @@ class Relays:
'''
for relay in json_data['relays']:
relay['platform'] = relay['platform'].split(' on ', 1)[1].split(' ')[0]
+ relay['platform'] = relay['platform'].split('/')[-1] # GNU/*
return json_data
def fix_missing_observed_bandwidth(self, json_data):
diff --git a/tor-metrics/templates/relay-info.html b/tor-metrics/templates/relay-info.html
index cfa974a..1b3df1a 100644
--- a/tor-metrics/templates/relay-info.html
+++ b/tor-metrics/templates/relay-info.html
@@ -114,7 +114,7 @@
<dd>
{% for flag in relay['flags'] %}
{% if flag != 'StaleDesc' %}
- <img src="{{ path_prefix}}static/images/flags/{{ flag.lower()|escape }}.png" title="{{ flag|escape }}" alt="{{ flag|escape }}"> {{ flag|escape }}
+ <a href="{{ path_prefix }}flag/{{ flag.lower()|escape }}"><img src="{{ path_prefix}}static/images/flags/{{ flag.lower()|escape }}.png" title="{{ flag|escape }}" alt="{{ flag|escape }}"></a> {{ flag|escape }}
{% endif %}
{% endfor %}
</dd>
diff --git a/tor-metrics/templates/relay-list.html b/tor-metrics/templates/relay-list.html
index 475ee75..024e658 100644
--- a/tor-metrics/templates/relay-list.html
+++ b/tor-metrics/templates/relay-list.html
@@ -54,9 +54,9 @@
<td>X</td>{% endif %}
{% if deactivate != 'platform' %}
- <td><a href="{{ path_prefix }}platform/{{ relay['platform']|escape }}/">{{ relay['platform']|escape }}</a></td>
+ <td><a href="{{ path_prefix }}platform/{{ relay['platform']|escape }}/">{{ relay['platform']|truncate(length=10)|escape }}</a></td>
{% else %}
- <td>{{ relay['platform']|escape }}</td>{% endif %}
+ <td>{{ relay['platform']|truncate(length=10)|escape }}</td>{% endif %}
<td>{% for flag in relay['flags'] %}{% if flag != 'StaleDesc' %}<a href="{{ path_prefix }}flag/{{ flag.lower()|escape }}"><img src="{{ path_prefix}}static/images/flags/{{ flag.lower()|escape }}.png" title="{{ flag|escape }}" alt="{{ flag|escape }}"></a> {% endif %}{% endfor %}</td>