mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-07-04 16:55:57 +03:00
Add PostUp and PostDown script for clients interface
This commit is contained in:
parent
efbc36d61f
commit
05cfe56ab9
5 changed files with 43 additions and 3 deletions
|
@ -186,6 +186,14 @@
|
|||
</label>
|
||||
<input type="text" data-role="tagsinput" class="form-control" id="client_extra_allowed_ips" value="{{ StringsJoin .client_defaults.ExtraAllowedIps "," }}">
|
||||
</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="use_server_dns" {{ if .client_defaults.UseServerDNS }}checked{{ end }}>
|
||||
|
@ -343,6 +351,8 @@
|
|||
const allowed_ips = $("#client_allowed_ips").val().split(",");
|
||||
let use_server_dns = false;
|
||||
let extra_allowed_ips = [];
|
||||
const post_up = $("#client_post_up").val();
|
||||
const post_down = $("#client_post_down").val();
|
||||
|
||||
if ($("#client_extra_allowed_ips").val() !== "") {
|
||||
extra_allowed_ips = $("#client_extra_allowed_ips").val().split(",");
|
||||
|
@ -362,8 +372,8 @@
|
|||
const preshared_key = $("#client_preshared_key").val();
|
||||
|
||||
const data = {"name": name, "email": email, "allocated_ips": allocated_ips, "allowed_ips": allowed_ips,
|
||||
"extra_allowed_ips": extra_allowed_ips, "use_server_dns": use_server_dns, "enabled": enabled,
|
||||
"public_key": public_key, "preshared_key": preshared_key};
|
||||
"extra_allowed_ips": extra_allowed_ips, "post_up": post_up, "post_down": post_down, "use_server_dns": use_server_dns,
|
||||
"enabled": enabled, "public_key": public_key, "preshared_key": preshared_key};
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
|
@ -485,6 +495,8 @@
|
|||
$("#client_preshared_key").val("");
|
||||
$("#client_allocated_ips").importTags('');
|
||||
$("#client_extra_allowed_ips").importTags('');
|
||||
$("#client_post_up").val("");
|
||||
$("#client_post_down").val("");
|
||||
updateIPAllocationSuggestion();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue