Redesign dashboard with weighted metrics, compact map, share bars and empty-state onboarding
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
de22f035dc
commit
31bb8b21c2
6 files changed
+333
-92
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
<main class="page">
|
||||
<nav class="nav">
|
||||
<a href="/" class="brand"><span class="brand-mark" aria-hidden="true"></span>Flypaper</a>
|
||||
<NavLink href="/" Match="NavLinkMatch.All">Dashboard</NavLink>
|
||||
<NavLink href="/settings">Einstellungen</NavLink>
|
||||
<form method="post" action="/auth/logout" class="logout">
|
||||
|
||||
@@ -1,48 +1,83 @@
|
||||
@page "/"
|
||||
@using Flypaper.Core.Abstractions
|
||||
@using Flypaper.Http
|
||||
@using Microsoft.Extensions.Options
|
||||
@using Flypaper.Storage.Dashboard
|
||||
@using Flypaper.Storage.Entities
|
||||
@inject DashboardQueries Queries
|
||||
@inject IConnectionGovernor Governor
|
||||
@inject IOptions<PortOptions> Ports
|
||||
|
||||
<PageTitle>Flypaper</PageTitle>
|
||||
<HeadContent>
|
||||
<meta http-equiv="refresh" content="30" />
|
||||
</HeadContent>
|
||||
|
||||
<header class="top">
|
||||
<h1>Flypaper</h1>
|
||||
<span class="muted">Stand @_loadedAt.ToString("HH:mm:ss") · aktualisiert alle 30 s</span>
|
||||
<header class="page-head">
|
||||
<h1>Übersicht</h1>
|
||||
<p><span class="live-dot" aria-hidden="true"></span>Stand @_loadedAt.ToString("HH:mm:ss") · aktualisiert alle 30 s</p>
|
||||
</header>
|
||||
|
||||
@if (_data is { } data)
|
||||
{
|
||||
var active = Governor.ActiveConnections;
|
||||
<section class="metrics">
|
||||
<div class="metric"><span class="label">Fänge gesamt</span><span class="value">@data.TotalCatches.ToString("N0")</span></div>
|
||||
<div class="metric"><span class="label">Letzte 24 h</span><span class="value">@data.CatchesLast24Hours.ToString("N0")</span></div>
|
||||
<div class="metric"><span class="label">Aktiv</span><span class="value">@Governor.ActiveConnections.ToString("N0")</span></div>
|
||||
<div class="metric"><span class="label">Eindeutige IPs</span><span class="value">@data.UniqueIps.ToString("N0")</span></div>
|
||||
<div class="metric"><span class="label">Haltezeit gesamt</span><span class="value">@Formatting.Duration(data.TotalHoldTime)</span></div>
|
||||
<div class="metric"><span class="label">Abgelehnt</span><span class="value">@data.Rejected.ToString("N0")</span></div>
|
||||
<div class="metric metric-hero @(active > 0 ? "live" : null)">
|
||||
<span class="label">Gerade in der Falle</span>
|
||||
<span class="value">@active.ToString("N0")</span>
|
||||
<span class="sub">@(active == 1 ? "Bot wird festgehalten" : "Bots werden festgehalten")</span>
|
||||
</div>
|
||||
<div class="metric metric-hero">
|
||||
<span class="label">Fänge gesamt</span>
|
||||
<span class="value">@data.TotalCatches.ToString("N0")</span>
|
||||
<span class="sub">+@data.CatchesLast24Hours.ToString("N0") in den letzten 24 h</span>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<span class="label">Eindeutige IPs</span>
|
||||
<span class="value">@data.UniqueIps.ToString("N0")</span>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<span class="label">Haltezeit gesamt</span>
|
||||
<span class="value">@Formatting.Duration(data.TotalHoldTime)</span>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<span class="label">Abgelehnt</span>
|
||||
<span class="value">@data.Rejected.ToString("N0")</span>
|
||||
<span class="sub">wegen Verbindungslimits</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<WorldMap CatchesByCountry="data.CatchesByCountry" />
|
||||
@if (data.TotalCatches == 0)
|
||||
{
|
||||
<section class="card onboarding">
|
||||
<h2>Noch keine Fänge</h2>
|
||||
<p class="muted">Flypaper wartet. Sobald dein Reverse Proxy unbekannte Hosts weiterleitet, tauchen hier die ersten Bots auf.</p>
|
||||
<ol>
|
||||
<li>Leite den Catch-all- bzw. Default-Server deines Proxys auf den Trap-Port <code>@Ports.Value.Trap</code>.</li>
|
||||
<li>Setze dort <code>X-Real-IP</code> und schalte das Response-Buffering ab.</li>
|
||||
<li>Teste die Falle mit <code>curl -N http://<host>:@Ports.Value.Trap/.env</code>.</li>
|
||||
</ol>
|
||||
</section>
|
||||
}
|
||||
|
||||
<section class="tops">
|
||||
<section class="origin">
|
||||
<WorldMap CatchesByCountry="data.CatchesByCountry" />
|
||||
<TopTable Title="Top 10 Länder" KeyLabel="Land" Entries="data.TopCountries" ShowFlags="true" LabelFormatter="CountryNames.Display" />
|
||||
<TopTable Title="Top 10 Provider (ASN)" KeyLabel="Provider" Entries="data.TopProviders" />
|
||||
<TopTable Title="Top 10 IPs" KeyLabel="IP" Entries="data.TopIps" />
|
||||
<TopTable Title="Top 10 Ziele" KeyLabel="Ziel" Entries="data.TopTargets" KeyFormatter="Formatting.Target" />
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Letzte 50 Fänge <span class="hint">Zeile anklicken zum Aufklappen</span></h2>
|
||||
@if (data.Recent.Count == 0)
|
||||
{
|
||||
<p class="muted">Noch nichts gefangen.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (data.TotalCatches > 0)
|
||||
{
|
||||
<section class="tops">
|
||||
<TopTable Title="Top 10 Provider" KeyLabel="Provider" Entries="data.TopProviders" />
|
||||
<TopTable Title="Top 10 IPs" KeyLabel="IP" Entries="data.TopIps" />
|
||||
<TopTable Title="Top 10 Ziele" KeyLabel="Ziel" Entries="data.TopTargets" KeyFormatter="Formatting.Target" />
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<div class="card-head">
|
||||
<h2>Letzte 50 Fänge</h2>
|
||||
<span class="hint">Zeile anklicken zum Aufklappen</span>
|
||||
</div>
|
||||
<div class="scroll">
|
||||
<table class="recent-table">
|
||||
<thead>
|
||||
@@ -97,8 +132,8 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
</section>
|
||||
}
|
||||
}
|
||||
|
||||
<script src="@Assets["dashboard.js"]" defer></script>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
@using System.Globalization
|
||||
@using Flypaper.Storage.Dashboard
|
||||
<section class="card">
|
||||
<h2>@Title</h2>
|
||||
@if (Entries.Count == 0)
|
||||
{
|
||||
<p class="muted">Keine Daten.</p>
|
||||
<p class="empty">Noch keine Einträge.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -23,8 +24,9 @@
|
||||
<tbody>
|
||||
@foreach (var entry in Entries)
|
||||
{
|
||||
<tr data-expand="@($"{KeyLabel}:{entry.Key}")" tabindex="0" aria-expanded="false">
|
||||
<td class="mono clip" title="@Display(entry)">@(ShowFlags ? $"{Formatting.Flag(entry.Key)} " : "")@Display(entry)</td>
|
||||
var share = (entry.Count * 100.0 / Entries[0].Count).ToString("0.#", CultureInfo.InvariantCulture);
|
||||
<tr data-expand="@($"{KeyLabel}:{entry.Key}")" tabindex="0" aria-expanded="false" style="--share: @(share)%">
|
||||
<td class="mono clip bar" title="@Display(entry)">@(ShowFlags ? $"{Formatting.Flag(entry.Key)} " : "")@Display(entry)</td>
|
||||
<td class="num">@entry.Count.ToString("N0")</td>
|
||||
<td class="num">@Formatting.Duration(entry.HoldTime)</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,35 +1,47 @@
|
||||
@using System.Globalization
|
||||
|
||||
<section class="card">
|
||||
<h2>Herkunft</h2>
|
||||
<svg class="world-map" viewBox="0 0 @Map.Width.ToString(CultureInfo.InvariantCulture) @Map.Height.ToString(CultureInfo.InvariantCulture)" role="img" aria-label="Weltkarte der Fänge nach Land">
|
||||
@foreach (var country in Map.Countries)
|
||||
<section class="card map-card">
|
||||
<div class="card-head">
|
||||
<h2>Herkunft</h2>
|
||||
@if (_max > 0)
|
||||
{
|
||||
var count = Count(country.Code);
|
||||
<path d="@country.Path" class="@($"level-{Level(count)}")"><title>@Title(CountryNames.Display(country.Code, country.Name)!, count)</title></path>
|
||||
<div class="map-legend" aria-label="Fänge pro Land">
|
||||
<span class="swatch level-0" title="keine"></span>
|
||||
<span>1</span>
|
||||
@for (var level = 1; level <= Levels; level++)
|
||||
{
|
||||
<span class="swatch @($"level-{level}")"></span>
|
||||
}
|
||||
<span>@_max.ToString("N0")</span>
|
||||
</div>
|
||||
}
|
||||
@foreach (var marker in Map.Markers)
|
||||
{
|
||||
var count = Count(marker.Code);
|
||||
if (count > 0)
|
||||
</div>
|
||||
<div class="map-wrap">
|
||||
<svg class="world-map" viewBox="0 0 @Map.Width.ToString(CultureInfo.InvariantCulture) @Map.Height.ToString(CultureInfo.InvariantCulture)" role="img" aria-label="Weltkarte der Fänge nach Land">
|
||||
@foreach (var country in Map.Countries)
|
||||
{
|
||||
var x = marker.X.ToString(CultureInfo.InvariantCulture);
|
||||
var y = marker.Y.ToString(CultureInfo.InvariantCulture);
|
||||
<g class="@($"marker level-{Level(count)}")">
|
||||
<title>@Title(CountryNames.Display(marker.Code, marker.Name)!, count)</title>
|
||||
<circle class="hit" cx="@x" cy="@y" r="14" />
|
||||
<circle class="dot" cx="@x" cy="@y" r="6" />
|
||||
</g>
|
||||
var count = Count(country.Code);
|
||||
<path d="@country.Path" class="@($"level-{Level(count)}")"><title>@Title(CountryNames.Display(country.Code, country.Name)!, count)</title></path>
|
||||
}
|
||||
}
|
||||
</svg>
|
||||
<div class="map-legend">
|
||||
<span>0</span>
|
||||
@for (var level = 0; level <= Levels; level++)
|
||||
@foreach (var marker in Map.Markers)
|
||||
{
|
||||
var count = Count(marker.Code);
|
||||
if (count > 0)
|
||||
{
|
||||
var x = marker.X.ToString(CultureInfo.InvariantCulture);
|
||||
var y = marker.Y.ToString(CultureInfo.InvariantCulture);
|
||||
<g class="@($"marker level-{Level(count)}")">
|
||||
<title>@Title(CountryNames.Display(marker.Code, marker.Name)!, count)</title>
|
||||
<circle class="hit" cx="@x" cy="@y" r="14" />
|
||||
<circle class="dot" cx="@x" cy="@y" r="6" />
|
||||
</g>
|
||||
}
|
||||
}
|
||||
</svg>
|
||||
@if (_max == 0)
|
||||
{
|
||||
<span class="swatch @($"level-{level}")"></span>
|
||||
<p class="map-empty">Sobald Bots anklopfen, färbt sich die Karte nach Herkunftsland.</p>
|
||||
}
|
||||
<span>@_max.ToString("N0")</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<PageTitle>Flypaper · Einstellungen</PageTitle>
|
||||
|
||||
<div class="settings">
|
||||
<header class="settings-head">
|
||||
<header class="page-head">
|
||||
<h1>Einstellungen</h1>
|
||||
<p>Änderungen gelten sofort, ohne Neustart. Werte aus Umgebungsvariablen dienen als Standard.</p>
|
||||
</header>
|
||||
|
||||
Reference in new issue
Block a user