Allianz: Verbindung zur Website, Mitgliederabgleich und anstehende Raids
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
750428c5b2
commit
294dbc69cc
4 changed files with 103 additions and 2 deletions
15
app.py
15
app.py
|
|
@ -939,6 +939,21 @@ async def mod_case_revoke(request: Request, case_id: int):
|
|||
return RedirectResponse(back, status_code=303)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Allianz
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@app.get("/allianz", response_class=HTMLResponse)
|
||||
async def alliance_page(request: Request):
|
||||
user = current_user(request)
|
||||
require_area(user, "alliance")
|
||||
try:
|
||||
data, error = await siel._request("GET", "/api/alliance"), None
|
||||
except siel.SielError as exc:
|
||||
data, error = None, str(exc)
|
||||
return render(request, "alliance.html", user, data=data, error=error)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ input, select, textarea, button { font: inherit; }
|
|||
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
|
||||
.dot-on { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }
|
||||
.dot-off { background: var(--text-muted); }
|
||||
.dot-err { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
|
||||
|
||||
.roadmap { margin: 0; padding-left: 1.2rem; }
|
||||
.roadmap li { margin: 0.3rem 0; }
|
||||
|
|
|
|||
85
templates/alliance.html
Normal file
85
templates/alliance.html
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
{% extends "base.html" %}
|
||||
{% block title %}Allianz{% endblock %}
|
||||
{% block content %}
|
||||
<div class="page-head">
|
||||
<h1>Allianz</h1>
|
||||
<p class="muted">Siel und lumina-ascendens.de: die Raids der Elyos Allianz und der Abgleich der Mitglieder. Raids legt ihr weiter auf der Website an, den Raid-Kanal wählt ihr dort unter Verwaltung → Discord-Bot.</p>
|
||||
</div>
|
||||
{% if error %}
|
||||
<div class="flash flash-error">{{ error }}</div>
|
||||
{% else %}
|
||||
{% set w = data.website %}
|
||||
{% set m = data.members %}
|
||||
<div class="cards">
|
||||
<div class="card">
|
||||
<div class="card-label">Website</div>
|
||||
{% if w.url and w.callback_key and w.api_key %}
|
||||
<div class="stat"><span class="dot {{ 'dot-on' if w.last_contact.at else 'dot-off' }}"></span>{{ "Verbunden" if w.last_contact.at else "Eingerichtet" }}</div>
|
||||
<div class="muted small">
|
||||
{% if w.last_contact.at %}Letzter Kontakt {{ w.last_contact.at | datetime }}{% else %}Die Website hat sich seit dem letzten Start von Siel noch nicht gemeldet.{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="stat"><span class="dot dot-off"></span>Nicht eingerichtet</div>
|
||||
<div class="muted small">In /root/sielbot/.env fehlt:
|
||||
{% if not w.url %}WEBSITE_URL {% endif %}{% if not w.callback_key %}WEBSITE_BOT_KEY {% endif %}{% if not w.api_key %}WEBSITE_API_KEY{% endif %}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-label">Mitgliederabgleich</div>
|
||||
{% if m.error %}
|
||||
<div class="stat"><span class="dot dot-err"></span>Fehler</div>
|
||||
<div class="muted small">{{ m.error.text }} ({{ m.error.at | datetime }})</div>
|
||||
{% elif m.last_sync %}
|
||||
<div class="stat"><span class="dot dot-on"></span>Aktiv</div>
|
||||
<div class="muted small">{{ m.last_sync | datetime }}: {{ m.last_sync_result }}</div>
|
||||
{% else %}
|
||||
<div class="stat"><span class="dot dot-off"></span>{{ "Wartet" if not m.last_sync_result else "Ausgesetzt" }}</div>
|
||||
<div class="muted small">{{ m.last_sync_result or "Der erste Abgleich läuft kurz nach dem Start von Siel, danach alle 30 Minuten." }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-label">Server</div>
|
||||
{% for g in m.guilds %}
|
||||
<div class="stat stat-sm">{{ g.name }}</div>
|
||||
<div class="muted small">{{ g.member_count }} Mitglieder · {{ "Elyos Allianz" if g.dach else "Legion – nur Mitgliederliste" }}{% if not g.loaded %} · lädt noch …{% endif %}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="panel">
|
||||
<h2>Anstehende Raids <span class="muted">({{ data.raids.active | length }})</span></h2>
|
||||
{% if data.raids.active %}
|
||||
<div class="table-wrap">
|
||||
<table class="table">
|
||||
<thead><tr><th>Raid</th><th>Start</th><th>Kanal</th><th>Angemeldet</th><th>Ersatzbank</th><th>Abgemeldet</th><th>Raid-Lead</th></tr></thead>
|
||||
<tbody>
|
||||
{% for r in data.raids.active %}
|
||||
<tr>
|
||||
<td><strong>{{ r.title }}</strong></td>
|
||||
<td class="small nowrap">{{ r.timestamp | datetime }}</td>
|
||||
<td class="small">{{ "#" ~ r.channel if r.channel else "–" }}</td>
|
||||
<td>{{ r.signed_up }} / {{ r.max_slots }}</td>
|
||||
<td>{{ r.bench }}</td>
|
||||
<td>{{ r.declined }}</td>
|
||||
<td class="small">{{ r.lead or "–" }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="muted">Gerade steht kein Raid an. Neue Raids der Elyos Allianz legt ihr auf <a href="https://lumina-ascendens.de/raids.php?bereich=consilium" target="_blank" rel="noopener">lumina-ascendens.de</a> an.</p>
|
||||
{% endif %}
|
||||
<p class="muted small">{{ data.raids.archived }} archivierte Raids. Archivierte Raid-Nachrichten verschwinden etwa eine Minute nach dem Archivieren aus dem Discord-Kanal.</p>
|
||||
</section>
|
||||
|
||||
{% if w.last_contact.errors %}
|
||||
<section class="panel">
|
||||
<h2>Letzte Fehler</h2>
|
||||
<ul class="plain">
|
||||
{% for e in w.last_contact.errors %}<li class="small"><span class="muted">{{ e.at | datetime }}</span> {{ e.text }}</li>{% endfor %}
|
||||
</ul>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
<title>{% block title %}Siel{% endblock %} · Elyos Allianz</title>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/img/favicon-32.png">
|
||||
<link rel="apple-touch-icon" href="/static/img/favicon-180.png">
|
||||
<link rel="stylesheet" href="/static/css/panel.css?v=10">
|
||||
<link rel="stylesheet" href="/static/css/panel.css?v=11">
|
||||
</head>
|
||||
<body>
|
||||
{% if user %}
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
{% endif %}
|
||||
{% endfor %}
|
||||
<div class="nav-heading">Funktionen</div>
|
||||
{% for area, label, href, ic in [("welcome", "Begrüßung", "/begruessung", "welcome"), ("reactionroles", "Reaktionsrollen", "/reaktionsrollen", "smile"), ("moderation", "Moderation", "/moderation", "shield"), ("tickets", "Tickets", "/tickets", "ticket"), ("alliance", "Allianz", None, "users")] %}
|
||||
{% for area, label, href, ic in [("welcome", "Begrüßung", "/begruessung", "welcome"), ("reactionroles", "Reaktionsrollen", "/reaktionsrollen", "smile"), ("moderation", "Moderation", "/moderation", "shield"), ("tickets", "Tickets", "/tickets", "ticket"), ("alliance", "Allianz", "/allianz", "users")] %}
|
||||
{% if area in user.areas %}
|
||||
{% if href %}
|
||||
<a href="{{ href }}" class="nav-link{% if path == href or path.startswith(href ~ "/") %} active{% endif %}">{{ icon(ic) }}<span>{{ label }}</span></a>
|
||||
|
|
|
|||
Loading…
Reference in a new issue