fix: Update parsing of history to fix issues
All checks were successful
Build Docker / BuildImage (push) Successful in 37s

This commit is contained in:
2024-09-12 20:13:29 +10:00
parent fa78390fc7
commit d0d3de0a1e
5 changed files with 235 additions and 35 deletions

View File

@@ -4,8 +4,8 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HNSDoH Status</title>
<link rel="icon" href="/favicon.png" type="image/png">
<title>Status | HNS DoH</title>
<link rel="icon" href="/assets/img/HNS.png" type="image/png">
<link rel="stylesheet" href="/assets/css/404.css">
</head>

45
templates/api.html Normal file
View File

@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API | HNS DoH</title>
<link rel="icon" href="/assets/img/HNS.png" type="image/png">
<link rel="stylesheet" href="/assets/css/api.css">
</head>
<body>
<div class="spacer"></div>
<div class="centre">
{% if endpoints %}
<h1 style="font-size: xx-large;">API Info</h1>
<p>Available endpoints:</p>
<ul style="width: fit-content;margin: auto;">
{% for endpoint in endpoints %}
<li class="top">
<strong>{{ endpoint.route }}</strong> - {{ endpoint.description }}
{% if endpoint.parameters %}
<ul>
<li><em>Parameters:</em></li>
{% for param in endpoint.parameters %}
<li>
<strong>{{ param.name }}:</strong>
({{ param.type }}) - {{ param.description }}
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
{% else %}
<h1>404 | Page not found</h1>
<p>Sorry, the page you are looking for does not exist.</p>
<p><a href="/">Go back to the homepage</a></p>
{% endif %}
</div>
</body>
</html>

View File

@@ -0,0 +1,66 @@
body {
background-color: #000000;
color: #ffffff;
}
.centre {
text-align: center;
margin-top: 10px;
}
h1 {
font-size: 100px;
margin: 0;
padding: 0;
}
p {
font-size: 18px;
font-weight: bold;
color: #ffffff;
}
ul {
list-style-type: none; /* Remove bullet points */
padding: 0;
margin: 0;
}
li {
margin-bottom: 15px;
}
/* Style for the route names */
li strong {
color: #9ccdff; /* Darker shade for route names */
font-size: 16px;
}
/* Style for descriptions */
li em {
font-size: 14px;
color: #ffa44f; /* Lighter shade for parameter labels */
}
/* Nested parameter list */
li ul {
margin-left: 20px;
margin-top: 8px;
}
li ul li {
font-size: 14px;
color: #cfcfcf; /* Parameter details */
}
/* Styling parameter names */
li ul li strong {
color: #3498db; /* Light blue for parameter names */
}
/* Add a subtle hover effect */
li.top:hover {
/* Invert colours */
filter: invert(1);
background-color: #000000;
border-left: 4px solid #3498db;
padding-left: 10px;
transition: all 0.3s ease;
}

View File

@@ -111,12 +111,12 @@
</div>
<div class="node-info">
<h5>Stats</h5>
<p>Plain DNS: {{history.nodes[node.name].plain_dns.percentage}}% uptime (last down
{{history.nodes[node.name].plain_dns.last_down}})</p>
<p>DNS over HTTPS: {{history.nodes[node.name].doh.percentage}}% uptime (last down
{{history.nodes[node.name].doh.last_down}})</p>
<p>DNS over TLS: {{history.nodes[node.name].dot.percentage}}% uptime (last down
{{history.nodes[node.name].dot.last_down}})</p>
<p>Plain DNS: {{history.nodes[node.ip].plain_dns.percentage}}% uptime (last down
{{history.nodes[node.ip].plain_dns.last_down}})</p>
<p>DNS over HTTPS: {{history.nodes[node.ip].doh.percentage}}% uptime (last down
{{history.nodes[node.ip].doh.last_down}})</p>
<p>DNS over TLS: {{history.nodes[node.ip].dot.percentage}}% uptime (last down
{{history.nodes[node.ip].dot.last_down}})</p>
</div>
<div class="node-info">
<p style="font-weight: bold;">{{node.name}}: {{node.ip}}</p>