diff --git a/templates/base.html b/templates/base.html
index a1d16ba..b3c254c 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -298,6 +298,12 @@
const allocated_ips = $("#client_allocated_ips").val().split(",");
const allowed_ips = $("#client_allowed_ips").val().split(",");
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')){
use_server_dns = true;
@@ -310,7 +316,7 @@
}
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({
cache: false,
diff --git a/templates/clients.html b/templates/clients.html
index 14a8d45..3f39a2a 100644
--- a/templates/clients.html
+++ b/templates/clients.html
@@ -390,8 +390,12 @@ Wireguard Clients
const email = $("#_client_email").val();
const allocated_ips = $("#_client_allocated_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 extra_allowed_ips = [];
+
+ if( $("#_client_extra_allowed_ips").val() !== "" ) {
+ extra_allowed_ips = $("#_client_extra_allowed_ips").val().split(",");
+ }
if ($("#_use_server_dns").is(':checked')){
use_server_dns = true;
diff --git a/templates/wg.conf b/templates/wg.conf
index 4005952..5ac207b 100644
--- a/templates/wg.conf
+++ b/templates/wg.conf
@@ -20,5 +20,5 @@ PostDown = {{ .serverConfig.Interface.PostDown }}
[Peer]
PublicKey = {{ .Client.PublicKey }}
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}}