Files
wireguard-admin/app/templates/peers.html
T
lofyerandfactory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> c4dc22074e Peer enhancements: notes, traffic quotas with auto-disable, batch create, usage tracking; relay subnets for bridging into other tunnels
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-07-04 07:34:57 +08:00

46 lines
2.2 KiB
HTML

{% extends "base.html" %}
{% block title %}Peers - WireGuard Admin{% endblock %}
{% block content %}
<h1>Peers</h1>
<form method="post" action="/peers" class="add-peer">
<input name="name" placeholder="Peer name" required>
<input name="note" placeholder="Note (optional)">
<label class="muted">Quota GiB <input name="quota_gib" type="number" step="0.1" min="0" class="narrow" placeholder="0"></label>
<label class="muted">Count <input name="count" type="number" min="1" max="50" value="1" class="narrow"></label>
<label class="muted">Expires <input name="expires_at" type="datetime-local"></label>
<button type="submit">Add peer(s)</button>
</form>
<p class="muted">Count &gt; 1 creates a batch named name-1, name-2, ... Quota 0 = unlimited.</p>
<table>
<thead>
<tr><th>Name</th><th>Address</th><th>Enabled</th><th>Status</th><th>Usage</th><th>Note</th><th></th></tr>
</thead>
<tbody>
{% for peer in peers %}
{% set ps = status.peers.get(peer.public_key) %}
<tr>
<td><a href="/peers/{{ peer.id }}">{{ peer.name }}</a></td>
<td>{{ peer.address }}</td>
<td>{% if peer.enabled %}<span class="badge ok">enabled</span>{% elif peer.over_quota %}<span class="badge err">over quota</span>{% else %}<span class="badge err">disabled</span>{% endif %}</td>
<td>{% if ps and ps.online %}<span class="badge ok">online</span>{% else %}<span class="badge muted">offline</span>{% endif %}</td>
<td class="muted">{{ peer.cum_total | fmt_bytes }}{% if peer.quota_bytes %} / {{ peer.quota_bytes | fmt_bytes }}{% endif %}</td>
<td class="muted">{{ peer.note }}</td>
<td class="actions">
<form method="post" action="/peers/{{ peer.id }}/toggle" class="inline">
<button type="submit">{{ "Disable" if peer.enabled else "Enable" }}</button>
</form>
<form method="post" action="/peers/{{ peer.id }}/delete" class="inline"
onsubmit="return confirm('Delete peer {{ peer.name }}?')">
<button type="submit" class="danger">Delete</button>
</form>
</td>
</tr>
{% else %}
<tr><td colspan="7" class="muted">No peers yet. Add one above.</td></tr>
{% endfor %}
</tbody>
</table>
{% endblock %}