mirror of
https://github.com/techgarage-ir/MTWireGuard.git
synced 2025-08-31 15:19:28 +02:00
Add project files.
This commit is contained in:
commit
b2325a46ef
1351 changed files with 48136 additions and 0 deletions
30
wwwroot/js/wgelements.js
Normal file
30
wwwroot/js/wgelements.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
const SVG_XLINK = "http://www.w3.org/1999/xlink";
|
||||
|
||||
function generateKeys(dom) {
|
||||
let keys = wireguard.generateKeypair();
|
||||
let privateKey = keys.privateKey;
|
||||
let publicKey = keys.publicKey;
|
||||
if (dom) {
|
||||
let frm = dom.closest('form');
|
||||
frm.querySelector('input[id$="PrivKey"]').value = privateKey;
|
||||
frm.querySelector('input[id$="PubKey"]').value = publicKey;
|
||||
}
|
||||
}
|
||||
|
||||
function changeIcon(btn) {
|
||||
let frm = btn.closest('form');
|
||||
let pk = frm.querySelector('input[id$="PubKey"]');
|
||||
pk.toggleAttribute('disabled');/*
|
||||
if (btn.getAttribute('id') == 'PUnlockBTN')
|
||||
document.getElementById('WGPPubKey').toggleAttribute('disabled');
|
||||
else
|
||||
document.getElementById('WGSPubKey').toggleAttribute('disabled');*/
|
||||
let svg = btn.children.item(0);
|
||||
let use = svg.children.item(0);
|
||||
let icon = use.getAttribute('xlink:href');
|
||||
if (icon.endsWith('unlocked')) {
|
||||
use.setAttributeNS(SVG_XLINK, 'xlink:href', 'vendors/coreui/icons/svg/free.svg#cil-lock-locked');
|
||||
} else {
|
||||
use.setAttributeNS(SVG_XLINK, 'xlink:href', 'vendors/coreui/icons/svg/free.svg#cil-lock-unlocked');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue