Files
2026-05-21 23:14:36 +02:00

99 lines
3.8 KiB
HTML

<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ title }}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<main class="wrap">
<header class="hero card">
<div>
<h1>{{ title }}</h1>
<p>JSON verwalten, systemd-Template-Instanzen synchronisieren und einzelne Weiterleitungen starten oder stoppen.</p>
</div>
<div class="actions">
<form method="post" action="{{ url_for('daemon_reload') }}"><button>systemd reload</button></form>
<form method="post" action="{{ url_for('reconcile') }}"><button class="primary">JSON synchronisieren</button></form>
</div>
</header>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<section class="stack">
{% for category, message in messages %}
<div class="flash {{ category }}">{{ message }}</div>
{% endfor %}
</section>
{% endif %}
{% endwith %}
<section class="grid two">
<article class="card">
<h2>Rolle</h2>
<form method="post" action="{{ url_for('set_role') }}" class="stack">
<select name="role">
<option value="oracle" {% if config.role == 'oracle' %}selected{% endif %}>oracle</option>
<option value="pi" {% if config.role == 'pi' %}selected{% endif %}>pi</option>
</select>
<button>Rolle speichern</button>
</form>
</article>
<article class="card">
<h2>Neue Regel</h2>
<form method="post" action="{{ url_for('add_rule') }}" class="stack">
<input name="name" placeholder="icarus-game" required>
<select name="proto"><option value="udp">udp</option><option value="tcp">tcp</option></select>
<input name="listen_port" placeholder="17777" type="number" min="1" max="65535" required>
<input name="target_host" placeholder="2001:db8::1234 oder 192.168.178.50" required>
<input name="target_port" placeholder="17777" type="number" min="1" max="65535" required>
<button class="primary">Regel hinzufügen</button>
</form>
</article>
</section>
<section class="card">
<h2>Weiterleitungen</h2>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Name</th>
<th>Proto</th>
<th>Listen</th>
<th>Ziel</th>
<th>Aktiv</th>
<th>Enabled</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
{% for rule in rules %}
<tr>
<td>{{ rule.name }}</td>
<td>{{ rule.proto }}</td>
<td>{{ rule.listen_port }}</td>
<td>{{ rule.target_host }}:{{ rule.target_port }}</td>
<td><span class="badge {{ rule.active }}">{{ rule.active }}</span></td>
<td><span class="badge muted">{{ rule.enabled }}</span></td>
<td>
<div class="row-actions">
<form method="post" action="{{ url_for('toggle_rule', name=rule.name) }}"><button>{% if rule.active == 'active' %}Stop{% else %}Start{% endif %}</button></form>
<form method="post" action="{{ url_for('restart_rule', name=rule.name) }}"><button>Restart</button></form>
<form method="post" action="{{ url_for('delete_rule', name=rule.name) }}" onsubmit="return confirm('Regel wirklich löschen?');"><button class="danger">Löschen</button></form>
</div>
</td>
</tr>
{% else %}
<tr><td colspan="7">Noch keine Regeln vorhanden.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
</section>
</main>
</body>
</html>