mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-07-01 16:35:37 +03:00
add client postup & postdown
This commit is contained in:
parent
a89fb34555
commit
03428646e1
5 changed files with 37 additions and 5 deletions
|
@ -157,6 +157,16 @@
|
|||
<label for="client_private_subnets" class="control-label">Private Subnets</label>
|
||||
<input type="text" data-role="tagsinput" class="form-control" id="client_private_subnets">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="client_post_up">Post Up Script</label>
|
||||
<input type="text" class="form-control" id="client_post_up" name="client_post_up"
|
||||
placeholder="Post Up Script">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="client_post_down">Post Down Script</label>
|
||||
<input type="text" class="form-control" id="client_post_down" name="client_post_down"
|
||||
placeholder="Post Down Script">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="icheck-primary d-inline">
|
||||
<input type="checkbox" id="enabled" checked>
|
||||
|
@ -279,6 +289,8 @@
|
|||
const allocated_ips = $("#client_allocated_ips").val().split(",");
|
||||
const allowed_ips = $("#client_allowed_ips").val().split(",");
|
||||
const private_subnets = $("#client_private_subnets").val().split(",");
|
||||
const post_up = $("#client_post_up").val();
|
||||
const post_down = $("#client_post_down").val();
|
||||
let enabled = false;
|
||||
|
||||
if ($("#enabled").is(':checked')){
|
||||
|
@ -286,7 +298,7 @@
|
|||
}
|
||||
|
||||
const data = {"name": name, "email": email, "allocated_ips": allocated_ips, "allowed_ips": allowed_ips, "private_subnets": private_subnets,
|
||||
"enabled": enabled};
|
||||
"post_up": post_up, "post_down": post_down, "enabled": enabled};
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
|
|
|
@ -62,6 +62,14 @@ Wireguard Clients
|
|||
<label for="_client_private_subnets" class="control-label">Private Subnet</label>
|
||||
<input type="text" data-role="tagsinput" class="form-control" id="_client_private_subnets">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="_client_post_up" class="control-label">Post Up</label>
|
||||
<input type="text" class="form-control" id="_client_post_up" name="_client_post_up">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="_client_post_down" class="control-label">Post Down</label>
|
||||
<input type="text" class="form-control" id="_client_post_down" name="_client_post_down">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="icheck-primary d-inline">
|
||||
<input type="checkbox" id="_enabled">
|
||||
|
@ -312,6 +320,8 @@ Wireguard Clients
|
|||
modal.find("#_client_private_subnets").addTag(obj);
|
||||
});
|
||||
|
||||
modal.find("#_client_post_up").val(client.post_up);
|
||||
modal.find("#_client_post_down").val(client.post_down);
|
||||
modal.find("#_enabled").prop("checked", client.enabled);
|
||||
},
|
||||
error: function (jqXHR, exception) {
|
||||
|
@ -330,6 +340,8 @@ Wireguard Clients
|
|||
const allocated_ips = $("#_client_allocated_ips").val().split(",");
|
||||
const allowed_ips = $("#_client_allowed_ips").val().split(",");
|
||||
const private_subnets = $("#_client_private_subnets").val().split(",");
|
||||
const post_up = $("#_client_post_up").val();
|
||||
const post_down = $("#_client_post_down").val();
|
||||
let enabled = false;
|
||||
|
||||
if ($("#_enabled").is(':checked')){
|
||||
|
@ -337,7 +349,7 @@ Wireguard Clients
|
|||
}
|
||||
|
||||
const data = {"id": client_id, "name": name, "email": email, "allocated_ips": allocated_ips, "private_subnets": private_subnets,
|
||||
"allowed_ips": allowed_ips, "enabled": enabled};
|
||||
"allowed_ips": allowed_ips, "post_up": post_up, "post_down": post_down, "enabled": enabled};
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue