Let peers connect to a remote WireGuard endpoint

This commit is contained in:
Eduardo Silva
2026-11-23 20:30:11 -03:00
parent a5ad9c4bae
commit 2fee9ebd6a
13 changed files with 337 additions and 43 deletions
@@ -140,14 +140,16 @@
<!-- Row 2: server select (right aligned) -->
{% if cluster_settings and servers|length > 1 %}
<div class="d-flex w-100 mt-2">
<div class="form-inline ml-auto">
<label class="mr-2 mb-0" for="server_select">{% trans 'Server' %}:</label>
<select class="form-control" id="server_select" style="width: 300px;">
{% for server in servers %}
<option value="{{ server.uuid }}">{{ server.name }}</option>
{% endfor %}
</select>
<div class="w-100" id="serverSelectRow">
<div class="d-flex w-100 mt-2">
<div class="form-inline ml-auto">
<label class="mr-2 mb-0" for="server_select">{% trans 'Server' %}:</label>
<select class="form-control" id="server_select" style="width: 300px;">
{% for server in servers %}
<option value="{{ server.uuid }}">{{ server.name }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
{% endif %}
@@ -108,6 +108,8 @@
if (data.name) {
$('#peerPreviewModalLabel').text(data.name);
}
// A peer with an endpoint is a remote server: there is no client configuration to share
$('#downloadConfigButton, #qrcodeButton, #inviteButton, #serverSelectRow').toggleClass('d-none', !!data.endpoint);
// Check if peer has private_key and enable/disable buttons accordingly
if (!data.private_key_exists) {
$('#qrcodeButton').addClass('disabled').attr('aria-disabled', 'true');
@@ -90,6 +90,27 @@
</div>
</div>
<!-- Endpoint -->
<div class="form-group border-bottom pb-3">
<label>{% trans 'Endpoint' %}</label>
<div class="d-flex justify-content-between align-items-center">
<span>
{% if current_peer.endpoint %}
<code>{{ current_peer.endpoint }}</code>
{% if show_active_worker %}
<br><small class="text-muted">{% trans 'Connected server' %}: {{ current_peer.active_worker.name|default:_('Primary Server') }}</small>
{% endif %}
{% else %}
<span class="text-muted">{% trans 'Not set' %}</span>
{% endif %}
</span>
<a href="{% url 'wireguard_peer_edit_field' %}?peer={{ current_peer.uuid }}&group=endpoint"
class="btn btn-tool">
<i class="fas fa-pen"></i>
</a>
</div>
</div>
<!-- Keys Section -->
<div class="form-group">
<div class="d-flex justify-content-between align-items-center mb-2">