mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Add handler for wg client.conf download
This commit is contained in:
parent
ee634c4b50
commit
1c158eade7
@ -361,6 +361,26 @@ $('.wg-keygen').click(function(){
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Handler for wireguard client.conf download
|
||||||
|
$('.wg-client-dl').click(function(){
|
||||||
|
var req = new XMLHttpRequest();
|
||||||
|
var url = 'ajax/networking/get_wgcfg.php';
|
||||||
|
req.open('get', url, true);
|
||||||
|
req.responseType = 'blob';
|
||||||
|
req.setRequestHeader('Content-type', 'text/plain; charset=UTF-8');
|
||||||
|
console.log(req);
|
||||||
|
req.onreadystatechange = function (event) {
|
||||||
|
if(req.readyState == 4 && req.status == 200) {
|
||||||
|
var blob = req.response;
|
||||||
|
var link=document.createElement('a');
|
||||||
|
link.href=window.URL.createObjectURL(blob);
|
||||||
|
link.download = 'client.conf';
|
||||||
|
link.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
req.send();
|
||||||
|
})
|
||||||
|
|
||||||
// Event listener for Bootstrap's form validation
|
// Event listener for Bootstrap's form validation
|
||||||
window.addEventListener('load', function() {
|
window.addEventListener('load', function() {
|
||||||
// Fetch all the forms we want to apply custom Bootstrap validation styles to
|
// Fetch all the forms we want to apply custom Bootstrap validation styles to
|
||||||
|
Loading…
Reference in New Issue
Block a user