Add character images and production files
@@ -0,0 +1,3 @@
|
|||||||
|
ADGUARD_HOST=http://192.168.1.235:30004
|
||||||
|
ADGUARD_USER=bmartin
|
||||||
|
ADGUARD_PASS=C0n3k4!1585321
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
# AdGuard Block Battle Rankings
|
||||||
|
|
||||||
|
A Flask dashboard that pulls client block stats from AdGuard Home and displays
|
||||||
|
each client as a ranked anime-tier character card.
|
||||||
|
|
||||||
|
## Tier System
|
||||||
|
|
||||||
|
| Tier | Label | Block Range | Color |
|
||||||
|
|------|---------------|-------------|--------|
|
||||||
|
| 1 | Civilian | 0-50 | Green |
|
||||||
|
| 2 | Rookie | 51-200 | Yellow |
|
||||||
|
| 3 | Protagonist | 201-500 | Orange |
|
||||||
|
| 4 | Hardened Fighter | 501-1000 | Red |
|
||||||
|
| 5 | Final Boss | 1000+ | Purple |
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
1. Install dependencies:
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
2. Set environment variables (or edit app.py directly):
|
||||||
|
export ADGUARD_HOST=http://vpn.umbrellapants.xyz:3000
|
||||||
|
export ADGUARD_USER=your_username
|
||||||
|
export ADGUARD_PASS=your_password
|
||||||
|
|
||||||
|
3. Run:
|
||||||
|
python app.py
|
||||||
|
|
||||||
|
4. Open http://localhost:5000
|
||||||
|
|
||||||
|
## Swapping in Character Art
|
||||||
|
|
||||||
|
Each tier uses an SVG placeholder. To replace with real images:
|
||||||
|
- Add your images to static/characters/ named tier1.png through tier5.png
|
||||||
|
- In index.html, replace the charSVG() call in the card template with:
|
||||||
|
<img src="/static/characters/tier${client.tier}.png" alt="Tier ${client.tier}" style="width:75%;height:75%;object-fit:contain"/>
|
||||||
|
|
||||||
|
## Deployment with mod_wsgi
|
||||||
|
|
||||||
|
Create a wsgi.py at the project root:
|
||||||
|
|
||||||
|
from app import app as application
|
||||||
|
|
||||||
|
Then point your Apache VirtualHost at wsgi.py.
|
||||||
|
|
||||||
|
## Auto-refresh
|
||||||
|
|
||||||
|
The dashboard polls AdGuard every 60 seconds automatically.
|
||||||
|
Adjust the interval at the bottom of index.html (setInterval line).
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
from flask import Flask, render_template, request
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@app.route("/blocked")
|
||||||
|
def blocked():
|
||||||
|
domain = request.args.get("domain", "that site")
|
||||||
|
reason = request.args.get("reason", "blocked by network policy")
|
||||||
|
return render_template("blocked.html", domain=domain, reason=reason)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app.run(host="0.0.0.0", port=5000, debug=True)
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
from flask import Flask, render_template, jsonify
|
||||||
|
import requests
|
||||||
|
import os
|
||||||
|
from requests.auth import HTTPBasicAuth
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
load_dotenv('/opt/adguard-dashboard/.env')
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
ADGUARD_HOST = os.environ.get("ADGUARD_HOST")
|
||||||
|
ADGUARD_USER = os.environ.get("ADGUARD_USER")
|
||||||
|
ADGUARD_PASS = os.environ.get("ADGUARD_PASS")
|
||||||
|
EXCLUDE_CLIENTS = ["192.168.1.235"]
|
||||||
|
|
||||||
|
def get_tier(count):
|
||||||
|
if count <= 500:
|
||||||
|
return {"tier": 1, "label": "Innocent", "desc": "Blissfully unaware", "color": "#4ade80"}
|
||||||
|
elif count <= 2000:
|
||||||
|
return {"tier": 2, "label": "Rookie", "desc": "Starting to notice things", "color": "#facc15"}
|
||||||
|
elif count <= 5000:
|
||||||
|
return {"tier": 3, "label": "Protagonist", "desc": "Things are getting real", "color": "#fb923c"}
|
||||||
|
elif count <= 9000:
|
||||||
|
return {"tier": 4, "label": "Hardened Fighter", "desc": "Seen some things", "color": "#f87171"}
|
||||||
|
else:
|
||||||
|
return {"tier": 5, "label": "Final Boss", "desc": "Pure chaos energy", "color": "#c084fc"}
|
||||||
|
|
||||||
|
|
||||||
|
def get_client_names():
|
||||||
|
try:
|
||||||
|
resp = requests.get(
|
||||||
|
f"{ADGUARD_HOST}/control/clients",
|
||||||
|
auth=HTTPBasicAuth(ADGUARD_USER, ADGUARD_PASS),
|
||||||
|
timeout=5
|
||||||
|
)
|
||||||
|
resp.raise_for_status()
|
||||||
|
data = resp.json()
|
||||||
|
lookup = {}
|
||||||
|
for client in data.get("clients", []):
|
||||||
|
for ip in client.get("ids", []):
|
||||||
|
lookup[ip] = client["name"]
|
||||||
|
return lookup
|
||||||
|
except Exception:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/")
|
||||||
|
def index():
|
||||||
|
return render_template("dashboard.html")
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/api/clients")
|
||||||
|
def clients():
|
||||||
|
try:
|
||||||
|
names = get_client_names()
|
||||||
|
|
||||||
|
resp = requests.get(
|
||||||
|
f"{ADGUARD_HOST}/control/stats",
|
||||||
|
auth=HTTPBasicAuth(ADGUARD_USER, ADGUARD_PASS),
|
||||||
|
timeout=5
|
||||||
|
)
|
||||||
|
resp.raise_for_status()
|
||||||
|
data = resp.json()
|
||||||
|
|
||||||
|
top_clients = data.get("top_clients", [])
|
||||||
|
|
||||||
|
result = []
|
||||||
|
for entry in top_clients:
|
||||||
|
for ip, count in entry.items():
|
||||||
|
if ip in EXCLUDE_CLIENTS:
|
||||||
|
continue
|
||||||
|
tier_info = get_tier(count)
|
||||||
|
result.append({
|
||||||
|
"name": names.get(ip, ip),
|
||||||
|
"ip": ip,
|
||||||
|
"blocks": count,
|
||||||
|
**tier_info
|
||||||
|
})
|
||||||
|
|
||||||
|
result.sort(key=lambda x: x["blocks"], reverse=True)
|
||||||
|
return jsonify({"clients": result, "error": None})
|
||||||
|
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
return jsonify({"clients": [], "error": "Could not connect to AdGuard Home"})
|
||||||
|
except requests.exceptions.Timeout:
|
||||||
|
return jsonify({"clients": [], "error": "AdGuard Home timed out"})
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({"clients": [], "error": str(e)})
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app.run(debug=True, host="0.0.0.0", port=5001)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import sys
|
||||||
|
sys.path.insert(0, '/opt/adguard-dashboard')
|
||||||
|
from dashboard import app as application
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
flask>=3.0.0
|
||||||
|
requests>=2.31.0
|
||||||
|
After Width: | Height: | Size: 223 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 177 KiB |
|
After Width: | Height: | Size: 258 KiB |
|
After Width: | Height: | Size: 523 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 117 KiB |
|
After Width: | Height: | Size: 140 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 303 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 145 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 126 KiB |
|
After Width: | Height: | Size: 7.3 MiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 254 KiB |
|
After Width: | Height: | Size: 139 KiB |
@@ -0,0 +1,520 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
<title>AdGuard Block Tracker</title>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Rajdhani:wght@400;600;700&display=swap" rel="stylesheet"/>
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--bg: #0a0a0f;
|
||||||
|
--surface: #12121a;
|
||||||
|
--border: #1e1e2e;
|
||||||
|
--text: #e2e8f0;
|
||||||
|
--muted: #64748b;
|
||||||
|
--t1: #4ade80;
|
||||||
|
--t2: #facc15;
|
||||||
|
--t3: #fb923c;
|
||||||
|
--t4: #f87171;
|
||||||
|
--t5: #c084fc;
|
||||||
|
}
|
||||||
|
|
||||||
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: var(--bg);
|
||||||
|
color: var(--text);
|
||||||
|
font-family: 'Rajdhani', sans-serif;
|
||||||
|
min-height: 100vh;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scanline overlay */
|
||||||
|
body::before {
|
||||||
|
content: '';
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
0deg,
|
||||||
|
transparent,
|
||||||
|
transparent 2px,
|
||||||
|
rgba(0,0,0,0.07) 2px,
|
||||||
|
rgba(0,0,0,0.07) 4px
|
||||||
|
);
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
padding: 2.5rem 2rem 1rem;
|
||||||
|
text-align: center;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
header::after {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
height: 2px;
|
||||||
|
background: linear-gradient(90deg, transparent, var(--t5), var(--t4), var(--t3), var(--t2), var(--t1), transparent);
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-family: 'Bebas Neue', sans-serif;
|
||||||
|
font-size: clamp(2.5rem, 6vw, 4.5rem);
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
background: linear-gradient(135deg, #c084fc, #f87171, #fb923c);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
background-clip: text;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle {
|
||||||
|
font-size: 1rem;
|
||||||
|
color: var(--muted);
|
||||||
|
letter-spacing: 0.2em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
margin-top: 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.controls {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1.5rem;
|
||||||
|
padding: 1.2rem 2rem;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
color: var(--muted);
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-dot {
|
||||||
|
width: 8px; height: 8px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--t1);
|
||||||
|
box-shadow: 0 0 8px var(--t1);
|
||||||
|
display: inline-block;
|
||||||
|
animation: pulse 2s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-dot.error { background: var(--t4); box-shadow: 0 0 8px var(--t4); animation: none; }
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
0%, 100% { opacity: 1; }
|
||||||
|
50% { opacity: 0.4; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.refresh-btn {
|
||||||
|
background: none;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
color: var(--muted);
|
||||||
|
font-family: 'Rajdhani', sans-serif;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
letter-spacing: 0.15em;
|
||||||
|
padding: 0.4rem 1rem;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.refresh-btn:hover {
|
||||||
|
border-color: var(--t5);
|
||||||
|
color: var(--t5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tier-legend {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.6rem;
|
||||||
|
padding: 0 2rem 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tier-pill {
|
||||||
|
font-size: 0.72rem;
|
||||||
|
letter-spacing: 0.12em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
padding: 0.25rem 0.75rem;
|
||||||
|
border-radius: 2px;
|
||||||
|
border: 1px solid;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
||||||
|
gap: 1.25rem;
|
||||||
|
padding: 0 2rem 3rem;
|
||||||
|
max-width: 1400px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: transform 0.25s, box-shadow 0.25s;
|
||||||
|
animation: cardIn 0.4s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
box-shadow: 0 12px 40px rgba(0,0,0,0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes cardIn {
|
||||||
|
from { opacity: 0; transform: translateY(16px); }
|
||||||
|
to { opacity: 1; transform: translateY(0); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-accent {
|
||||||
|
height: 3px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-body {
|
||||||
|
padding: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-rank {
|
||||||
|
font-family: 'Bebas Neue', sans-serif;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
letter-spacing: 0.15em;
|
||||||
|
color: var(--muted);
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Character placeholder art */
|
||||||
|
.char-frame {
|
||||||
|
width: 100%;
|
||||||
|
aspect-ratio: 1 / 1.1;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: var(--bg);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.char-frame svg {
|
||||||
|
width: 75%;
|
||||||
|
height: 75%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tier glow on frame */
|
||||||
|
.char-frame::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
box-shadow: inset 0 0 30px rgba(0,0,0,0.6);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tier-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: 0.5rem; right: 0.5rem;
|
||||||
|
font-family: 'Bebas Neue', sans-serif;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
padding: 0.15rem 0.5rem;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.client-name {
|
||||||
|
font-family: 'Bebas Neue', sans-serif;
|
||||||
|
font-size: 1.4rem;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
line-height: 1;
|
||||||
|
margin-bottom: 0.2rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tier-label {
|
||||||
|
font-size: 0.78rem;
|
||||||
|
letter-spacing: 0.18em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tier-desc {
|
||||||
|
font-size: 0.82rem;
|
||||||
|
color: var(--muted);
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-count {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-num {
|
||||||
|
font-family: 'Bebas Neue', sans-serif;
|
||||||
|
font-size: 2.2rem;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-lbl {
|
||||||
|
font-size: 0.78rem;
|
||||||
|
letter-spacing: 0.15em;
|
||||||
|
color: var(--muted);
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-bar {
|
||||||
|
height: 3px;
|
||||||
|
background: var(--border);
|
||||||
|
margin-top: 0.75rem;
|
||||||
|
border-radius: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-bar-fill {
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 2px;
|
||||||
|
transition: width 0.8s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
text-align: center;
|
||||||
|
padding: 5rem 2rem;
|
||||||
|
color: var(--muted);
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state h2 {
|
||||||
|
font-family: 'Bebas Neue', sans-serif;
|
||||||
|
font-size: 2rem;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
color: var(--t4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.last-updated {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: var(--muted);
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<header>
|
||||||
|
<h1>Block Battle Rankings</h1>
|
||||||
|
<div class="subtitle">AdGuard Home — Network Threat Index</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="controls">
|
||||||
|
<span><span class="status-dot" id="statusDot"></span> <span id="statusText">Connecting...</span></span>
|
||||||
|
<span class="last-updated" id="lastUpdated"></span>
|
||||||
|
<button class="refresh-btn" onclick="loadClients()">Refresh</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tier-legend">
|
||||||
|
<span class="tier-pill" style="color:var(--t1);border-color:var(--t1)">T1 Innocent 0-500</span>
|
||||||
|
<span class="tier-pill" style="color:var(--t2);border-color:var(--t2)">T2 Rookie 51-2000</span>
|
||||||
|
<span class="tier-pill" style="color:var(--t3);border-color:var(--t3)">T3 Protagonist 2001-5000</span>
|
||||||
|
<span class="tier-pill" style="color:var(--t4);border-color:var(--t4)">T4 Fighter 5001-9000</span>
|
||||||
|
<span class="tier-pill" style="color:var(--t5);border-color:var(--t5)">T5 Final Boss Over 9000!</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid" id="clientGrid"></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const TIER_COLORS = { 1: '#4ade80', 2: '#facc15', 3: '#fb923c', 4: '#f87171', 5: '#c084fc' };
|
||||||
|
|
||||||
|
// Placeholder SVG characters per tier
|
||||||
|
function charSVG(tier, color) {
|
||||||
|
const svgs = {
|
||||||
|
1: `<svg viewBox="0 0 100 120" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="50" cy="35" r="22" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<circle cx="42" cy="31" r="3" fill="${color}" opacity="0.7"/>
|
||||||
|
<circle cx="58" cy="31" r="3" fill="${color}" opacity="0.7"/>
|
||||||
|
<path d="M42 44 Q50 50 58 44" stroke="${color}" stroke-width="2" stroke-linecap="round" fill="none"/>
|
||||||
|
<line x1="50" y1="57" x2="50" y2="90" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="50" y1="70" x2="32" y2="85" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="50" y1="70" x2="68" y2="85" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="50" y1="90" x2="38" y2="115" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="50" y1="90" x2="62" y2="115" stroke="${color}" stroke-width="2"/>
|
||||||
|
<text x="50" y="10" text-anchor="middle" fill="${color}" font-size="8" opacity="0.5" font-family="monospace">T1</text>
|
||||||
|
</svg>`,
|
||||||
|
|
||||||
|
2: `<svg viewBox="0 0 100 120" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="50" cy="32" r="20" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<circle cx="43" cy="29" r="3.5" fill="${color}"/>
|
||||||
|
<circle cx="57" cy="29" r="3.5" fill="${color}"/>
|
||||||
|
<path d="M43 41 Q50 46 57 41" stroke="${color}" stroke-width="2" stroke-linecap="round" fill="none"/>
|
||||||
|
<path d="M30 25 L36 22" stroke="${color}" stroke-width="2" stroke-linecap="round"/>
|
||||||
|
<path d="M70 25 L64 22" stroke="${color}" stroke-width="2" stroke-linecap="round"/>
|
||||||
|
<rect x="38" y="52" width="24" height="30" rx="2" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<line x1="38" y1="67" x2="20" y2="78" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="62" y1="67" x2="80" y2="78" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="44" y1="82" x2="38" y2="112" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="56" y1="82" x2="62" y2="112" stroke="${color}" stroke-width="2"/>
|
||||||
|
<text x="50" y="10" text-anchor="middle" fill="${color}" font-size="8" opacity="0.5" font-family="monospace">T2</text>
|
||||||
|
</svg>`,
|
||||||
|
|
||||||
|
3: `<svg viewBox="0 0 100 120" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="50" cy="30" r="20" stroke="${color}" stroke-width="2.5" fill="none"/>
|
||||||
|
<path d="M40 27 L47 30" stroke="${color}" stroke-width="2.5" stroke-linecap="round"/>
|
||||||
|
<path d="M60 27 L53 30" stroke="${color}" stroke-width="2.5" stroke-linecap="round"/>
|
||||||
|
<circle cx="44" cy="30" r="2.5" fill="${color}"/>
|
||||||
|
<circle cx="56" cy="30" r="2.5" fill="${color}"/>
|
||||||
|
<path d="M44 40 Q50 44 56 40" stroke="${color}" stroke-width="2" stroke-linecap="round" fill="none"/>
|
||||||
|
<path d="M28 22 C24 18 22 14 28 12" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<path d="M72 22 C76 18 78 14 72 12" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<rect x="36" y="50" width="28" height="32" rx="2" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<line x1="36" y1="66" x2="16" y2="60" stroke="${color}" stroke-width="2.5"/>
|
||||||
|
<line x1="64" y1="66" x2="84" y2="60" stroke="${color}" stroke-width="2.5"/>
|
||||||
|
<line x1="43" y1="82" x2="36" y2="112" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="57" y1="82" x2="64" y2="112" stroke="${color}" stroke-width="2"/>
|
||||||
|
<circle cx="50" cy="30" r="20" stroke="${color}" stroke-width="1" opacity="0.2" fill="none" transform="scale(1.3) translate(-12,-8)"/>
|
||||||
|
<text x="50" y="10" text-anchor="middle" fill="${color}" font-size="8" opacity="0.6" font-family="monospace">T3</text>
|
||||||
|
</svg>`,
|
||||||
|
|
||||||
|
4: `<svg viewBox="0 0 100 120" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="50" cy="28" r="20" stroke="${color}" stroke-width="3" fill="rgba(248,113,113,0.05)"/>
|
||||||
|
<path d="M38 24 L44 28" stroke="${color}" stroke-width="3" stroke-linecap="round"/>
|
||||||
|
<path d="M62 24 L56 28" stroke="${color}" stroke-width="3" stroke-linecap="round"/>
|
||||||
|
<circle cx="44" cy="28" r="3" fill="${color}"/>
|
||||||
|
<circle cx="56" cy="28" r="3" fill="${color}"/>
|
||||||
|
<circle cx="44" cy="28" r="1.5" fill="white" opacity="0.8"/>
|
||||||
|
<circle cx="56" cy="28" r="1.5" fill="white" opacity="0.8"/>
|
||||||
|
<path d="M44 38 Q50 41 56 38" stroke="${color}" stroke-width="2" stroke-linecap="round" fill="none"/>
|
||||||
|
<path d="M26 16 C20 10 18 4 26 2 C30 1 32 6 28 8" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<path d="M74 16 C80 10 82 4 74 2 C70 1 68 6 72 8" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<path d="M36 44 L36 78 L64 78 L64 44 Z" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<path d="M36 56 L20 48" stroke="${color}" stroke-width="3" stroke-linecap="round"/>
|
||||||
|
<path d="M64 56 L80 48" stroke="${color}" stroke-width="3" stroke-linecap="round"/>
|
||||||
|
<line x1="43" y1="78" x2="36" y2="112" stroke="${color}" stroke-width="2.5"/>
|
||||||
|
<line x1="57" y1="78" x2="64" y2="112" stroke="${color}" stroke-width="2.5"/>
|
||||||
|
<path d="M36 60 L20 68" stroke="${color}" stroke-width="2" stroke-dasharray="3 2"/>
|
||||||
|
<path d="M64 60 L80 68" stroke="${color}" stroke-width="2" stroke-dasharray="3 2"/>
|
||||||
|
<text x="50" y="10" text-anchor="middle" fill="${color}" font-size="8" opacity="0.7" font-family="monospace">T4</text>
|
||||||
|
</svg>`,
|
||||||
|
|
||||||
|
5: `<svg viewBox="0 0 100 120" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="50" cy="28" r="20" stroke="${color}" stroke-width="3" fill="rgba(192,132,252,0.08)"/>
|
||||||
|
<circle cx="50" cy="28" r="26" stroke="${color}" stroke-width="1" opacity="0.25" fill="none"/>
|
||||||
|
<circle cx="50" cy="28" r="32" stroke="${color}" stroke-width="0.5" opacity="0.12" fill="none"/>
|
||||||
|
<path d="M38 22 L44 27" stroke="${color}" stroke-width="3.5" stroke-linecap="round"/>
|
||||||
|
<path d="M62 22 L56 27" stroke="${color}" stroke-width="3.5" stroke-linecap="round"/>
|
||||||
|
<circle cx="44" cy="27" r="4" fill="${color}"/>
|
||||||
|
<circle cx="56" cy="27" r="4" fill="${color}"/>
|
||||||
|
<circle cx="44" cy="27" r="2" fill="white" opacity="0.9"/>
|
||||||
|
<circle cx="56" cy="27" r="2" fill="white" opacity="0.9"/>
|
||||||
|
<path d="M44 38 Q50 43 56 38" stroke="${color}" stroke-width="2.5" stroke-linecap="round" fill="none"/>
|
||||||
|
<path d="M24 14 C14 6 10 -2 22 0 C18 4 22 10 26 10" stroke="${color}" stroke-width="2.5" fill="none"/>
|
||||||
|
<path d="M76 14 C86 6 90 -2 78 0 C82 4 78 10 74 10" stroke="${color}" stroke-width="2.5" fill="none"/>
|
||||||
|
<path d="M30 18 C26 12 24 8 28 6" stroke="${color}" stroke-width="1.5" fill="none" opacity="0.6"/>
|
||||||
|
<path d="M70 18 C74 12 76 8 72 6" stroke="${color}" stroke-width="1.5" fill="none" opacity="0.6"/>
|
||||||
|
<path d="M34 44 L34 80 L66 80 L66 44 Z" stroke="${color}" stroke-width="2.5" fill="rgba(192,132,252,0.06)"/>
|
||||||
|
<path d="M34 55 L14 44" stroke="${color}" stroke-width="3.5" stroke-linecap="round"/>
|
||||||
|
<path d="M66 55 L86 44" stroke="${color}" stroke-width="3.5" stroke-linecap="round"/>
|
||||||
|
<path d="M34 65 L14 56" stroke="${color}" stroke-width="2" opacity="0.5"/>
|
||||||
|
<path d="M66 65 L86 56" stroke="${color}" stroke-width="2" opacity="0.5"/>
|
||||||
|
<line x1="42" y1="80" x2="34" y2="115" stroke="${color}" stroke-width="3"/>
|
||||||
|
<line x1="58" y1="80" x2="66" y2="115" stroke="${color}" stroke-width="3"/>
|
||||||
|
<line x1="42" y1="97" x2="30" y2="110" stroke="${color}" stroke-width="2" opacity="0.6"/>
|
||||||
|
<line x1="58" y1="97" x2="70" y2="110" stroke="${color}" stroke-width="2" opacity="0.6"/>
|
||||||
|
<text x="50" y="10" text-anchor="middle" fill="${color}" font-size="8" opacity="0.9" font-family="monospace" font-weight="bold">T5</text>
|
||||||
|
</svg>`
|
||||||
|
};
|
||||||
|
return svgs[tier] || svgs[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
let maxBlocks = 1;
|
||||||
|
|
||||||
|
const TIER_CHARS = {
|
||||||
|
1: ['tier1_1.png', 'tier1_2.png', 'tier1_3.png', 'tier1_4.png', 'tier1_5.png'],
|
||||||
|
2: ['tier2_1.png', 'tier2_2.png', 'tier2_3.png', 'tier2_4.png', 'tier2_5.png'],
|
||||||
|
3: ['tier3_1.png', 'tier3_2.png', 'tier3_3.png', 'tier3_4.png', 'tier3_5.png'],
|
||||||
|
4: ['tier4_1.png', 'tier4_2.png', 'tier4_3.png', 'tier4_4.png', 'tier4_5.png'],
|
||||||
|
5: ['tier5_1.png', 'tier5_2.png', 'tier5_3.png', 'tier5_4.png', 'tier5_5.png']
|
||||||
|
};
|
||||||
|
|
||||||
|
function randomChar(tier) {
|
||||||
|
const options = TIER_CHARS[tier] || ['tier1_1.png'];
|
||||||
|
const pick = options[Math.floor(Math.random() * options.length)];
|
||||||
|
return `/static/characters/${pick}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadClients() {
|
||||||
|
const dot = document.getElementById('statusDot');
|
||||||
|
const statusText = document.getElementById('statusText');
|
||||||
|
const grid = document.getElementById('clientGrid');
|
||||||
|
|
||||||
|
statusText.textContent = 'Fetching data...';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const resp = await fetch('/api/clients');
|
||||||
|
const data = await resp.json();
|
||||||
|
|
||||||
|
if (data.error) {
|
||||||
|
dot.className = 'status-dot error';
|
||||||
|
statusText.textContent = data.error;
|
||||||
|
grid.innerHTML = `<div class="empty-state"><h2>Connection Failed</h2><p>${data.error}</p></div>`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dot.className = 'status-dot';
|
||||||
|
statusText.textContent = `${data.clients.length} clients tracked`;
|
||||||
|
document.getElementById('lastUpdated').textContent =
|
||||||
|
'Updated ' + new Date().toLocaleTimeString();
|
||||||
|
|
||||||
|
if (data.clients.length === 0) {
|
||||||
|
grid.innerHTML = `<div class="empty-state"><h2>No Block Data Yet</h2><p>AdGuard hasn't recorded any blocked clients in this period.</p></div>`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
maxBlocks = Math.max(...data.clients.map(c => c.blocks), 1);
|
||||||
|
|
||||||
|
grid.innerHTML = data.clients.map((client, i) => {
|
||||||
|
const color = TIER_COLORS[client.tier];
|
||||||
|
const pct = Math.round((client.blocks / maxBlocks) * 100);
|
||||||
|
const delay = i * 0.06;
|
||||||
|
return `
|
||||||
|
<div class="card" style="animation-delay:${delay}s">
|
||||||
|
<div class="card-accent" style="background:${color}"></div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="card-rank"># ${i + 1}</div>
|
||||||
|
<div class="char-frame" style="box-shadow: inset 0 0 40px ${color}18">
|
||||||
|
<img src="${randomChar(client.tier)}" alt="${client.label}" style="width:75%;height:75%;object-fit:contain"/>
|
||||||
|
<div class="tier-badge" style="background:${color}22;color:${color};border:1px solid ${color}44">
|
||||||
|
TIER ${client.tier}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="client-name">${client.name}</div>
|
||||||
|
<div class="tier-label" style="color:${color}">${client.label}</div>
|
||||||
|
<div class="tier-desc">${client.desc}</div>
|
||||||
|
<div class="block-count">
|
||||||
|
<span class="block-num" style="color:${color}">${client.blocks.toLocaleString()}</span>
|
||||||
|
<span class="block-lbl">blocks</span>
|
||||||
|
</div>
|
||||||
|
<div class="block-bar">
|
||||||
|
<div class="block-bar-fill" style="width:${pct}%;background:${color}"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
}).join('');
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
dot.className = 'status-dot error';
|
||||||
|
statusText.textContent = 'Fetch error';
|
||||||
|
grid.innerHTML = `<div class="empty-state"><h2>Error</h2><p>${err.message}</p></div>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loadClients();
|
||||||
|
setInterval(loadClients, 60000);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,506 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
<title>AdGuard Block Tracker</title>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Rajdhani:wght@400;600;700&display=swap" rel="stylesheet"/>
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--bg: #0a0a0f;
|
||||||
|
--surface: #12121a;
|
||||||
|
--border: #1e1e2e;
|
||||||
|
--text: #e2e8f0;
|
||||||
|
--muted: #64748b;
|
||||||
|
--t1: #4ade80;
|
||||||
|
--t2: #facc15;
|
||||||
|
--t3: #fb923c;
|
||||||
|
--t4: #f87171;
|
||||||
|
--t5: #c084fc;
|
||||||
|
}
|
||||||
|
|
||||||
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: var(--bg);
|
||||||
|
color: var(--text);
|
||||||
|
font-family: 'Rajdhani', sans-serif;
|
||||||
|
min-height: 100vh;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scanline overlay */
|
||||||
|
body::before {
|
||||||
|
content: '';
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
0deg,
|
||||||
|
transparent,
|
||||||
|
transparent 2px,
|
||||||
|
rgba(0,0,0,0.07) 2px,
|
||||||
|
rgba(0,0,0,0.07) 4px
|
||||||
|
);
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
padding: 2.5rem 2rem 1rem;
|
||||||
|
text-align: center;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
header::after {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
height: 2px;
|
||||||
|
background: linear-gradient(90deg, transparent, var(--t5), var(--t4), var(--t3), var(--t2), var(--t1), transparent);
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-family: 'Bebas Neue', sans-serif;
|
||||||
|
font-size: clamp(2.5rem, 6vw, 4.5rem);
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
background: linear-gradient(135deg, #c084fc, #f87171, #fb923c);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
background-clip: text;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle {
|
||||||
|
font-size: 1rem;
|
||||||
|
color: var(--muted);
|
||||||
|
letter-spacing: 0.2em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
margin-top: 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.controls {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1.5rem;
|
||||||
|
padding: 1.2rem 2rem;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
color: var(--muted);
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-dot {
|
||||||
|
width: 8px; height: 8px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--t1);
|
||||||
|
box-shadow: 0 0 8px var(--t1);
|
||||||
|
display: inline-block;
|
||||||
|
animation: pulse 2s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-dot.error { background: var(--t4); box-shadow: 0 0 8px var(--t4); animation: none; }
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
0%, 100% { opacity: 1; }
|
||||||
|
50% { opacity: 0.4; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.refresh-btn {
|
||||||
|
background: none;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
color: var(--muted);
|
||||||
|
font-family: 'Rajdhani', sans-serif;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
letter-spacing: 0.15em;
|
||||||
|
padding: 0.4rem 1rem;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.refresh-btn:hover {
|
||||||
|
border-color: var(--t5);
|
||||||
|
color: var(--t5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tier-legend {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.6rem;
|
||||||
|
padding: 0 2rem 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tier-pill {
|
||||||
|
font-size: 0.72rem;
|
||||||
|
letter-spacing: 0.12em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
padding: 0.25rem 0.75rem;
|
||||||
|
border-radius: 2px;
|
||||||
|
border: 1px solid;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
||||||
|
gap: 1.25rem;
|
||||||
|
padding: 0 2rem 3rem;
|
||||||
|
max-width: 1400px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: transform 0.25s, box-shadow 0.25s;
|
||||||
|
animation: cardIn 0.4s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
box-shadow: 0 12px 40px rgba(0,0,0,0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes cardIn {
|
||||||
|
from { opacity: 0; transform: translateY(16px); }
|
||||||
|
to { opacity: 1; transform: translateY(0); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-accent {
|
||||||
|
height: 3px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-body {
|
||||||
|
padding: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-rank {
|
||||||
|
font-family: 'Bebas Neue', sans-serif;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
letter-spacing: 0.15em;
|
||||||
|
color: var(--muted);
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Character placeholder art */
|
||||||
|
.char-frame {
|
||||||
|
width: 100%;
|
||||||
|
aspect-ratio: 1 / 1.1;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: var(--bg);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.char-frame svg {
|
||||||
|
width: 75%;
|
||||||
|
height: 75%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tier glow on frame */
|
||||||
|
.char-frame::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
box-shadow: inset 0 0 30px rgba(0,0,0,0.6);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tier-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: 0.5rem; right: 0.5rem;
|
||||||
|
font-family: 'Bebas Neue', sans-serif;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
padding: 0.15rem 0.5rem;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.client-name {
|
||||||
|
font-family: 'Bebas Neue', sans-serif;
|
||||||
|
font-size: 1.4rem;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
line-height: 1;
|
||||||
|
margin-bottom: 0.2rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tier-label {
|
||||||
|
font-size: 0.78rem;
|
||||||
|
letter-spacing: 0.18em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tier-desc {
|
||||||
|
font-size: 0.82rem;
|
||||||
|
color: var(--muted);
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-count {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-num {
|
||||||
|
font-family: 'Bebas Neue', sans-serif;
|
||||||
|
font-size: 2.2rem;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-lbl {
|
||||||
|
font-size: 0.78rem;
|
||||||
|
letter-spacing: 0.15em;
|
||||||
|
color: var(--muted);
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-bar {
|
||||||
|
height: 3px;
|
||||||
|
background: var(--border);
|
||||||
|
margin-top: 0.75rem;
|
||||||
|
border-radius: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-bar-fill {
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 2px;
|
||||||
|
transition: width 0.8s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
text-align: center;
|
||||||
|
padding: 5rem 2rem;
|
||||||
|
color: var(--muted);
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state h2 {
|
||||||
|
font-family: 'Bebas Neue', sans-serif;
|
||||||
|
font-size: 2rem;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
color: var(--t4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.last-updated {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: var(--muted);
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<header>
|
||||||
|
<h1>Block Battle Rankings</h1>
|
||||||
|
<div class="subtitle">AdGuard Home — Network Threat Index</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="controls">
|
||||||
|
<span><span class="status-dot" id="statusDot"></span> <span id="statusText">Connecting...</span></span>
|
||||||
|
<span class="last-updated" id="lastUpdated"></span>
|
||||||
|
<button class="refresh-btn" onclick="loadClients()">Refresh</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tier-legend">
|
||||||
|
<span class="tier-pill" style="color:var(--t1);border-color:var(--t1)">T1 Civilian 0-50</span>
|
||||||
|
<span class="tier-pill" style="color:var(--t2);border-color:var(--t2)">T2 Rookie 51-200</span>
|
||||||
|
<span class="tier-pill" style="color:var(--t3);border-color:var(--t3)">T3 Protagonist 201-500</span>
|
||||||
|
<span class="tier-pill" style="color:var(--t4);border-color:var(--t4)">T4 Fighter 501-1000</span>
|
||||||
|
<span class="tier-pill" style="color:var(--t5);border-color:var(--t5)">T5 Final Boss 1000+</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid" id="clientGrid"></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const TIER_COLORS = { 1: '#4ade80', 2: '#facc15', 3: '#fb923c', 4: '#f87171', 5: '#c084fc' };
|
||||||
|
|
||||||
|
// Placeholder SVG characters per tier
|
||||||
|
function charSVG(tier, color) {
|
||||||
|
const svgs = {
|
||||||
|
1: `<svg viewBox="0 0 100 120" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="50" cy="35" r="22" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<circle cx="42" cy="31" r="3" fill="${color}" opacity="0.7"/>
|
||||||
|
<circle cx="58" cy="31" r="3" fill="${color}" opacity="0.7"/>
|
||||||
|
<path d="M42 44 Q50 50 58 44" stroke="${color}" stroke-width="2" stroke-linecap="round" fill="none"/>
|
||||||
|
<line x1="50" y1="57" x2="50" y2="90" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="50" y1="70" x2="32" y2="85" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="50" y1="70" x2="68" y2="85" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="50" y1="90" x2="38" y2="115" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="50" y1="90" x2="62" y2="115" stroke="${color}" stroke-width="2"/>
|
||||||
|
<text x="50" y="10" text-anchor="middle" fill="${color}" font-size="8" opacity="0.5" font-family="monospace">T1</text>
|
||||||
|
</svg>`,
|
||||||
|
|
||||||
|
2: `<svg viewBox="0 0 100 120" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="50" cy="32" r="20" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<circle cx="43" cy="29" r="3.5" fill="${color}"/>
|
||||||
|
<circle cx="57" cy="29" r="3.5" fill="${color}"/>
|
||||||
|
<path d="M43 41 Q50 46 57 41" stroke="${color}" stroke-width="2" stroke-linecap="round" fill="none"/>
|
||||||
|
<path d="M30 25 L36 22" stroke="${color}" stroke-width="2" stroke-linecap="round"/>
|
||||||
|
<path d="M70 25 L64 22" stroke="${color}" stroke-width="2" stroke-linecap="round"/>
|
||||||
|
<rect x="38" y="52" width="24" height="30" rx="2" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<line x1="38" y1="67" x2="20" y2="78" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="62" y1="67" x2="80" y2="78" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="44" y1="82" x2="38" y2="112" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="56" y1="82" x2="62" y2="112" stroke="${color}" stroke-width="2"/>
|
||||||
|
<text x="50" y="10" text-anchor="middle" fill="${color}" font-size="8" opacity="0.5" font-family="monospace">T2</text>
|
||||||
|
</svg>`,
|
||||||
|
|
||||||
|
3: `<svg viewBox="0 0 100 120" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="50" cy="30" r="20" stroke="${color}" stroke-width="2.5" fill="none"/>
|
||||||
|
<path d="M40 27 L47 30" stroke="${color}" stroke-width="2.5" stroke-linecap="round"/>
|
||||||
|
<path d="M60 27 L53 30" stroke="${color}" stroke-width="2.5" stroke-linecap="round"/>
|
||||||
|
<circle cx="44" cy="30" r="2.5" fill="${color}"/>
|
||||||
|
<circle cx="56" cy="30" r="2.5" fill="${color}"/>
|
||||||
|
<path d="M44 40 Q50 44 56 40" stroke="${color}" stroke-width="2" stroke-linecap="round" fill="none"/>
|
||||||
|
<path d="M28 22 C24 18 22 14 28 12" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<path d="M72 22 C76 18 78 14 72 12" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<rect x="36" y="50" width="28" height="32" rx="2" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<line x1="36" y1="66" x2="16" y2="60" stroke="${color}" stroke-width="2.5"/>
|
||||||
|
<line x1="64" y1="66" x2="84" y2="60" stroke="${color}" stroke-width="2.5"/>
|
||||||
|
<line x1="43" y1="82" x2="36" y2="112" stroke="${color}" stroke-width="2"/>
|
||||||
|
<line x1="57" y1="82" x2="64" y2="112" stroke="${color}" stroke-width="2"/>
|
||||||
|
<circle cx="50" cy="30" r="20" stroke="${color}" stroke-width="1" opacity="0.2" fill="none" transform="scale(1.3) translate(-12,-8)"/>
|
||||||
|
<text x="50" y="10" text-anchor="middle" fill="${color}" font-size="8" opacity="0.6" font-family="monospace">T3</text>
|
||||||
|
</svg>`,
|
||||||
|
|
||||||
|
4: `<svg viewBox="0 0 100 120" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="50" cy="28" r="20" stroke="${color}" stroke-width="3" fill="rgba(248,113,113,0.05)"/>
|
||||||
|
<path d="M38 24 L44 28" stroke="${color}" stroke-width="3" stroke-linecap="round"/>
|
||||||
|
<path d="M62 24 L56 28" stroke="${color}" stroke-width="3" stroke-linecap="round"/>
|
||||||
|
<circle cx="44" cy="28" r="3" fill="${color}"/>
|
||||||
|
<circle cx="56" cy="28" r="3" fill="${color}"/>
|
||||||
|
<circle cx="44" cy="28" r="1.5" fill="white" opacity="0.8"/>
|
||||||
|
<circle cx="56" cy="28" r="1.5" fill="white" opacity="0.8"/>
|
||||||
|
<path d="M44 38 Q50 41 56 38" stroke="${color}" stroke-width="2" stroke-linecap="round" fill="none"/>
|
||||||
|
<path d="M26 16 C20 10 18 4 26 2 C30 1 32 6 28 8" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<path d="M74 16 C80 10 82 4 74 2 C70 1 68 6 72 8" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<path d="M36 44 L36 78 L64 78 L64 44 Z" stroke="${color}" stroke-width="2" fill="none"/>
|
||||||
|
<path d="M36 56 L20 48" stroke="${color}" stroke-width="3" stroke-linecap="round"/>
|
||||||
|
<path d="M64 56 L80 48" stroke="${color}" stroke-width="3" stroke-linecap="round"/>
|
||||||
|
<line x1="43" y1="78" x2="36" y2="112" stroke="${color}" stroke-width="2.5"/>
|
||||||
|
<line x1="57" y1="78" x2="64" y2="112" stroke="${color}" stroke-width="2.5"/>
|
||||||
|
<path d="M36 60 L20 68" stroke="${color}" stroke-width="2" stroke-dasharray="3 2"/>
|
||||||
|
<path d="M64 60 L80 68" stroke="${color}" stroke-width="2" stroke-dasharray="3 2"/>
|
||||||
|
<text x="50" y="10" text-anchor="middle" fill="${color}" font-size="8" opacity="0.7" font-family="monospace">T4</text>
|
||||||
|
</svg>`,
|
||||||
|
|
||||||
|
5: `<svg viewBox="0 0 100 120" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="50" cy="28" r="20" stroke="${color}" stroke-width="3" fill="rgba(192,132,252,0.08)"/>
|
||||||
|
<circle cx="50" cy="28" r="26" stroke="${color}" stroke-width="1" opacity="0.25" fill="none"/>
|
||||||
|
<circle cx="50" cy="28" r="32" stroke="${color}" stroke-width="0.5" opacity="0.12" fill="none"/>
|
||||||
|
<path d="M38 22 L44 27" stroke="${color}" stroke-width="3.5" stroke-linecap="round"/>
|
||||||
|
<path d="M62 22 L56 27" stroke="${color}" stroke-width="3.5" stroke-linecap="round"/>
|
||||||
|
<circle cx="44" cy="27" r="4" fill="${color}"/>
|
||||||
|
<circle cx="56" cy="27" r="4" fill="${color}"/>
|
||||||
|
<circle cx="44" cy="27" r="2" fill="white" opacity="0.9"/>
|
||||||
|
<circle cx="56" cy="27" r="2" fill="white" opacity="0.9"/>
|
||||||
|
<path d="M44 38 Q50 43 56 38" stroke="${color}" stroke-width="2.5" stroke-linecap="round" fill="none"/>
|
||||||
|
<path d="M24 14 C14 6 10 -2 22 0 C18 4 22 10 26 10" stroke="${color}" stroke-width="2.5" fill="none"/>
|
||||||
|
<path d="M76 14 C86 6 90 -2 78 0 C82 4 78 10 74 10" stroke="${color}" stroke-width="2.5" fill="none"/>
|
||||||
|
<path d="M30 18 C26 12 24 8 28 6" stroke="${color}" stroke-width="1.5" fill="none" opacity="0.6"/>
|
||||||
|
<path d="M70 18 C74 12 76 8 72 6" stroke="${color}" stroke-width="1.5" fill="none" opacity="0.6"/>
|
||||||
|
<path d="M34 44 L34 80 L66 80 L66 44 Z" stroke="${color}" stroke-width="2.5" fill="rgba(192,132,252,0.06)"/>
|
||||||
|
<path d="M34 55 L14 44" stroke="${color}" stroke-width="3.5" stroke-linecap="round"/>
|
||||||
|
<path d="M66 55 L86 44" stroke="${color}" stroke-width="3.5" stroke-linecap="round"/>
|
||||||
|
<path d="M34 65 L14 56" stroke="${color}" stroke-width="2" opacity="0.5"/>
|
||||||
|
<path d="M66 65 L86 56" stroke="${color}" stroke-width="2" opacity="0.5"/>
|
||||||
|
<line x1="42" y1="80" x2="34" y2="115" stroke="${color}" stroke-width="3"/>
|
||||||
|
<line x1="58" y1="80" x2="66" y2="115" stroke="${color}" stroke-width="3"/>
|
||||||
|
<line x1="42" y1="97" x2="30" y2="110" stroke="${color}" stroke-width="2" opacity="0.6"/>
|
||||||
|
<line x1="58" y1="97" x2="70" y2="110" stroke="${color}" stroke-width="2" opacity="0.6"/>
|
||||||
|
<text x="50" y="10" text-anchor="middle" fill="${color}" font-size="8" opacity="0.9" font-family="monospace" font-weight="bold">T5</text>
|
||||||
|
</svg>`
|
||||||
|
};
|
||||||
|
return svgs[tier] || svgs[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
let maxBlocks = 1;
|
||||||
|
|
||||||
|
async function loadClients() {
|
||||||
|
const dot = document.getElementById('statusDot');
|
||||||
|
const statusText = document.getElementById('statusText');
|
||||||
|
const grid = document.getElementById('clientGrid');
|
||||||
|
|
||||||
|
statusText.textContent = 'Fetching data...';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const resp = await fetch('/api/clients');
|
||||||
|
const data = await resp.json();
|
||||||
|
|
||||||
|
if (data.error) {
|
||||||
|
dot.className = 'status-dot error';
|
||||||
|
statusText.textContent = data.error;
|
||||||
|
grid.innerHTML = `<div class="empty-state"><h2>Connection Failed</h2><p>${data.error}</p></div>`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dot.className = 'status-dot';
|
||||||
|
statusText.textContent = `${data.clients.length} clients tracked`;
|
||||||
|
document.getElementById('lastUpdated').textContent =
|
||||||
|
'Updated ' + new Date().toLocaleTimeString();
|
||||||
|
|
||||||
|
if (data.clients.length === 0) {
|
||||||
|
grid.innerHTML = `<div class="empty-state"><h2>No Block Data Yet</h2><p>AdGuard hasn't recorded any blocked clients in this period.</p></div>`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
maxBlocks = Math.max(...data.clients.map(c => c.blocks), 1);
|
||||||
|
|
||||||
|
grid.innerHTML = data.clients.map((client, i) => {
|
||||||
|
const color = TIER_COLORS[client.tier];
|
||||||
|
const pct = Math.round((client.blocks / maxBlocks) * 100);
|
||||||
|
const delay = i * 0.06;
|
||||||
|
return `
|
||||||
|
<div class="card" style="animation-delay:${delay}s">
|
||||||
|
<div class="card-accent" style="background:${color}"></div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="card-rank"># ${i + 1}</div>
|
||||||
|
<div class="char-frame" style="box-shadow: inset 0 0 40px ${color}18">
|
||||||
|
${charSVG(client.tier, color)}
|
||||||
|
<div class="tier-badge" style="background:${color}22;color:${color};border:1px solid ${color}44">
|
||||||
|
TIER ${client.tier}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="client-name">${client.name}</div>
|
||||||
|
<div class="tier-label" style="color:${color}">${client.label}</div>
|
||||||
|
<div class="tier-desc">${client.desc}</div>
|
||||||
|
<div class="block-count">
|
||||||
|
<span class="block-num" style="color:${color}">${client.blocks.toLocaleString()}</span>
|
||||||
|
<span class="block-lbl">blocks</span>
|
||||||
|
</div>
|
||||||
|
<div class="block-bar">
|
||||||
|
<div class="block-bar-fill" style="width:${pct}%;background:${color}"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
}).join('');
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
dot.className = 'status-dot error';
|
||||||
|
statusText.textContent = 'Fetch error';
|
||||||
|
grid.innerHTML = `<div class="empty-state"><h2>Error</h2><p>${err.message}</p></div>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loadClients();
|
||||||
|
setInterval(loadClients, 60000);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||