mirror of
https://github.com/4cuck/nitter-status.git
synced 2026-10-27 00:57:39 +00:00
136 lines
5.9 KiB
Django/Jinja
136 lines
5.9 KiB
Django/Jinja
{# SPDX-License-Identifier: AGPL-3.0-only #}
|
|
<!DOCTYPE html>
|
|
<html lang="en" data-bs-theme="dark">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<link href="/static/bootstrap.min.css" rel="stylesheet">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Nitter Instance Health</title>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>Nitter Instance Uptime & Health</h1>
|
|
<p><a href="/about">About</a></p>
|
|
<p>Please use <a rel="nofollow" href="/api/v1/instances">/api/v1/instances</a> for bots.</p>
|
|
<p>Last Updated {{last_updated}} <a rel="nofollow" href="https://time.is/UTC">UTC</a>.</p>
|
|
<div class="table-responsive">
|
|
<table class="table sortable">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Instance</th>
|
|
<th scope="col">Country</th>
|
|
<th scope="col">Healthy</th>
|
|
<th scope="col">Response Times</th>
|
|
<th scope="col">Average (ms)</th>
|
|
<th scope="col">RSS</th>
|
|
<th scope="col">Version</th>
|
|
<th scope="col">Points</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for host in instances -%}
|
|
<tr>
|
|
<td><a rel="nofollow external" href="{{host.url}}">{{host.domain}}</a></td>
|
|
<td>{{host.country}}</td>
|
|
<td>
|
|
{%- if host.is_bad_host -%}
|
|
<div title="Host known for blocking healthchecks">❓</div>
|
|
{%- elif host.healthy -%}
|
|
✅
|
|
{%- else -%}
|
|
❌
|
|
{%- endif -%}</td>
|
|
<td>
|
|
{%- if host.recent_pings|length > 0 -%}
|
|
{%- set height = 57 -%}
|
|
{%- set width = 100 -%}
|
|
{%- set amount = host.recent_pings|length -%}
|
|
{%- set width_bar = width / amount -%}
|
|
{%- set offset = 5 -%}
|
|
{%- set error_size = height / 3 %}
|
|
{%- if host.ping_max and host.ping_min -%}
|
|
{# only one entry, so max = min => step_size would be 0 #}
|
|
{%- if host.ping_max == host.ping_min -%}
|
|
{%- set step_size = 5/(height-offset) -%}
|
|
{%- else -%}
|
|
{%- set step_size = (host.ping_max - host.ping_min)/(height-offset) -%}
|
|
{%- endif -%}
|
|
{%- else %}
|
|
{# no valid entries, only nulls #}
|
|
{%- set step_size = 5/(height-offset) -%}
|
|
{%- endif -%}
|
|
{# <!-- step size {{step_size}} -->
|
|
<!-- ping_max {{host.ping_max}} -->
|
|
<!-- ping_min {{host.ping_min}} --> #}
|
|
{%- if host.ping_min -%}
|
|
<svg viewBox="0 0 182 56" width="{{width - 1}}" height="{{height - 1}}">
|
|
{%- if host.ping_avg and host.ping_min -%}
|
|
{%- set avg_pos = (height-(host.ping_avg - host.ping_min )/step_size) - offset -%}
|
|
<line x1="1" x2="181" y1="{{avg_pos}}" y2="{{avg_pos}}" stroke="black" stroke-width="0.72727275" stroke-linecap="butt" stroke-opacity="0.3"><title>Average</title></line>
|
|
{%- endif -%}
|
|
{%- for ping in host.recent_pings -%}
|
|
{%- if ping -%}
|
|
{%- set height_bar = (ping - host.ping_min )/step_size + offset -%}
|
|
{%- set color_bar = "#a09df2" -%}
|
|
{%- else -%}
|
|
{%- set height_bar = error_size -%}
|
|
{%- set color_bar = "#cc0000" -%}
|
|
{%- endif -%}
|
|
<rect x="{{(loop.index-1) * width_bar}}" y="{{height - height_bar - offset}}" width="{{width_bar}}" height="{{height_bar}}" fill="{{color_bar}}" fill-opacity="0.95"><title>{{ping | default(value="unhealthy") }}</title></rect>
|
|
{%- endfor -%}
|
|
</svg>
|
|
{%- else -%}
|
|
{# <!-- no healthy entries, show last time host was seen healthy --> #}
|
|
{%- if host.last_healthy -%}
|
|
Last seen healthy: {{host.last_healthy | truncate(length=10, end="") | replace(from="-", to=".")}}
|
|
{%- else -%}
|
|
Never seen healthy.
|
|
{%- endif -%}
|
|
{%- endif -%}
|
|
{%- else -%}
|
|
No recent data!
|
|
{%- endif -%}
|
|
</td>
|
|
<td>{{host.ping_avg}}</td>
|
|
<td>{% if host.rss -%} ✅ {%- else -%} ❌ {%- endif -%}</td>
|
|
{%- if host.healthy and not host.version -%}
|
|
{%- set version = "Dmissing" -%}
|
|
{%- elif host.version and not host.is_upstream -%}
|
|
{%- set version = "Aforeign" -%}
|
|
{%- elif host.is_latest_version -%}
|
|
{%- set version = "Blatest" -%}
|
|
{%- elif host.version and not host.is_latest_version -%}
|
|
{%- set version = "Coutdated" -%}
|
|
{%- else -%}
|
|
{%- set version = "Eunknown" -%}
|
|
{%- endif -%}
|
|
<td data-sort="{{version}}{{host.version | default(value='')}}">
|
|
{%- if host.version_url -%}
|
|
<a href="{{host.version_url}}">
|
|
{{host.version | default(value="missing version")}}
|
|
</a>
|
|
{%- else -%}
|
|
<a href="{{host.url ~ '/about'}}">missing version</a>
|
|
{%- endif -%}
|
|
{%- if version == "Dmissing" -%}
|
|
<span class="ms-1 badge bg-warning">missing</span>
|
|
{%- elif version == "Aforeign" -%}
|
|
<span class="ms-1 badge bg-secondary">foreign repo</span>
|
|
{%- elif version == "Blatest" -%}
|
|
<span class="ms-1 badge bg-success">latest</span>
|
|
{%- elif version == "Coutdated" -%}
|
|
<span class="ms-1 badge bg-info">outdated</span>
|
|
{%- endif -%}
|
|
</td>
|
|
<td>{{host.points}}</td>
|
|
</tr>
|
|
{%- endfor -%}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<script src="/static/bootstrap.min.js"></script>
|
|
<link href="/static/sorting.css" rel="stylesheet" />
|
|
<script src="/static/sortable.min.js"></script>
|
|
</body>
|
|
</html> |