mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-22 07:30:23 +00:00
Update wg-keygen for server + peer
This commit is contained in:
parent
796ed558f7
commit
b7ed2960c1
3 changed files with 10 additions and 11 deletions
|
@ -350,16 +350,15 @@ function clearBlocklistStatus() {
|
|||
}
|
||||
|
||||
// Handler for the wireguard generate key button
|
||||
function generateWgKey() {
|
||||
var entity = $('#wg-srvpubkey').attr('name');
|
||||
console.log(entity);
|
||||
$.post('ajax/networking/get_wgkey.php',{'entity':entity },function(data){
|
||||
$('.wg-keygen').click(function(){
|
||||
var entity = $(this).parent('div').prev('input[type="text"]');
|
||||
var updated = entity.attr('name')+"-pubkey-status";
|
||||
$.post('ajax/networking/get_wgkey.php',{'entity':entity.attr('name') },function(data){
|
||||
var jsonData = JSON.parse(data);
|
||||
console.log(jsonData);
|
||||
$('#wg-srvpubkey').val(jsonData);
|
||||
$('#wg-server-pubkey-status').removeClass('check-hidden').addClass('check-updated').delay(500).animate({ opacity: 1 }, 700);
|
||||
entity.val(jsonData);
|
||||
$('#' + updated).removeClass('check-hidden').addClass('check-updated').delay(500).animate({ opacity: 1 }, 700);
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// Static Array method
|
||||
Array.range = (start, end) => Array.from({length: (end - start)}, (v, k) => k + start);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<div class="input-group col-md-12 mb-3">
|
||||
<input type="text" class="form-control" name="wg-server" id="wg-srvpubkey" value="<?php echo htmlspecialchars($wg_srvpubkey, ENT_QUOTES); ?>" />
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-sm btn-outline-secondary rounded-right" type="button" onclick="generateWgKey()"><?php echo _("Generate key"); ?></button>
|
||||
<button class="btn btn-sm btn-outline-secondary rounded-right wg-keygen" type="button"><?php echo _("Generate key"); ?></button>
|
||||
<span id="wg-server-pubkey-status" class="input-group-addon check-hidden ml-2 mt-1"><i class="fas fa-check"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
<div class="input-group col-md-12 mb-3">
|
||||
<input type="text" class="form-control" name="wg-peer" id="wg-peerpubkey" value="<?php echo htmlspecialchars($wg_peerpubkey, ENT_QUOTES); ?>" />
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-sm btn-outline-secondary rounded-right" type="button" onclick="generateWgKey()"><?php echo _("Generate key"); ?></button>
|
||||
<span id="cbxblocklist-status" class="input-group-addon check-hidden ml-2 mt-1"><i class="fas fa-check"></i></span>
|
||||
<button class="btn btn-sm btn-outline-secondary rounded-right wg-keygen" type="button"><?php echo _("Generate key"); ?></button>
|
||||
<span id="wg-peer-pubkey-status" class="input-group-addon check-hidden ml-2 mt-1"><i class="fas fa-check"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue