mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-04-21 20:12:33 +03:00
add new client save
This commit is contained in:
parent
3af15f58b9
commit
6ea4b6b7a7
3 changed files with 13 additions and 3 deletions
|
@ -298,6 +298,12 @@
|
||||||
const allocated_ips = $("#client_allocated_ips").val().split(",");
|
const allocated_ips = $("#client_allocated_ips").val().split(",");
|
||||||
const allowed_ips = $("#client_allowed_ips").val().split(",");
|
const allowed_ips = $("#client_allowed_ips").val().split(",");
|
||||||
let use_server_dns = false;
|
let use_server_dns = false;
|
||||||
|
let extra_allowed_ips = [];
|
||||||
|
|
||||||
|
if ($("#client_extra_allowed_ips").val() !== "") {
|
||||||
|
extra_allowed_ips = $("#client_extra_allowed_ips").val().split(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($("#use_server_dns").is(':checked')){
|
if ($("#use_server_dns").is(':checked')){
|
||||||
use_server_dns = true;
|
use_server_dns = true;
|
||||||
|
@ -310,7 +316,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = {"name": name, "email": email, "allocated_ips": allocated_ips, "allowed_ips": allowed_ips,
|
const data = {"name": name, "email": email, "allocated_ips": allocated_ips, "allowed_ips": allowed_ips,
|
||||||
"use_server_dns": use_server_dns, "enabled": enabled};
|
"extra_allowed_ips": extra_allowed_ips, "use_server_dns": use_server_dns, "enabled": enabled};
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
cache: false,
|
cache: false,
|
||||||
|
|
|
@ -390,8 +390,12 @@ Wireguard Clients
|
||||||
const email = $("#_client_email").val();
|
const email = $("#_client_email").val();
|
||||||
const allocated_ips = $("#_client_allocated_ips").val().split(",");
|
const allocated_ips = $("#_client_allocated_ips").val().split(",");
|
||||||
const allowed_ips = $("#_client_allowed_ips").val().split(",");
|
const allowed_ips = $("#_client_allowed_ips").val().split(",");
|
||||||
const extra_allowed_ips = $("#_client_extra_allowed_ips").val().split(",");
|
|
||||||
let use_server_dns = false;
|
let use_server_dns = false;
|
||||||
|
let extra_allowed_ips = [];
|
||||||
|
|
||||||
|
if( $("#_client_extra_allowed_ips").val() !== "" ) {
|
||||||
|
extra_allowed_ips = $("#_client_extra_allowed_ips").val().split(",");
|
||||||
|
}
|
||||||
|
|
||||||
if ($("#_use_server_dns").is(':checked')){
|
if ($("#_use_server_dns").is(':checked')){
|
||||||
use_server_dns = true;
|
use_server_dns = true;
|
||||||
|
|
|
@ -20,5 +20,5 @@ PostDown = {{ .serverConfig.Interface.PostDown }}
|
||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = {{ .Client.PublicKey }}
|
PublicKey = {{ .Client.PublicKey }}
|
||||||
PresharedKey = {{ .Client.PresharedKey }}
|
PresharedKey = {{ .Client.PresharedKey }}
|
||||||
AllowedIPs = {{$first :=true}}{{range .Client.AllocatedIPs }}{{if $first}}{{$first = false}}{{else}},{{end}}{{.}}{{end}}{{range .Client.ExtraAllowedIPs }}{{if ne . ""}},{{.}}{{else}}{{end}}{{end}}
|
AllowedIPs = {{$first :=true}}{{range .Client.AllocatedIPs }}{{if $first}}{{$first = false}}{{else}},{{end}}{{.}}{{end}}{{range .Client.ExtraAllowedIPs }},{{.}}{{end}}
|
||||||
{{end}}{{end}}
|
{{end}}{{end}}
|
||||||
|
|
Loading…
Add table
Reference in a new issue