From 5902a8d6a014ca94884c302ccf09eb40b667fdcc Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 1 Jan 2025 00:37:25 -0800 Subject: [PATCH] Update template + wg-keygen js handler --- app/js/custom.js | 12 ++++++------ templates/wg/peers.php | 6 ++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/js/custom.js b/app/js/custom.js index 53ea7ae3..c33a5d5a 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -623,18 +623,18 @@ function clearBlocklistStatus() { $('#cbxblocklist-status').removeClass('check-updated').addClass('check-hidden'); } -// Handler for the wireguard generate key button +// Handler for the WireGuard generate key button $('.wg-keygen').click(function(){ - var entity_pub = $(this).parent('div').prev('input[type="text"]'); - var entity_priv = $(this).parent('div').next('input[type="hidden"]'); + var parentGroup = $(this).closest('.input-group'); + var entity_pub = parentGroup.find('input[type="text"]'); var updated = entity_pub.attr('name')+"-pubkey-status"; - var csrfToken = $('meta[name=csrf_token]').attr('content'); + var csrfToken = $('meta[name="csrf_token"]').attr('content'); $.post('ajax/networking/get_wgkey.php',{'entity':entity_pub.attr('name'), 'csrf_token': csrfToken},function(data){ var jsonData = JSON.parse(data); entity_pub.val(jsonData.pubkey); $('#' + updated).removeClass('check-hidden').addClass('check-updated').delay(500).animate({ opacity: 1 }, 700); - }) -}) + }); +}); // Handler for wireguard client.conf download $('.wg-client-dl').click(function(){ diff --git a/templates/wg/peers.php b/templates/wg/peers.php index fad228c4..a625b4c9 100644 --- a/templates/wg/peers.php +++ b/templates/wg/peers.php @@ -21,10 +21,8 @@
-
- - -
+
+