diff --git a/templates/wireguard/wireguard_peer_list.html b/templates/wireguard/wireguard_peer_list.html index eec8e6d..9719320 100644 --- a/templates/wireguard/wireguard_peer_list.html +++ b/templates/wireguard/wireguard_peer_list.html @@ -173,7 +173,6 @@ }); - + if (index < array.length - 1) { + allowedIpsElement.appendChild(document.createTextNode(', ')); + } + }); + }; + + const updateCalloutClass = (peerDiv, latestHandshake) => { + const calloutDiv = peerDiv.querySelector('.callout'); + calloutDiv.classList.remove('callout-success', 'callout-info', 'callout-warning', 'callout-danger'); + const handshakeAge = Date.now() / 1000 - parseInt(latestHandshake); + + if (latestHandshake === '0') { + calloutDiv.classList.add('callout-danger'); + } else if (handshakeAge < 600) { + calloutDiv.classList.add('callout-success'); + } else if (handshakeAge < 1800) { + calloutDiv.classList.add('callout-info'); + } else if (handshakeAge < 21600) { + calloutDiv.classList.add('callout-warning'); + } + calloutDiv.style.transition = 'all 5s'; + }; + {% endblock %} \ No newline at end of file