diff --git a/freedombox/modules/wireguard/__init__.py b/freedombox/modules/wireguard/__init__.py index 1cd55c7b9..f9fad4a80 100644 --- a/freedombox/modules/wireguard/__init__.py +++ b/freedombox/modules/wireguard/__init__.py @@ -104,4 +104,5 @@ class WireguardApp(app_module.App): def uninstall(self): """De-configure and uninstall the app.""" utils.delete_connections() + utils.client_remove_all_names() super().uninstall() diff --git a/freedombox/modules/wireguard/forms.py b/freedombox/modules/wireguard/forms.py index fc4e5c82a..953315d26 100644 --- a/freedombox/modules/wireguard/forms.py +++ b/freedombox/modules/wireguard/forms.py @@ -66,6 +66,10 @@ def validate_ip_addresses(value: str): class AddClientForm(forms.Form): """Form to add client.""" + name = forms.CharField( + label=_('Name'), strip=True, + help_text=_('A memorable name to associate with the client.')) + public_key = forms.CharField( label=_('Public Key'), strip=True, help_text=_( 'Public key of the client to add. Use the provided value or ' diff --git a/freedombox/modules/wireguard/templates/wireguard.html b/freedombox/modules/wireguard/templates/wireguard.html index b2b0bbfab..52113cb29 100644 --- a/freedombox/modules/wireguard/templates/wireguard.html +++ b/freedombox/modules/wireguard/templates/wireguard.html @@ -26,6 +26,7 @@
| {% trans "Name" %} | {% trans "Public Key" %} | {% trans "Client IP addresses" %} | {% trans "Last Connected Time" %} | @@ -36,9 +37,10 @@||
|---|---|---|---|---|---|
| - {{ peer.public_key }} + {{ peer.name }} | +{{ peer.public_key }} | {{ peer.allowed_ips|join:", " }} | {{ peer.status.latest_handshake|default:'' }} | ||
| {% trans "Client" %} | |||||
| {% trans "Name" %} | +{{ client_name }} + {% trans "(Use this or set one yourself)" %} + |
+ ||||
| {% trans "Public Key" %} | {{ client_pubkey }} diff --git a/freedombox/modules/wireguard/templates/wireguard_auto_add_client.html b/freedombox/modules/wireguard/templates/wireguard_auto_add_client.html index 8001c59d2..a543a5a75 100644 --- a/freedombox/modules/wireguard/templates/wireguard_auto_add_client.html +++ b/freedombox/modules/wireguard/templates/wireguard_auto_add_client.html @@ -12,7 +12,22 @@ {{ title }}
- {% trans "New client added with public key:" %} {{ client_pubkey }}
+ {% blocktrans trimmed %}
+ New client '{{ client_name }}' added with public key: {{ client_pubkey }}
+ {% endblocktrans %}
+
+
+
diff --git a/freedombox/modules/wireguard/templates/wireguard_delete_client.html b/freedombox/modules/wireguard/templates/wireguard_delete_client.html index c19cda0d8..c8d8ecc38 100644 --- a/freedombox/modules/wireguard/templates/wireguard_delete_client.html +++ b/freedombox/modules/wireguard/templates/wireguard_delete_client.html @@ -13,9 +13,18 @@ {% trans "Are you sure that you want to delete this client?" %} -- {{ public_key }} - +
| ||||