197 lines
6.6 KiB
HTML
197 lines
6.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>DRB Edge Node</title>
|
|
<style>
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
|
|
body {
|
|
font-family: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
|
|
background: #0f1117;
|
|
color: #e2e8f0;
|
|
min-height: 100vh;
|
|
padding: 2rem;
|
|
}
|
|
|
|
h1 { font-size: 1.25rem; font-weight: 600; color: #f8fafc; margin-bottom: 0.25rem; }
|
|
.subtitle { font-size: 0.8rem; color: #64748b; margin-bottom: 2rem; }
|
|
|
|
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
|
|
|
|
.card {
|
|
background: #1e2130;
|
|
border: 1px solid #2d3250;
|
|
border-radius: 8px;
|
|
padding: 1.25rem;
|
|
}
|
|
.card-title {
|
|
font-size: 0.7rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.08em;
|
|
color: #64748b;
|
|
margin-bottom: 0.75rem;
|
|
}
|
|
|
|
.badge {
|
|
display: inline-block;
|
|
padding: 0.2rem 0.6rem;
|
|
border-radius: 999px;
|
|
font-size: 0.75rem;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.05em;
|
|
}
|
|
.badge-online { background: #14532d; color: #4ade80; }
|
|
.badge-offline { background: #450a0a; color: #f87171; }
|
|
.badge-recording { background: #431407; color: #fb923c; animation: pulse 1.5s infinite; }
|
|
.badge-unconfigured { background: #1e1b4b; color: #818cf8; }
|
|
|
|
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
|
|
|
|
.row { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid #2d3250; }
|
|
.row:last-child { border-bottom: none; }
|
|
.row .label { font-size: 0.78rem; color: #94a3b8; }
|
|
.row .value { font-size: 0.78rem; color: #e2e8f0; text-align: right; max-width: 60%; word-break: break-all; }
|
|
|
|
.listen-btn {
|
|
display: block;
|
|
width: 100%;
|
|
margin-top: 0.75rem;
|
|
padding: 0.6rem;
|
|
background: #2563eb;
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 6px;
|
|
font-size: 0.8rem;
|
|
font-family: inherit;
|
|
cursor: pointer;
|
|
text-align: center;
|
|
text-decoration: none;
|
|
}
|
|
.listen-btn:hover { background: #1d4ed8; }
|
|
|
|
.config-section { margin-top: 1.5rem; }
|
|
.config-section h2 { font-size: 0.85rem; color: #94a3b8; margin-bottom: 1rem; }
|
|
|
|
.alert {
|
|
background: #1e1b4b;
|
|
border: 1px solid #4338ca;
|
|
border-radius: 6px;
|
|
padding: 0.75rem 1rem;
|
|
font-size: 0.8rem;
|
|
color: #818cf8;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.updated { font-size: 0.7rem; color: #475569; margin-top: 2rem; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1 id="node-name">DRB Edge Node</h1>
|
|
<p class="subtitle" id="node-id">Loading…</p>
|
|
|
|
<div class="grid">
|
|
<div class="card">
|
|
<div class="card-title">Status</div>
|
|
<div class="row">
|
|
<span class="label">State</span>
|
|
<span class="value"><span id="status-badge" class="badge">—</span></span>
|
|
</div>
|
|
<div class="row">
|
|
<span class="label">MQTT</span>
|
|
<span class="value" id="mqtt-status">—</span>
|
|
</div>
|
|
<div class="row">
|
|
<span class="label">Discord</span>
|
|
<span class="value" id="discord-status">—</span>
|
|
</div>
|
|
<div class="row">
|
|
<span class="label">Recording</span>
|
|
<span class="value" id="recording-status">—</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-title">Current Call</div>
|
|
<div class="row">
|
|
<span class="label">Talkgroup</span>
|
|
<span class="value" id="tgid">—</span>
|
|
</div>
|
|
<div class="row">
|
|
<span class="label">Call ID</span>
|
|
<span class="value" id="call-id">—</span>
|
|
</div>
|
|
<div class="row">
|
|
<span class="label">System</span>
|
|
<span class="value" id="system-id">—</span>
|
|
</div>
|
|
<div class="row">
|
|
<span class="label">OP25</span>
|
|
<span class="value" id="op25-status">—</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-title">Node Info</div>
|
|
<div class="row">
|
|
<span class="label">Lat / Lon</span>
|
|
<span class="value" id="location">—</span>
|
|
</div>
|
|
<div class="row">
|
|
<span class="label">Configured</span>
|
|
<span class="value" id="configured">—</span>
|
|
</div>
|
|
<a id="icecast-link" class="listen-btn" href="#" target="_blank">Listen via Icecast</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="unconfigured-banner" class="config-section" style="display:none">
|
|
<div class="alert">
|
|
This node has not been assigned a system yet. Connect it to a C2 server or configure it manually via the API (<code>POST /api/config/system</code>).
|
|
</div>
|
|
</div>
|
|
|
|
<p class="updated">Last updated: <span id="last-updated">—</span></p>
|
|
|
|
<script>
|
|
async function refresh() {
|
|
try {
|
|
const r = await fetch('/api/status');
|
|
if (!r.ok) return;
|
|
const d = await r.json();
|
|
|
|
document.getElementById('node-name').textContent = d.node_name || 'DRB Edge Node';
|
|
document.getElementById('node-id').textContent = d.node_id || '';
|
|
|
|
const status = d.is_recording ? 'recording' : (d.configured ? 'online' : 'unconfigured');
|
|
const badge = document.getElementById('status-badge');
|
|
badge.textContent = status;
|
|
badge.className = 'badge badge-' + status;
|
|
|
|
document.getElementById('discord-status').textContent = d.discord_connected ? 'Connected' : 'Not connected';
|
|
document.getElementById('recording-status').textContent = d.is_recording ? 'Yes' : 'No';
|
|
document.getElementById('tgid').textContent = d.active_tgid ?? '—';
|
|
document.getElementById('call-id').textContent = d.active_call_id ? d.active_call_id.slice(0, 8) + '…' : '—';
|
|
document.getElementById('system-id').textContent = d.assigned_system_id ?? '—';
|
|
document.getElementById('op25-status').textContent = d.op25?.status === 'running' ? 'Running' : 'Stopped';
|
|
document.getElementById('location').textContent = `${d.lat}, ${d.lon}`;
|
|
document.getElementById('configured').textContent = d.configured ? 'Yes' : 'No';
|
|
|
|
const icecastLink = document.getElementById('icecast-link');
|
|
icecastLink.href = d.icecast_url || '#';
|
|
|
|
document.getElementById('unconfigured-banner').style.display = d.configured ? 'none' : 'block';
|
|
document.getElementById('last-updated').textContent = new Date().toLocaleTimeString();
|
|
} catch (e) {
|
|
console.error('Status fetch failed:', e);
|
|
}
|
|
}
|
|
|
|
refresh();
|
|
setInterval(refresh, 3000);
|
|
</script>
|
|
</body>
|
|
</html>
|