mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-22 07:30:23 +00:00
Handle peer defaults
This commit is contained in:
parent
1431d44b52
commit
796ed558f7
5 changed files with 20 additions and 16 deletions
|
@ -357,7 +357,7 @@ function generateWgKey() {
|
||||||
var jsonData = JSON.parse(data);
|
var jsonData = JSON.parse(data);
|
||||||
console.log(jsonData);
|
console.log(jsonData);
|
||||||
$('#wg-srvpubkey').val(jsonData);
|
$('#wg-srvpubkey').val(jsonData);
|
||||||
$('#wg-srvpubkey-status').removeClass('check-hidden').addClass('check-updated').delay(500).animate({ opacity: 1 }, 700);
|
$('#wg-server-pubkey-status').removeClass('check-hidden').addClass('check-updated').delay(500).animate({ opacity: 1 }, 700);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"wireguard": {
|
"wireguard": {
|
||||||
"interface": {
|
"server": {
|
||||||
"address": [ "10.3.141.1/24" ],
|
"Address": [ "10.3.141.1/24" ],
|
||||||
"listenport": [ "51820" ],
|
"ListenPort": [ "51820" ],
|
||||||
"dns": [ "10.3.141.1" ]
|
"DNS": [ "10.3.141.1" ]
|
||||||
|
},
|
||||||
|
"peer": {
|
||||||
|
"Endpoint": [ "server ip:53" ],
|
||||||
|
"AllowedIPs": ["0.0.0.0/0"],
|
||||||
|
"PersistentKeepalive": [ "15" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,9 +107,9 @@ function DisplayWireGuardConfig()
|
||||||
$wg_srvipaddress = ($conf['Address'] == '') ? getDefaultNetValue('wireguard','server','Address') : $conf['Address'];
|
$wg_srvipaddress = ($conf['Address'] == '') ? getDefaultNetValue('wireguard','server','Address') : $conf['Address'];
|
||||||
$wg_srvpubkey = $conf['PublicKey'];
|
$wg_srvpubkey = $conf['PublicKey'];
|
||||||
$wg_srvprivkey = $conf['PrivateKey'];
|
$wg_srvprivkey = $conf['PrivateKey'];
|
||||||
$wg_endpoint = $conf['Endpoint'];
|
$wg_pendpoint = ($conf['Endpoint'] == '') ? getDefaultNetValue('wireguard','peer','Endpoint') : $conf['Endpoint'];
|
||||||
$wg_allowedips = $conf['AllowedIPs'];
|
$wg_pallowedips = ($conf['AllowedIPs'] == '') ? getDefaultNetValue('wireguard','peer','AllowedIPs') : $conf['AllowedIPs'];
|
||||||
$wg_pkeepalive = $conf['PersistentKeepalive'];
|
$wg_pkeepalive = ($conf['PersistentKeepalive'] == '') ? getDefaultNetValue('wireguard','peer','PersistentKeepalive') : $conf['PersistentKeepalive'];
|
||||||
|
|
||||||
// fetch service status
|
// fetch service status
|
||||||
exec('pidof wg-crypt-wg0 | wc -l', $wgstatus);
|
exec('pidof wg-crypt-wg0 | wc -l', $wgstatus);
|
||||||
|
@ -128,8 +128,8 @@ function DisplayWireGuardConfig()
|
||||||
"wg_srvipaddress",
|
"wg_srvipaddress",
|
||||||
"wg_srvpubkey",
|
"wg_srvpubkey",
|
||||||
"wg_srvprivkey",
|
"wg_srvprivkey",
|
||||||
"wg_endpoint",
|
"wg_pendpoint",
|
||||||
"wg_allowedips",
|
"wg_pallowedips",
|
||||||
"wg_pkeepalive"
|
"wg_pkeepalive"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<input type="text" class="form-control" name="wg-server" id="wg-srvpubkey" value="<?php echo htmlspecialchars($wg_srvpubkey, ENT_QUOTES); ?>" />
|
<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">
|
<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" type="button" onclick="generateWgKey()"><?php echo _("Generate key"); ?></button>
|
||||||
<span id="wg-srvpubkey-status" class="input-group-addon check-hidden ml-2 mt-1"><i class="fas fa-check"></i></span>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-xs-3 col-sm-6 mt-3">
|
<div class="form-group col-xs-3 col-sm-6 mt-3">
|
||||||
<label for="code"><?php echo _("Endpoint address"); ?></label>
|
<label for="code"><?php echo _("Endpoint address"); ?></label>
|
||||||
<input type="text" class="form-control" name="wg_endpoint" value="<?php echo htmlspecialchars($wg_endpoint, ENT_QUOTES); ?>" />
|
<input type="text" class="form-control" name="wg_pendpoint" value="<?php echo htmlspecialchars($wg_pendpoint, ENT_QUOTES); ?>" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-3 col-sm-6">
|
<div class="col-xs-3 col-sm-6">
|
||||||
<label for="code"><?php echo _("Allowed IPs"); ?></label>
|
<label for="code"><?php echo _("Allowed IPs"); ?></label>
|
||||||
<input type="text" class="form-control mb-3" name="wg_allowedips" placeholder="0.0.0.0/0" value="<?php echo htmlspecialchars($wg_allowedips, ENT_QUOTES); ?>" />
|
<input type="text" class="form-control mb-3" name="wg_pallowedips" placeholder="0.0.0.0/0" value="<?php echo htmlspecialchars($wg_pallowedips, ENT_QUOTES); ?>" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -39,15 +39,14 @@
|
||||||
<label for="code"><?php echo _("Peer public key"); ?></label>
|
<label for="code"><?php echo _("Peer public key"); ?></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group col-md-12 mb-3">
|
<div class="input-group col-md-12 mb-3">
|
||||||
<input type="text" class="form-control" name="wg_peerpubkey" value="<?php echo htmlspecialchars($wg_peerpubkey, ENT_QUOTES); ?>" />
|
<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">
|
<div class="input-group-append">
|
||||||
<button class="btn btn-sm btn-outline-secondary rounded-right" type="button" onclick="updateBlocklist()"><?php echo _("Generate key"); ?></button>
|
<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>
|
<span id="cbxblocklist-status" class="input-group-addon check-hidden ml-2 mt-1"><i class="fas fa-check"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /.row -->
|
</div><!-- /.row -->
|
||||||
</div><!-- /.tab-pane | peers tab -->
|
</div><!-- /.tab-pane | peers tab -->
|
||||||
|
|
Loading…
Reference in a new issue