Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
50 lines
2.5 KiB
HTML
50 lines
2.5 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Peers - WireGuard Admin{% endblock %}
|
|
{% block breadcrumbs %}<span>/</span> <span>Peers</span>{% endblock %}
|
|
{% block content %}
|
|
<h1>Peers</h1>
|
|
|
|
{% if error %}<p class="error">{{ error }}</p>{% endif %}
|
|
<form method="post" action="/peers" class="add-peer">
|
|
<input name="name" placeholder="Peer name" required>
|
|
<input name="note" placeholder="Note (optional)">
|
|
<input name="address" placeholder="IP (auto if empty)" class="mid">
|
|
<input name="dns" placeholder="DNS (default {{ settings.wg_dns }})" class="mid">
|
|
<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 > 1 creates a batch named name-1, name-2, ... (custom IP ignored). 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 %}
|