849 lines
35 KiB
HTML
849 lines
35 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>CaddyBuddy</title>
|
|
<style>
|
|
/* ─── Reset & Variables ──────────────────────────────────────────────── */
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
|
|
:root {
|
|
--bg: #07090f;
|
|
--s0: #0d1117;
|
|
--s1: #111826;
|
|
--s2: #182030;
|
|
--s3: #1e2a3e;
|
|
--border: #1d2d44;
|
|
--border2: #253554;
|
|
--text: #dde5f3;
|
|
--text2: #8fa3c0;
|
|
--muted: #4a5c73;
|
|
--accent: #4d8ef5;
|
|
--indigo: #7c5af5;
|
|
--good: #10d3a0;
|
|
--warn: #f5a623;
|
|
--bad: #f04060;
|
|
--info: #38c0f8;
|
|
--grad: linear-gradient(135deg, #4d8ef5, #7c5af5);
|
|
}
|
|
|
|
html { scroll-behavior: smooth; }
|
|
|
|
body {
|
|
background: var(--bg);
|
|
color: var(--text);
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
|
|
font-size: 14px;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
/* ─── Sticky header ──────────────────────────────────────────────────── */
|
|
.app-header {
|
|
position: sticky; top: 0; z-index: 100;
|
|
background: rgba(7,9,15,0.9);
|
|
backdrop-filter: blur(14px);
|
|
border-bottom: 1px solid var(--border);
|
|
padding: 0 1.5rem;
|
|
height: 54px;
|
|
display: flex; align-items: center; gap: 1.25rem;
|
|
}
|
|
|
|
.logo { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; flex-shrink: 0; }
|
|
|
|
.logo-icon {
|
|
width: 30px; height: 30px; border-radius: 7px;
|
|
background: var(--grad);
|
|
display: flex; align-items: center; justify-content: center;
|
|
}
|
|
.logo-icon svg { width: 16px; height: 16px; fill: #fff; }
|
|
|
|
.logo-text {
|
|
font-size: 0.95rem; font-weight: 700; letter-spacing: -0.02em;
|
|
background: var(--grad);
|
|
-webkit-background-clip: text; -webkit-text-fill-color: transparent;
|
|
background-clip: text;
|
|
}
|
|
|
|
.header-pills { flex: 1; display: flex; gap: 0.5rem; overflow: hidden; }
|
|
|
|
.pill {
|
|
background: var(--s2); border: 1px solid var(--border);
|
|
border-radius: 20px; padding: 2px 10px;
|
|
font-size: 0.72rem; color: var(--text2); white-space: nowrap;
|
|
}
|
|
.pill.good { border-color: rgba(16,211,160,0.4); color: var(--good); }
|
|
|
|
.header-nav { display: flex; gap: 0.15rem; flex-shrink: 0; }
|
|
|
|
.nav-a {
|
|
color: var(--text2); text-decoration: none; font-size: 0.78rem;
|
|
padding: 0.3rem 0.65rem; border-radius: 5px;
|
|
transition: background 0.15s, color 0.15s;
|
|
}
|
|
.nav-a:hover { background: var(--s2); color: var(--text); }
|
|
|
|
.btn-refresh {
|
|
background: var(--s2); border: 1px solid var(--border2);
|
|
color: var(--accent); text-decoration: none; font-size: 0.78rem;
|
|
padding: 0.3rem 0.8rem; border-radius: 6px;
|
|
display: flex; align-items: center; gap: 0.35rem;
|
|
transition: background 0.15s;
|
|
}
|
|
.btn-refresh:hover { background: var(--s3); }
|
|
|
|
/* ─── Main ───────────────────────────────────────────────────────────── */
|
|
main { max-width: 1440px; margin: 0 auto; padding: 1.5rem; }
|
|
|
|
/* ─── KPI strip ──────────────────────────────────────────────────────── */
|
|
.kpi-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
|
|
gap: 0.85rem;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.kpi {
|
|
background: var(--s1); border: 1px solid var(--border); border-radius: 10px;
|
|
padding: 1rem 1.1rem;
|
|
transition: border-color 0.2s, box-shadow 0.2s;
|
|
cursor: default;
|
|
}
|
|
.kpi:hover { border-color: var(--border2); box-shadow: 0 0 20px rgba(77,142,245,0.08); }
|
|
|
|
.kpi-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.55rem; }
|
|
|
|
.kpi-label {
|
|
font-size: 0.68rem; font-weight: 600; letter-spacing: 0.07em;
|
|
text-transform: uppercase; color: var(--text2);
|
|
}
|
|
|
|
.kpi-ico {
|
|
width: 26px; height: 26px; border-radius: 6px;
|
|
display: flex; align-items: center; justify-content: center;
|
|
}
|
|
.kpi-ico svg { width: 13px; height: 13px; }
|
|
.ico-blue { background: rgba(77,142,245,0.14); } .ico-blue svg { stroke: var(--accent); }
|
|
.ico-green { background: rgba(16,211,160,0.12); } .ico-green svg { stroke: var(--good); }
|
|
.ico-orange { background: rgba(245,166,35,0.12); } .ico-orange svg { stroke: var(--warn); }
|
|
.ico-red { background: rgba(240,64,96,0.12); } .ico-red svg { stroke: var(--bad); }
|
|
.ico-purple { background: rgba(124,90,245,0.12); } .ico-purple svg { stroke: var(--indigo); }
|
|
.ico-cyan { background: rgba(56,192,248,0.12); } .ico-cyan svg { stroke: var(--info); }
|
|
|
|
.kpi-val {
|
|
font-size: 1.9rem; font-weight: 700; letter-spacing: -0.03em;
|
|
line-height: 1; font-variant-numeric: tabular-nums;
|
|
}
|
|
.kpi-sub { font-size: 0.7rem; color: var(--muted); margin-top: 0.3rem; }
|
|
|
|
/* ─── Sections ───────────────────────────────────────────────────────── */
|
|
.sec-head {
|
|
display: flex; align-items: center; gap: 0.55rem;
|
|
margin-bottom: 1rem; margin-top: 0.25rem;
|
|
}
|
|
.sec-ico {
|
|
width: 26px; height: 26px; background: var(--s2); border: 1px solid var(--border);
|
|
border-radius: 6px; display: flex; align-items: center; justify-content: center;
|
|
}
|
|
.sec-ico svg { width: 13px; height: 13px; }
|
|
.sec-title {
|
|
font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
|
|
letter-spacing: 0.07em; color: var(--text2);
|
|
}
|
|
.sec-badge {
|
|
margin-left: auto; font-size: 0.7rem; color: var(--muted);
|
|
background: var(--s2); border: 1px solid var(--border);
|
|
border-radius: 10px; padding: 1px 8px;
|
|
}
|
|
|
|
.divider { height: 1px; background: var(--border); margin: 1.75rem 0; }
|
|
|
|
/* ─── Cards ──────────────────────────────────────────────────────────── */
|
|
.card {
|
|
background: var(--s1); border: 1px solid var(--border);
|
|
border-radius: 10px; overflow: hidden;
|
|
}
|
|
|
|
.card-head {
|
|
padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
|
|
display: flex; align-items: center; gap: 0.5rem;
|
|
}
|
|
.card-title {
|
|
font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
|
|
letter-spacing: 0.06em; color: var(--text2); flex: 1;
|
|
}
|
|
.card-badge {
|
|
font-size: 0.68rem; color: var(--muted);
|
|
background: var(--s2); border: 1px solid var(--border);
|
|
border-radius: 10px; padding: 1px 7px;
|
|
}
|
|
|
|
.card-body { padding: 0.9rem 1rem; }
|
|
|
|
/* ─── Grid layouts ───────────────────────────────────────────────────── */
|
|
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
|
|
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
|
|
@media (max-width: 1100px) { .g3 { grid-template-columns: 1fr 1fr; } }
|
|
@media (max-width: 700px) { .g2, .g3 { grid-template-columns: 1fr; } }
|
|
|
|
/* ─── Tables ─────────────────────────────────────────────────────────── */
|
|
.tbl-wrap { overflow-x: auto; }
|
|
.scrollable { max-height: 380px; overflow-y: auto; }
|
|
.scrollable::-webkit-scrollbar { width: 4px; }
|
|
.scrollable::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
|
|
|
|
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
|
|
|
|
th {
|
|
text-align: left; padding: 0.5rem 0.75rem;
|
|
color: var(--muted); font-weight: 600; font-size: 0.65rem;
|
|
text-transform: uppercase; letter-spacing: 0.07em;
|
|
border-bottom: 1px solid var(--border); white-space: nowrap;
|
|
position: sticky; top: 0; background: var(--s1);
|
|
}
|
|
|
|
td {
|
|
padding: 0.45rem 0.75rem;
|
|
border-bottom: 1px solid rgba(29,45,68,0.6);
|
|
vertical-align: middle;
|
|
}
|
|
tr:last-child td { border-bottom: none; }
|
|
tr:hover td { background: rgba(24,32,48,0.6); }
|
|
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
|
|
td.mono { font-family: "SF Mono","Cascadia Code",Consolas,monospace; font-size: 0.76rem; }
|
|
|
|
.trunc {
|
|
max-width: 280px; overflow: hidden;
|
|
text-overflow: ellipsis; white-space: nowrap; display: block;
|
|
}
|
|
|
|
/* ─── Chips / badges ─────────────────────────────────────────────────── */
|
|
.chip {
|
|
display: inline-flex; align-items: center;
|
|
padding: 1px 6px; border-radius: 4px;
|
|
font-size: 0.68rem; font-weight: 500; white-space: nowrap;
|
|
}
|
|
.c2 { background: rgba(16,211,160,0.12); color: var(--good); }
|
|
.c3 { background: rgba(77,142,245,0.12); color: var(--accent); }
|
|
.c4 { background: rgba(245,166,35,0.12); color: var(--warn); }
|
|
.c5 { background: rgba(240,64,96,0.12); color: var(--bad); }
|
|
.c0 { background: var(--s2); color: var(--muted); }
|
|
.ctag{ background: var(--s3); border: 1px solid var(--border2); color: var(--text2); }
|
|
.cnum{ background: var(--s2); border: 1px solid var(--border); color: var(--text2); }
|
|
|
|
.method {
|
|
font-size: 0.65rem; font-weight: 700; padding: 1px 5px;
|
|
border-radius: 3px; font-family: Consolas,monospace;
|
|
}
|
|
.mGET { background: rgba(16,211,160,0.12); color: var(--good); }
|
|
.mPOST { background: rgba(77,142,245,0.12); color: var(--accent); }
|
|
.mPUT { background: rgba(245,166,35,0.12); color: var(--warn); }
|
|
.mDELETE { background: rgba(240,64,96,0.12); color: var(--bad); }
|
|
.mOTHER { background: var(--s2); color: var(--muted); }
|
|
|
|
/* ─── Bar chart rows ─────────────────────────────────────────────────── */
|
|
.bar-row {
|
|
display: flex; align-items: center; gap: 0.65rem;
|
|
padding: 0.38rem 0;
|
|
border-bottom: 1px solid rgba(29,45,68,0.5);
|
|
}
|
|
.bar-row:last-child { border-bottom: none; }
|
|
|
|
.bar-lbl {
|
|
font-family: "SF Mono",Consolas,monospace; font-size: 0.76rem;
|
|
color: var(--text); flex-shrink: 0;
|
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
}
|
|
|
|
.bar-track { flex: 1; height: 5px; background: var(--s3); border-radius: 3px; overflow: hidden; min-width: 40px; }
|
|
.bar-fill { height: 100%; border-radius: 3px; background: var(--grad); }
|
|
.bar-warn { background: linear-gradient(90deg, var(--warn), var(--bad)); }
|
|
.bar-auth { background: linear-gradient(90deg, var(--indigo), var(--accent)); }
|
|
|
|
.bar-cnt { font-size: 0.76rem; color: var(--text2); font-variant-numeric: tabular-nums; flex-shrink: 0; min-width: 40px; text-align: right; }
|
|
.bar-extra { font-size: 0.7rem; color: var(--muted); flex-shrink: 0; min-width: 55px; text-align: right; }
|
|
|
|
/* ─── Status composite bar ───────────────────────────────────────────── */
|
|
.stat-bar { height: 7px; border-radius: 4px; overflow: hidden; display: flex; margin-bottom: 1rem; }
|
|
.stat-bar-seg { height: 100%; }
|
|
|
|
/* ─── Emby device cards ──────────────────────────────────────────────── */
|
|
.device-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.dev-card {
|
|
background: var(--s2); border: 1px solid var(--border);
|
|
border-radius: 10px; padding: 1rem;
|
|
transition: border-color 0.15s, box-shadow 0.15s;
|
|
}
|
|
.dev-card:hover { border-color: var(--border2); box-shadow: 0 4px 18px rgba(0,0,0,0.25); }
|
|
|
|
.dev-top { display: flex; align-items: flex-start; gap: 0.65rem; margin-bottom: 0.65rem; }
|
|
|
|
.dev-ico {
|
|
width: 38px; height: 38px; border-radius: 9px;
|
|
display: flex; align-items: center; justify-content: center;
|
|
font-size: 1.15rem; flex-shrink: 0;
|
|
}
|
|
|
|
.dev-name {
|
|
font-weight: 700; font-size: 0.88rem;
|
|
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
}
|
|
.dev-client { font-size: 0.73rem; color: var(--text2); margin-top: 1px; }
|
|
|
|
.dev-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.55rem; }
|
|
|
|
.ip-row { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.55rem; }
|
|
.ip-chip {
|
|
font-family: Consolas,monospace; font-size: 0.66rem;
|
|
padding: 1px 6px; border-radius: 4px;
|
|
background: var(--s0); border: 1px solid var(--border);
|
|
color: var(--info);
|
|
}
|
|
|
|
.dev-foot {
|
|
display: flex; justify-content: space-between; align-items: center;
|
|
font-size: 0.68rem; color: var(--muted);
|
|
border-top: 1px solid var(--border); padding-top: 0.45rem; margin-top: 0.3rem;
|
|
}
|
|
|
|
/* ─── Empty states ───────────────────────────────────────────────────── */
|
|
.empty { text-align: center; padding: 2rem; color: var(--muted); font-size: 0.82rem; }
|
|
.empty .e-ico { font-size: 1.6rem; margin-bottom: 0.4rem; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<!-- ═══ HEADER ════════════════════════════════════════════════════════ -->
|
|
<header class="app-header">
|
|
<a class="logo" href="/">
|
|
<div class="logo-icon">
|
|
<svg viewBox="0 0 24 24"><path d="M12 2L3 7v5c0 5.25 3.75 10.15 9 11.25C17.25 22.15 21 17.25 21 12V7z"/></svg>
|
|
</div>
|
|
<span class="logo-text">CaddyBuddy</span>
|
|
</a>
|
|
|
|
<div class="header-pills">
|
|
<span class="pill">
|
|
{% if log_stats.files_found != 1 %}{{ log_stats.files_ok }}/{{ log_stats.files_found }} files · {% endif %}{{ log_label }} · {{ log_size }}
|
|
</span>
|
|
<span class="pill">{{ s.first_ts }} → {{ s.last_ts }}</span>
|
|
<span class="pill">{{ s.span_hours }}h window</span>
|
|
{% if log_stats.files_error %}<span class="pill" style="color:var(--warn)">{{ log_stats.files_error }} file errors</span>{% endif %}
|
|
{% if s.emby_api_enabled %}<span class="pill good">Emby API connected</span>{% endif %}
|
|
</div>
|
|
|
|
<nav class="header-nav">
|
|
<a href="#traffic" class="nav-a">Traffic</a>
|
|
<a href="#emby" class="nav-a">Emby</a>
|
|
<a href="#security" class="nav-a">Security</a>
|
|
<a href="#errors" class="nav-a">Errors</a>
|
|
<a href="#auth" class="nav-a">Auth</a>
|
|
</nav>
|
|
|
|
<a href="/" class="btn-refresh">
|
|
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
|
<path d="M23 4v6h-6M1 20v-6h6M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"/>
|
|
</svg>
|
|
Refresh
|
|
</a>
|
|
</header>
|
|
|
|
<!-- ═══ MAIN ══════════════════════════════════════════════════════════ -->
|
|
<main>
|
|
|
|
<!-- ─── KPI strip ─────────────────────────────────────────────────── -->
|
|
<div class="kpi-grid">
|
|
<div class="kpi">
|
|
<div class="kpi-row">
|
|
<span class="kpi-label">Total Requests</span>
|
|
<div class="kpi-ico ico-blue">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke-width="2"><path d="M22 12h-4l-3 9L9 3l-3 9H2"/></svg>
|
|
</div>
|
|
</div>
|
|
<div class="kpi-val">{{ "{:,}".format(s.total) }}</div>
|
|
<div class="kpi-sub">{{ s.span_hours }}h window</div>
|
|
</div>
|
|
|
|
<div class="kpi">
|
|
<div class="kpi-row">
|
|
<span class="kpi-label">Blocked (403)</span>
|
|
<div class="kpi-ico ico-orange">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="4.93" y1="4.93" x2="19.07" y2="19.07"/></svg>
|
|
</div>
|
|
</div>
|
|
<div class="kpi-val" style="color:var(--warn)">{{ "{:,}".format(s.blocked_403_total) }}</div>
|
|
<div class="kpi-sub">{{ "%.1f"|format(s.blocked_403_total / s.total * 100 if s.total else 0) }}% of traffic</div>
|
|
</div>
|
|
|
|
<div class="kpi">
|
|
<div class="kpi-row">
|
|
<span class="kpi-label">Server Errors</span>
|
|
<div class="kpi-ico ico-red">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke-width="2"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>
|
|
</div>
|
|
</div>
|
|
<div class="kpi-val" style="color:var(--bad)">{{ "{:,}".format(s.errors_5xx_total) }}</div>
|
|
<div class="kpi-sub">5xx responses</div>
|
|
</div>
|
|
|
|
<div class="kpi">
|
|
<div class="kpi-row">
|
|
<span class="kpi-label">Slow Requests</span>
|
|
<div class="kpi-ico ico-purple">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke-width="2"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
|
|
</div>
|
|
</div>
|
|
<div class="kpi-val">{{ "{:,}".format(s.slow_total) }}</div>
|
|
<div class="kpi-sub">≥ 2 second latency</div>
|
|
</div>
|
|
|
|
<div class="kpi">
|
|
<div class="kpi-row">
|
|
<span class="kpi-label">Unique IPs</span>
|
|
<div class="kpi-ico ico-cyan">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke-width="2"><path d="M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75"/></svg>
|
|
</div>
|
|
</div>
|
|
<div class="kpi-val">{{ "{:,}".format(s.by_ip|length) }}</div>
|
|
<div class="kpi-sub">distinct sources</div>
|
|
</div>
|
|
|
|
<div class="kpi">
|
|
<div class="kpi-row">
|
|
<span class="kpi-label">Emby Devices</span>
|
|
<div class="kpi-ico ico-green">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke-width="2"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>
|
|
</div>
|
|
</div>
|
|
<div class="kpi-val" style="color:var(--good)">{{ "{:,}".format(s.device_registry|length) }}</div>
|
|
<div class="kpi-sub">tracked by device ID</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- ═══ TRAFFIC ═══════════════════════════════════════════════════════ -->
|
|
<div id="traffic" style="scroll-margin-top:62px">
|
|
<div class="sec-head">
|
|
<div class="sec-ico"><svg viewBox="0 0 24 24" fill="none" stroke="var(--accent)" stroke-width="2"><path d="M22 12h-4l-3 9L9 3l-3 9H2"/></svg></div>
|
|
<span class="sec-title">Traffic</span>
|
|
</div>
|
|
|
|
<div class="g2" style="margin-bottom:1rem">
|
|
|
|
<!-- Status distribution -->
|
|
<div class="card">
|
|
<div class="card-head"><span class="card-title">Status Distribution</span></div>
|
|
<div class="card-body">
|
|
{% set ns = namespace(tot=0) %}
|
|
{% for k,v in s.by_status_class.items() %}{% set ns.tot = ns.tot + v %}{% endfor %}
|
|
<div class="stat-bar">
|
|
{% for klass, count in s.by_status_class.items() %}
|
|
{% set pct = (count / ns.tot * 100)|round(1) if ns.tot else 0 %}
|
|
{% if klass=='2xx' %}{% set col='var(--good)' %}
|
|
{% elif klass=='3xx' %}{% set col='var(--accent)' %}
|
|
{% elif klass=='4xx' %}{% set col='var(--warn)' %}
|
|
{% elif klass=='5xx' %}{% set col='var(--bad)' %}
|
|
{% else %}{% set col='var(--muted)' %}{% endif %}
|
|
<div class="stat-bar-seg" style="width:{{ pct }}%;background:{{ col }}" title="{{ klass }}: {{ count }}"></div>
|
|
{% endfor %}
|
|
</div>
|
|
<table>
|
|
<thead><tr><th>Class</th><th class="r">Count</th><th class="r">Share</th></tr></thead>
|
|
<tbody>
|
|
{% for klass, count in s.by_status_class.items() %}
|
|
{% set pct = (count / ns.tot * 100)|round(1) if ns.tot else 0 %}
|
|
<tr>
|
|
<td><span class="chip c{{ klass[0] }}">{{ klass }}</span></td>
|
|
<td class="r">{{ "{:,}".format(count) }}</td>
|
|
<td class="r" style="color:var(--muted)">{{ pct }}%</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Top IPs -->
|
|
<div class="card">
|
|
<div class="card-head">
|
|
<span class="card-title">Top Source IPs</span>
|
|
<span class="card-badge">{{ s.by_ip|length }} unique</span>
|
|
</div>
|
|
<div class="card-body">
|
|
{% set max_ip = s.by_ip[0][1] if s.by_ip else 1 %}
|
|
{% for ip, count in s.by_ip[:15] %}
|
|
<div class="bar-row">
|
|
<span class="bar-lbl" style="width:140px">{{ ip }}</span>
|
|
<div class="bar-track"><div class="bar-fill" style="width:{{ (count/max_ip*100)|round }}%"></div></div>
|
|
<span class="bar-cnt">{{ "{:,}".format(count) }}</span>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- Per-host -->
|
|
<div class="card">
|
|
<div class="card-head">
|
|
<span class="card-title">Per-Host Traffic</span>
|
|
<span class="card-badge">{{ s.by_host|length }} hosts</span>
|
|
</div>
|
|
<div class="card-body">
|
|
{% for h in s.by_host %}
|
|
<div class="bar-row">
|
|
<span class="bar-lbl" style="width:210px">{{ h.host }}</span>
|
|
<div class="bar-track"><div class="bar-fill" style="width:{{ h.pct }}%"></div></div>
|
|
<span class="bar-cnt">{{ "{:,}".format(h.hits) }}</span>
|
|
<span class="bar-extra">{{ h.bytes_human }}</span>
|
|
<div style="display:flex;gap:3px;flex-wrap:wrap;min-width:160px">
|
|
{% for klass, count in h.status_mix.items() %}
|
|
<span class="chip c{{ klass[0] }}">{{ klass }}:{{ count }}</span>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div><!-- /traffic -->
|
|
|
|
<div class="divider"></div>
|
|
|
|
<!-- ═══ EMBY ══════════════════════════════════════════════════════════ -->
|
|
<div id="emby" style="scroll-margin-top:62px">
|
|
<div class="sec-head">
|
|
<div class="sec-ico"><svg viewBox="0 0 24 24" fill="none" stroke="var(--good)" stroke-width="2"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg></div>
|
|
<span class="sec-title">Emby Intelligence</span>
|
|
<span class="sec-badge">{{ s.device_registry|length }} devices · {{ s.emby_clients|length }} clients</span>
|
|
</div>
|
|
|
|
{% if s.device_registry %}
|
|
<div class="card" style="margin-bottom:1rem">
|
|
<div class="card-head">
|
|
<span class="card-title">Device Registry</span>
|
|
<span class="card-badge">identified by DeviceId{% if s.emby_api_enabled %} · usernames via Emby API{% endif %}</span>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="device-grid">
|
|
{% for dev in s.device_registry %}
|
|
{% set cl = (dev.client or '')|lower %}
|
|
{% if 'fire' in cl or 'amazon' in cl %}
|
|
{% set ico='🔥' %}{% set ibg='rgba(245,166,35,0.12)' %}
|
|
{% elif 'ios' in cl or 'iphone' in cl or 'ipad' in cl %}
|
|
{% set ico='📱' %}{% set ibg='rgba(56,192,248,0.12)' %}
|
|
{% elif 'android' in cl %}
|
|
{% set ico='📱' %}{% set ibg='rgba(77,142,245,0.14)' %}
|
|
{% elif 'web' in cl or 'browser' in cl %}
|
|
{% set ico='🌐' %}{% set ibg='rgba(124,90,245,0.12)' %}
|
|
{% elif 'tv' in cl or 'roku' in cl or 'bravia' in (dev.device or '')|lower %}
|
|
{% set ico='📺' %}{% set ibg='rgba(16,211,160,0.12)' %}
|
|
{% elif 'windows' in cl or 'desktop' in cl %}
|
|
{% set ico='🖥️' %}{% set ibg='rgba(245,166,35,0.12)' %}
|
|
{% else %}
|
|
{% set ico='📡' %}{% set ibg='rgba(255,255,255,0.05)' %}
|
|
{% endif %}
|
|
<div class="dev-card">
|
|
<div class="dev-top">
|
|
<div class="dev-ico" style="background:{{ ibg }}">{{ ico }}</div>
|
|
<div style="min-width:0">
|
|
<div class="dev-name" title="{{ dev.device }}">{{ dev.device or 'Unknown Device' }}</div>
|
|
<div class="dev-client">{{ dev.client or 'Unknown Client' }}</div>
|
|
</div>
|
|
</div>
|
|
<div class="dev-tags">
|
|
{% if dev.version %}<span class="chip ctag">v{{ dev.version }}</span>{% endif %}
|
|
{% if dev.username %}
|
|
<span class="chip" style="background:rgba(16,211,160,0.12);color:var(--good)">👤 {{ dev.username }}</span>
|
|
{% endif %}
|
|
<span class="chip cnum">{{ "{:,}".format(dev.hits) }} req</span>
|
|
</div>
|
|
{% if dev.ips %}
|
|
<div class="ip-row">
|
|
{% for ip in dev.ips[:4] %}<span class="ip-chip">{{ ip }}</span>{% endfor %}
|
|
{% if dev.ips|length > 4 %}<span class="ip-chip" style="color:var(--muted)">+{{ dev.ips|length - 4 }}</span>{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
<div class="dev-foot">
|
|
<span title="{{ dev.device_id }}">{{ dev.device_id[:16] }}…</span>
|
|
<span>{{ dev.last_seen }}</span>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="g2">
|
|
<div class="card">
|
|
<div class="card-head"><span class="card-title">Client Applications</span></div>
|
|
<div class="card-body">
|
|
{% if s.emby_breakdown %}
|
|
{% for b in s.emby_breakdown %}
|
|
<div class="bar-row" style="flex-direction:column;align-items:flex-start;gap:0.35rem;padding:0.5rem 0">
|
|
<div style="display:flex;align-items:center;gap:0.5rem;width:100%">
|
|
<span style="font-size:0.82rem;flex:1">{{ b.client }}</span>
|
|
<span class="chip cnum">{{ "{:,}".format(b.total) }}</span>
|
|
</div>
|
|
<div style="display:flex;gap:0.25rem;flex-wrap:wrap">
|
|
{% for ver, count in b.versions.items() %}
|
|
<span class="chip ctag">{{ ver }}: {{ count }}</span>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
{% else %}
|
|
<div class="empty"><div class="e-ico">📡</div>No Emby client data in this window.</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-head"><span class="card-title">Device Names</span></div>
|
|
<div class="card-body">
|
|
{% if s.emby_devices %}
|
|
{% set max_d = s.emby_devices[0][1] %}
|
|
{% for d, count in s.emby_devices[:20] %}
|
|
<div class="bar-row">
|
|
<span class="bar-lbl" style="width:165px" title="{{ d }}">{{ d }}</span>
|
|
<div class="bar-track"><div class="bar-fill" style="width:{{ (count/max_d*100)|round }}%"></div></div>
|
|
<span class="bar-cnt">{{ "{:,}".format(count) }}</span>
|
|
</div>
|
|
{% endfor %}
|
|
{% else %}
|
|
<div class="empty"><div class="e-ico">🔍</div>No device data found.</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div><!-- /emby -->
|
|
|
|
<div class="divider"></div>
|
|
|
|
<!-- ═══ SECURITY ══════════════════════════════════════════════════════ -->
|
|
<div id="security" style="scroll-margin-top:62px">
|
|
<div class="sec-head">
|
|
<div class="sec-ico"><svg viewBox="0 0 24 24" fill="none" stroke="var(--warn)" stroke-width="2"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg></div>
|
|
<span class="sec-title">Security</span>
|
|
<span class="sec-badge">{{ s.blocked_403_total }} blocked</span>
|
|
</div>
|
|
|
|
<div class="g2" style="margin-bottom:1rem">
|
|
<div class="card">
|
|
<div class="card-head"><span class="card-title">Block Trigger Analysis</span></div>
|
|
<div class="card-body">
|
|
{% if s.blocked_403_by_trigger %}
|
|
{% set max_t = s.blocked_403_by_trigger[0][1] %}
|
|
{% for trigger, count in s.blocked_403_by_trigger %}
|
|
<div class="bar-row">
|
|
<span class="bar-lbl" style="width:200px;font-size:0.73rem">{{ trigger }}</span>
|
|
<div class="bar-track"><div class="bar-fill bar-warn" style="width:{{ (count/max_t*100)|round }}%"></div></div>
|
|
<span class="bar-cnt">{{ count }}</span>
|
|
</div>
|
|
{% endfor %}
|
|
{% else %}
|
|
<div class="empty"><div class="e-ico">✓</div>No triggers identified.</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-head"><span class="card-title">Top Blocked IPs</span></div>
|
|
<div class="card-body">
|
|
{% if s.blocked_ips_top %}
|
|
{% set max_bi = s.blocked_ips_top[0][1] %}
|
|
{% for ip, count in s.blocked_ips_top %}
|
|
<div class="bar-row">
|
|
<span class="bar-lbl" style="width:140px">{{ ip }}</span>
|
|
<div class="bar-track"><div class="bar-fill bar-warn" style="width:{{ (count/max_bi*100)|round }}%"></div></div>
|
|
<span class="bar-cnt">{{ count }}</span>
|
|
</div>
|
|
{% endfor %}
|
|
{% else %}
|
|
<div class="empty"><div class="e-ico">✓</div>No blocked IPs.</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-head">
|
|
<span class="card-title">Recent 403 Blocks</span>
|
|
<span class="card-badge">{{ s.blocked_403_total }} total · showing {{ [s.blocked_403|length, 30]|min }}</span>
|
|
</div>
|
|
<div class="tbl-wrap scrollable">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Time</th><th>Host</th><th>Method</th><th>URI</th>
|
|
<th>Emby Identity</th><th>IP</th><th>User-Agent</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for e in s.blocked_403[:30] %}
|
|
{% set mcls = 'm' + e.method if e.method in ['GET','POST','PUT','DELETE'] else 'mOTHER' %}
|
|
<tr>
|
|
<td class="mono" style="white-space:nowrap;color:var(--text2)">{{ e.time }}</td>
|
|
<td class="mono" style="color:var(--accent)">{{ e.host }}</td>
|
|
<td><span class="method {{ mcls }}">{{ e.method }}</span></td>
|
|
<td class="mono"><span class="trunc" title="{{ e.uri }}">{{ e.uri }}</span></td>
|
|
<td>
|
|
{% if e.emby_client or e.emby_device %}
|
|
<div style="font-size:0.76rem;line-height:1.5">
|
|
{% if e.emby_client %}<div>{{ e.emby_client }}</div>{% endif %}
|
|
{% if e.emby_device %}<div style="color:var(--text2)">{{ e.emby_device }}</div>{% endif %}
|
|
{% if e.emby_version %}<span class="chip ctag">v{{ e.emby_version }}</span>{% endif %}
|
|
{% if e.emby_device_id %}<span class="chip ctag" style="font-size:0.63rem" title="{{ e.emby_device_id }}"> {{ e.emby_device_id[:8] }}…</span>{% endif %}
|
|
</div>
|
|
{% else %}<span style="color:var(--muted)">—</span>{% endif %}
|
|
</td>
|
|
<td class="mono" style="color:var(--info)">{{ e.ip }}</td>
|
|
<td class="mono"><span class="trunc" style="color:var(--text2)" title="{{ e.ua }}">{{ e.ua }}</span></td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div><!-- /security -->
|
|
|
|
<div class="divider"></div>
|
|
|
|
<!-- ═══ ERRORS & PERFORMANCE ══════════════════════════════════════════ -->
|
|
<div id="errors" style="scroll-margin-top:62px">
|
|
<div class="sec-head">
|
|
<div class="sec-ico"><svg viewBox="0 0 24 24" fill="none" stroke="var(--bad)" stroke-width="2"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></div>
|
|
<span class="sec-title">Errors & Performance</span>
|
|
</div>
|
|
|
|
<div class="g2">
|
|
<div class="card">
|
|
<div class="card-head">
|
|
<span class="card-title">Server Errors (5xx)</span>
|
|
<span class="card-badge">{{ s.errors_5xx_total }} total</span>
|
|
</div>
|
|
{% if s.errors_5xx_total == 0 %}
|
|
<div class="empty"><div class="e-ico">✓</div>No server errors in this window.</div>
|
|
{% else %}
|
|
<div class="tbl-wrap scrollable">
|
|
<table>
|
|
<thead><tr><th>Time</th><th>Host</th><th>URI</th><th class="r">Status</th></tr></thead>
|
|
<tbody>
|
|
{% for e in s.errors_5xx[:20] %}
|
|
<tr>
|
|
<td class="mono" style="color:var(--text2);white-space:nowrap">{{ e.time }}</td>
|
|
<td class="mono" style="color:var(--accent)">{{ e.host }}</td>
|
|
<td class="mono"><span class="trunc" title="{{ e.uri }}">{{ e.uri }}</span></td>
|
|
<td class="r"><span class="chip c5">{{ e.status }}</span></td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-head">
|
|
<span class="card-title">Slow Requests (≥ 2s)</span>
|
|
<span class="card-badge">{{ s.slow_total }} total</span>
|
|
</div>
|
|
{% if s.slow_total == 0 %}
|
|
<div class="empty"><div class="e-ico">⚡</div>Everything's snappy.</div>
|
|
{% else %}
|
|
<div class="tbl-wrap scrollable">
|
|
<table>
|
|
<thead><tr><th>Time</th><th>Host</th><th>URI</th><th class="r">Duration</th></tr></thead>
|
|
<tbody>
|
|
{% for e in s.slow_requests[:20] %}
|
|
<tr>
|
|
<td class="mono" style="color:var(--text2);white-space:nowrap">{{ e.time }}</td>
|
|
<td class="mono" style="color:var(--accent)">{{ e.host }}</td>
|
|
<td class="mono"><span class="trunc" title="{{ e.uri }}">{{ e.uri }}</span></td>
|
|
<td class="r" style="color:var(--warn)">{{ e.duration }}s</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div><!-- /errors -->
|
|
|
|
<div class="divider"></div>
|
|
|
|
<!-- ═══ AUTH ══════════════════════════════════════════════════════════ -->
|
|
<div id="auth" style="scroll-margin-top:62px">
|
|
<div class="sec-head">
|
|
<div class="sec-ico"><svg viewBox="0 0 24 24" fill="none" stroke="var(--indigo)" stroke-width="2"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg></div>
|
|
<span class="sec-title">Auth Service</span>
|
|
<span class="sec-badge">{{ s.auth_summary.total }} events</span>
|
|
</div>
|
|
|
|
{% if s.auth_summary.total == 0 %}
|
|
<div class="card"><div class="empty" style="padding:2rem"><div class="e-ico">🔒</div>No auth events in this log window.</div></div>
|
|
{% else %}
|
|
<div class="g2" style="margin-bottom:1rem">
|
|
<div class="card">
|
|
<div class="card-head"><span class="card-title">By Path</span></div>
|
|
<div class="card-body">
|
|
{% set max_ap = s.auth_summary.by_path[0][1] if s.auth_summary.by_path else 1 %}
|
|
{% for path, count in s.auth_summary.by_path %}
|
|
<div class="bar-row">
|
|
<span class="bar-lbl" style="width:190px;font-size:0.73rem" title="{{ path }}">{{ path }}</span>
|
|
<div class="bar-track"><div class="bar-fill bar-auth" style="width:{{ (count/max_ap*100)|round }}%"></div></div>
|
|
<span class="bar-cnt">{{ count }}</span>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-head"><span class="card-title">By Source IP</span></div>
|
|
<div class="card-body">
|
|
{% set max_aip = s.auth_summary.by_ip[0][1] if s.auth_summary.by_ip else 1 %}
|
|
{% for ip, count in s.auth_summary.by_ip %}
|
|
<div class="bar-row">
|
|
<span class="bar-lbl" style="width:140px">{{ ip }}</span>
|
|
<div class="bar-track"><div class="bar-fill bar-auth" style="width:{{ (count/max_aip*100)|round }}%"></div></div>
|
|
<span class="bar-cnt">{{ count }}</span>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-head"><span class="card-title">Recent Auth Requests</span></div>
|
|
<div class="tbl-wrap scrollable">
|
|
<table>
|
|
<thead><tr><th>Time</th><th>Method</th><th>Path</th><th class="r">Status</th><th>IP</th></tr></thead>
|
|
<tbody>
|
|
{% for e in s.auth_summary.recent %}
|
|
{% set mcls = 'm' + e.method if e.method in ['GET','POST','PUT','DELETE'] else 'mOTHER' %}
|
|
{% set scls = 'c' + (e.status // 100)|string %}
|
|
<tr>
|
|
<td class="mono" style="color:var(--text2);white-space:nowrap">{{ e.time }}</td>
|
|
<td><span class="method {{ mcls }}">{{ e.method }}</span></td>
|
|
<td class="mono"><span class="trunc" title="{{ e.uri }}">{{ e.uri }}</span></td>
|
|
<td class="r"><span class="chip {{ scls }}">{{ e.status }}</span></td>
|
|
<td class="mono" style="color:var(--info)">{{ e.ip }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div><!-- /auth -->
|
|
|
|
<div style="height:3rem"></div>
|
|
</main>
|
|
</body>
|
|
</html>
|