mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2025-08-26 13:21:14 +00:00
Peer list with details
This commit is contained in:
@@ -30,6 +30,9 @@ class PeerAllowedIPForm(forms.ModelForm):
|
||||
priority = cleaned_data.get('priority')
|
||||
allowed_ip = cleaned_data.get('allowed_ip')
|
||||
netmask = cleaned_data.get('netmask')
|
||||
if allowed_ip is None:
|
||||
raise forms.ValidationError("Please provide a valid IP address.")
|
||||
|
||||
wireguard_network = ipaddress.ip_network(f"{self.current_peer.wireguard_instance.address}/{self.current_peer.wireguard_instance.netmask}", strict=False)
|
||||
|
||||
if priority == 0:
|
||||
|
@@ -119,7 +119,7 @@ def view_wireguard_peer_manage(request):
|
||||
if current_peer.name:
|
||||
page_title += current_peer.name
|
||||
else:
|
||||
page_title += current_peer.public_key
|
||||
page_title += current_peer.public_key[:16] + ("..." if len(current_peer.public_key) > 16 else "")
|
||||
if request.method == 'POST':
|
||||
form = PeerForm(request.POST, instance=current_peer)
|
||||
if form.is_valid():
|
||||
@@ -157,7 +157,7 @@ def view_manage_ip_address(request):
|
||||
if current_peer.name:
|
||||
page_title += current_peer.name
|
||||
else:
|
||||
page_title += current_peer.public_key
|
||||
page_title += current_peer.public_key[:10] + ("..." if len(current_peer.public_key) > 16 else "")
|
||||
if request.GET.get('action') == 'delete':
|
||||
if request.GET.get('confirmation') == 'delete':
|
||||
current_ip.delete()
|
||||
|
Reference in New Issue
Block a user