2024-12-01 03:35:04 +01:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
<link crossorigin rel="stylesheet" href="https://cdn.alemi.dev/web/alemi.css">
|
2024-12-10 11:27:10 +01:00
|
|
|
|
<title>upp</title>
|
2024-12-01 03:35:04 +01:00
|
|
|
|
<style>
|
|
|
|
|
span.cell {
|
2024-12-03 01:24:23 +01:00
|
|
|
|
position: relative;
|
2024-12-01 03:35:04 +01:00
|
|
|
|
display: inline-block;
|
2024-12-03 01:24:23 +01:00
|
|
|
|
width: .5rem;
|
|
|
|
|
height: 1.2rem;
|
2024-12-01 03:35:04 +01:00
|
|
|
|
border: 1px solid var(--secondary);
|
2024-12-03 01:24:23 +01:00
|
|
|
|
font-size: 8pt;
|
|
|
|
|
line-height: 1.2rem;
|
2024-12-01 03:35:04 +01:00
|
|
|
|
background-color: rgba(var(--secondary-rgb), 0.4);
|
2024-12-03 01:24:23 +01:00
|
|
|
|
margin-top: .3rem;
|
|
|
|
|
margin-bottom: .3rem;
|
2024-12-01 03:35:04 +01:00
|
|
|
|
padding-top: 0;
|
|
|
|
|
padding-bottom: 0;
|
|
|
|
|
transition: .1s;
|
|
|
|
|
text-align: center;
|
|
|
|
|
cursor: default;
|
2024-12-03 01:24:23 +01:00
|
|
|
|
border-radius: .3rem;
|
|
|
|
|
color: #ffffff00;
|
2024-12-01 03:35:04 +01:00
|
|
|
|
}
|
|
|
|
|
span.cell:hover {
|
2024-12-03 01:24:23 +01:00
|
|
|
|
padding-top: .3rem;
|
|
|
|
|
padding-bottom: .3rem;
|
|
|
|
|
width: 2rem;
|
|
|
|
|
font-size: 8pt;
|
2024-12-01 03:35:04 +01:00
|
|
|
|
margin-top: 0;
|
|
|
|
|
margin-bottom: 0;
|
2024-12-03 01:24:23 +01:00
|
|
|
|
margin-right: -0.75rem;
|
|
|
|
|
margin-left: -0.75rem;
|
|
|
|
|
color: var(--background);
|
|
|
|
|
background-color: rgba(var(--secondary-rgb), 1);
|
|
|
|
|
z-index: 1;
|
|
|
|
|
font-weight: bold;
|
2024-12-01 03:35:04 +01:00
|
|
|
|
}
|
2024-12-01 04:36:31 +01:00
|
|
|
|
span.cell.warning {
|
|
|
|
|
border-color: var(--accent);
|
|
|
|
|
}
|
|
|
|
|
span.cell.error {
|
|
|
|
|
border-color: var(--accent);
|
2024-12-01 03:35:04 +01:00
|
|
|
|
background-color: rgba(var(--accent-rgb), 0.4);
|
|
|
|
|
}
|
2024-12-03 01:24:23 +01:00
|
|
|
|
span.cell.error:hover {
|
|
|
|
|
background-color: rgba(var(--accent-rgb), 1);
|
|
|
|
|
}
|
2024-12-03 03:30:55 +01:00
|
|
|
|
span.sep {
|
|
|
|
|
color: var(--background-secondary);
|
|
|
|
|
margin-right: 1em;
|
|
|
|
|
margin-left: 1em;
|
|
|
|
|
}
|
2024-12-01 03:35:04 +01:00
|
|
|
|
hr.color {
|
|
|
|
|
color: var(--accent);
|
|
|
|
|
border-color: var(--accent);
|
|
|
|
|
}
|
2024-12-03 01:24:23 +01:00
|
|
|
|
div.card {
|
|
|
|
|
display: inline-block;
|
2024-12-01 04:23:59 +01:00
|
|
|
|
white-space: nowrap;
|
2024-12-03 01:24:23 +01:00
|
|
|
|
overflow-x: scroll;
|
|
|
|
|
max-width: 100%;
|
|
|
|
|
margin-top: 2em;
|
|
|
|
|
border-radius: 1em;
|
|
|
|
|
border: 1px solid var(--background-secondary);
|
|
|
|
|
padding: 1em;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
transition: .3s;
|
2024-12-03 21:05:18 +01:00
|
|
|
|
text-align: left;
|
2024-12-03 01:24:23 +01:00
|
|
|
|
}
|
|
|
|
|
div.card:hover {
|
|
|
|
|
background-color: var(--background-dim);
|
2024-12-01 04:23:59 +01:00
|
|
|
|
}
|
2024-12-03 03:30:55 +01:00
|
|
|
|
body {
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
2024-12-03 21:05:18 +01:00
|
|
|
|
main {
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
2024-12-03 03:30:55 +01:00
|
|
|
|
footer {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
div.content {
|
|
|
|
|
min-height: calc(100vh - 3.5rem);
|
|
|
|
|
}
|
2024-12-03 20:09:35 +01:00
|
|
|
|
span.dots {
|
|
|
|
|
&:after {
|
|
|
|
|
animation: dots 1.5s linear infinite;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
content: "\00a0\00a0\00a0";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@keyframes dots {
|
|
|
|
|
0% { content: "\00a0\00a0\00a0"; }
|
|
|
|
|
25% { content: ".\00a0\00a0"; }
|
|
|
|
|
50% { content: "..\00a0"; }
|
|
|
|
|
75% { content: "..."; }
|
|
|
|
|
100% { content: "\00a0\00a0\00a0"; }
|
|
|
|
|
}
|
|
|
|
|
.grid {
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
|
}
|
2024-12-01 03:35:04 +01:00
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
2024-12-03 03:30:55 +01:00
|
|
|
|
<div class="content">
|
|
|
|
|
<div class="ml-1">
|
2024-12-10 11:27:10 +01:00
|
|
|
|
<h1 class="mt-0 pt-1">upp</h1>
|
2024-12-03 03:30:55 +01:00
|
|
|
|
<p>%%DESCRIPTION%%</p>
|
|
|
|
|
</div>
|
|
|
|
|
<hr class="color"/>
|
2024-12-01 03:35:04 +01:00
|
|
|
|
|
2024-12-10 11:15:34 +01:00
|
|
|
|
<main id="upp-content">
|
2024-12-03 20:09:35 +01:00
|
|
|
|
<h2 class="center mt-3">loading<span class="dots"></span></h2>
|
2024-12-03 03:30:55 +01:00
|
|
|
|
</main>
|
|
|
|
|
</div>
|
2024-12-01 03:35:04 +01:00
|
|
|
|
|
2024-12-03 03:30:55 +01:00
|
|
|
|
<footer>
|
|
|
|
|
<hr />
|
|
|
|
|
<p class="mt-s mb-s">
|
|
|
|
|
<span class="cell error">...</span> down <span class="sep">|</span>
|
|
|
|
|
<span class="cell warning">...</span> slow <span class="sep">|</span>
|
|
|
|
|
<span class="cell">...</span> up
|
|
|
|
|
</p>
|
|
|
|
|
</footer>
|
2024-12-01 03:35:04 +01:00
|
|
|
|
</body>
|
|
|
|
|
<script>
|
|
|
|
|
function cell(timestamp, rtt) {
|
|
|
|
|
let d = new Date(timestamp * 1000);
|
2024-12-01 04:36:31 +01:00
|
|
|
|
let warning = "";
|
2024-12-03 01:58:49 +01:00
|
|
|
|
if (rtt !== null && rtt >= %%THRESHOLD%%) {
|
2024-12-01 04:36:31 +01:00
|
|
|
|
warning = " warning";
|
|
|
|
|
}
|
2024-12-01 03:35:04 +01:00
|
|
|
|
if (rtt === null) {
|
2024-12-03 01:24:23 +01:00
|
|
|
|
return `<span class="cell error" title="${d}">╳</span>`;
|
2024-12-01 03:35:04 +01:00
|
|
|
|
} else {
|
2024-12-01 04:36:31 +01:00
|
|
|
|
return `<span class="cell${warning}" title="${rtt}ms -- ${d}">${rtt}</span>`;
|
2024-12-01 03:35:04 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-02 23:44:27 +01:00
|
|
|
|
function card(key, history, last_rtt) {
|
2024-12-01 03:35:04 +01:00
|
|
|
|
let bar = "";
|
2024-12-03 03:06:16 +01:00
|
|
|
|
let now = Math.floor(Date.now() / 1000);
|
2024-12-03 20:09:35 +01:00
|
|
|
|
let first = history[history.length - 1][0];
|
2024-12-10 19:04:20 +01:00
|
|
|
|
let last = history[0][0];
|
|
|
|
|
let min_ago = (now - last) / 60;
|
2024-12-03 03:06:16 +01:00
|
|
|
|
let hrs_ago = (now - first) / 3600;
|
2024-12-01 03:35:04 +01:00
|
|
|
|
for (let el of history) {
|
|
|
|
|
bar += cell(el[0], el[1]);
|
|
|
|
|
}
|
|
|
|
|
return `<div class="card">
|
2024-12-03 01:24:23 +01:00
|
|
|
|
<h3 class="mt-0">${key} <code class="color">${last_rtt ? last_rtt + 'ms' : 'DOWN'}</code></h3>
|
2024-12-03 20:09:35 +01:00
|
|
|
|
<table class="align">
|
|
|
|
|
<tr>
|
|
|
|
|
<td colspan="2">${bar}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
2024-12-10 19:04:20 +01:00
|
|
|
|
<td><small>^ ~${min_ago.toFixed(0)}min ago</small></td>
|
2024-12-03 20:09:35 +01:00
|
|
|
|
<td class="rev"><small>~${hrs_ago.toFixed(1)}h ago ^</small></td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
2024-12-03 01:24:23 +01:00
|
|
|
|
</div>`;
|
2024-12-01 03:35:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
2024-12-10 11:15:34 +01:00
|
|
|
|
const main = document.getElementById("upp-content");
|
2024-12-03 20:34:07 +01:00
|
|
|
|
const batchsize = (new URLSearchParams(window.location.search)).get('batch') || '%%BATCHSIZE%%';
|
2024-12-01 03:35:04 +01:00
|
|
|
|
|
|
|
|
|
async function updateStatus() {
|
|
|
|
|
let res = await fetch("/api/status")
|
|
|
|
|
let status = await res.json()
|
2024-12-03 01:24:23 +01:00
|
|
|
|
if (status.error) {
|
|
|
|
|
console.error("server error:", status);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-01 03:35:04 +01:00
|
|
|
|
let keys = Object.keys(status);
|
|
|
|
|
keys.sort();
|
|
|
|
|
|
|
|
|
|
let out = "";
|
|
|
|
|
|
|
|
|
|
for (let key of keys) {
|
2024-12-03 20:34:07 +01:00
|
|
|
|
let res = await fetch(`/api/status/${key}?limit=${batchsize}`);
|
2024-12-01 03:35:04 +01:00
|
|
|
|
let history = await res.json();
|
2024-12-02 23:44:27 +01:00
|
|
|
|
out += card(key, history, status[key]);
|
2024-12-03 01:24:23 +01:00
|
|
|
|
out += "\n";
|
2024-12-01 03:35:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main.innerHTML = out;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-03 20:34:07 +01:00
|
|
|
|
setInterval(updateStatus, 5 * 60 * 1000)
|
2024-12-01 03:35:04 +01:00
|
|
|
|
updateStatus()
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
</html>
|
|
|
|
|
|