Add Apply Config button to save wireguard config file

This commit is contained in:
Khanh Ngo 2020-04-23 09:29:44 +07:00
parent ea36311475
commit 7c3cac8084
No known key found for this signature in database
GPG key ID: D5FAA6A16150E49E
7 changed files with 177 additions and 2 deletions

View file

@ -55,6 +55,12 @@ Global Settings
name="persistent_keepalive" placeholder="Persistent Keepalive"
value="{{ .globalSettings.PersistentKeepalive }}">
</div>
<div class="form-group">
<label for="config_file_path">Wireguard Config File Path</label>
<input type="text" class="form-control" id="config_file_path"
name="config_file_path" placeholder="E.g. /etc/wireguard/wg0.conf"
value="{{ .globalSettings.ConfigFilePath }}">
</div>
</div>
<!-- /.card-body -->
@ -104,7 +110,8 @@ Global Settings
var dns_servers = $("#dns_servers").val().split(",");
var mtu = $("#mtu").val();
var persistent_keepalive = $("#persistent_keepalive").val();
var data = {"endpoint_address": endpoint_address, "dns_servers": dns_servers, "mtu": mtu, "persistent_keepalive": persistent_keepalive};
var config_file_path = $("#config_file_path").val();
var data = {"endpoint_address": endpoint_address, "dns_servers": dns_servers, "mtu": mtu, "persistent_keepalive": persistent_keepalive, "config_file_path": config_file_path};
$.ajax({
cache: false,
@ -173,6 +180,9 @@ Global Settings
persistent_keepalive: {
required: true,
digits: true
},
config_file_path: {
required: true
}
},
messages: {
@ -184,6 +194,9 @@ Global Settings
persistent_keepalive: {
required: "Please enter a Persistent Keepalive value",
digits: "Persistent keepalive must be an integer"
},
config_file_path: {
required: "Please enter WireGuard config file path"
}
},
errorElement: 'span',