diff --git a/templates/wireguard/wireguard_peer_list.html b/templates/wireguard/wireguard_peer_list.html
index 9719320..59d59b1 100644
--- a/templates/wireguard/wireguard_peer_list.html
+++ b/templates/wireguard/wireguard_peer_list.html
@@ -1,4 +1,12 @@
{% extends "base.html" %}
+{% block page_custom_head %}
+
+{% endblock %}
+
{% block content %}
{% if wireguard_instances %}
@@ -46,12 +54,13 @@
- Throughput:
- Transfer:
- Latest Handshake:
- {% if peer.peerstatus.last_handshake %}{{ peer.peerstatus.last_handshake|date:"U" }}{% else %}0{% endif %}
+
+
+
+
- Endpoints:
+
+
@@ -75,6 +85,7 @@
{% else %}
Create Peer
{% endif %}
+
@@ -187,7 +198,7 @@
var peerTransfer = peerElem.querySelector('[id^="peer-transfer-"]').innerText;
var peerHandshake = peerElem.querySelector('[id^="peer-latest-handshake-"]').innerText;
var peerEndpoints = peerElem.querySelector('[id^="peer-endpoints-"]').innerText;
- var peerAllowedIPs = peerElem.querySelector('[id^="peer-allowed-ips-"]').innerText;
+ var peerAllowedIPs = peerElem.querySelector('[id^="peer-allowed-ips-"]').innerHTML;
// Update the modal fields with the card values
$('#peerPreviewModalLabel').text(peerNameFromCard);
@@ -195,7 +206,7 @@
$('#peerTransfer').text(peerTransfer);
$('#peerHandshake').text(peerHandshake);
$('#peerEndpoints').text(peerEndpoints);
- $('#peerAllowedIPs').text(peerAllowedIPs);
+ $('#peerAllowedIPs').html(peerAllowedIPs);
$('#editPeerButton').attr('href', '/peer/manage/?peer=' + uuid);
$('#downloadConfigButton').attr('href', '/tools/download_peer_config/?uuid=' + uuid);
$('#qrcodeButton').attr('href', '/tools/download_peer_config/?uuid=' + uuid + '&format=qrcode');
@@ -384,27 +395,39 @@
};
const checkAllowedIps = (allowedIpsElement, allowedIpsApiResponse) => {
- const apiIps = allowedIpsApiResponse[0].split(' ');
- const htmlIpsText = allowedIpsElement.textContent.trim();
- const htmlIpsArray = htmlIpsText.match(/\b(?:\d{1,3}\.){3}\d{1,3}\/\d{1,2}\b/g) || [];
+ const apiIps = allowedIpsApiResponse[0].split(' ');
+ const htmlIpsText = allowedIpsElement.textContent.trim();
+ const htmlIpsArray = htmlIpsText.match(/\b(?:\d{1,3}\.){3}\d{1,3}\/\d{1,2}\b/g) || [];
- allowedIpsElement.innerHTML = '';
- htmlIpsArray.forEach((ip, index, array) => {
- const ipSpan = document.createElement('span');
- ipSpan.textContent = ip;
- allowedIpsElement.appendChild(ipSpan);
+ allowedIpsElement.innerHTML = '';
+ let showExtraInfo = false;
- if (!apiIps.includes(ip)) {
- ipSpan.style.color = 'red';
- ipSpan.style.textDecoration = 'underline';
- ipSpan.title = 'This address does not appear in the wg show command output, likely indicating that another peer has an IP overlapping this network or that the configuration file is outdated.';
- }
+ htmlIpsArray.forEach((ip, index, array) => {
+ const ipSpan = document.createElement('span');
+ ipSpan.textContent = ip;
+ allowedIpsElement.appendChild(ipSpan);
+
+ if (!apiIps.includes(ip)) {
+ ipSpan.style.color = 'red';
+ ipSpan.style.textDecoration = 'underline';
+ ipSpan.title = 'This address does not appear in the wg show command output, likely indicating that another peer has an IP overlapping this network or that the configuration file is outdated.';
+ showExtraInfo = true;
+ }
+
+ if (index < array.length - 1) {
+ allowedIpsElement.appendChild(document.createTextNode(', '));
+ }
+ });
+
+ if (showExtraInfo) {
+ const extraInfoContainerId = allowedIpsElement.id.replace('peer-allowed-ips-', 'peer-extra-info-allowed-ips-');
+ const extraInfoContainer = document.getElementById(extraInfoContainerId);
+ if (extraInfoContainer) {
+ extraInfoContainer.style.display = 'block';
+ }
+ }
+};
- if (index < array.length - 1) {
- allowedIpsElement.appendChild(document.createTextNode(', '));
- }
- });
- };
const updateCalloutClass = (peerDiv, latestHandshake) => {
const calloutDiv = peerDiv.querySelector('.callout');
@@ -424,4 +447,18 @@
};
+
+
+
{% endblock %}
\ No newline at end of file