mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-07-25 19:54:06 +03:00
Fix PreUp, PostUp, PreDown, and PostDown
* Escaping HTML in several places. * Adds PreUp config when one didn't exist. * Adds environment variable support for PreUp and PreDown. closes #549 closes #655 closes #656 See also -------- - https://github.com/samrocketman/addons-homeassistant/issues/9 Co-authored-by: Robert Willert <rwillert@users.noreply.github.com>
This commit is contained in:
parent
2fdafd34ca
commit
2084a81297
10 changed files with 55 additions and 22 deletions
|
@ -37,21 +37,26 @@ Wireguard Server Settings
|
|||
<input type="text" class="form-control" id="listen_port" name="listen_port"
|
||||
placeholder="Listen Port" value="{{ .serverInterface.ListenPort }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pre_up">Pre Up Script</label>
|
||||
<input type="text" class="form-control" id="pre_up" name="pre_up"
|
||||
placeholder="Pre Up Script" value="{{ .serverInterface.PreUp | attrescaper }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="post_up">Post Up Script</label>
|
||||
<input type="text" class="form-control" id="post_up" name="post_up"
|
||||
placeholder="Post Up Script" value="{{ .serverInterface.PostUp }}">
|
||||
placeholder="Post Up Script" value="{{ .serverInterface.PostUp | attrescaper }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pre_down">Pre Down Script</label>
|
||||
<input type="text" class="form-control" id="pre_down" name="pre_down"
|
||||
placeholder="Pre Down Script" value="{{ .serverInterface.PreDown }}">
|
||||
placeholder="Pre Down Script" value="{{ .serverInterface.PreDown | attrescaper }}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="post_down">Post Down Script</label>
|
||||
<input type="text" class="form-control" id="post_down" name="post_down"
|
||||
placeholder="Post Down Script" value="{{ .serverInterface.PostDown }}">
|
||||
placeholder="Post Down Script" value="{{ .serverInterface.PostDown | attrescaper }}">
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
|
@ -135,10 +140,11 @@ Wireguard Server Settings
|
|||
function submitServerInterfaceSetting() {
|
||||
const addresses = $("#addresses").val().split(",");
|
||||
const listen_port = $("#listen_port").val();
|
||||
const pre_up = $("#pre_up").val();
|
||||
const post_up = $("#post_up").val();
|
||||
const pre_down = $("#pre_down").val();
|
||||
const post_down = $("#post_down").val();
|
||||
const data = {"addresses": addresses, "listen_port": listen_port, "post_up": post_up, "pre_down": pre_down, "post_down": post_down};
|
||||
const data = {"addresses": addresses, "listen_port": listen_port, "pre_up": pre_up, "post_up": post_up, "pre_down": pre_down, "post_down": post_down};
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
<button type="button"
|
||||
class="btn btn-outline-primary btn-sm btn_modify_wake_on_lan_host"
|
||||
data-toggle="modal" data-target="#modal_wake_on_lan_host"
|
||||
data-name="{{ .Name }}" data-mac-address="{{ .MacAddress }}">Edit
|
||||
data-name="{{ .Name | attrescaper }}" data-mac-address="{{ .MacAddress }}">Edit
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-danger btn-sm" data-toggle="modal"
|
||||
data-target="#modal_remove_wake_on_lan_host"
|
||||
|
@ -98,7 +98,7 @@
|
|||
</button>
|
||||
</div>
|
||||
<hr>
|
||||
<span class="info-box-text"><i class="fas fa-address-card"></i> <span class="name">{{ .Name }}</span></span>
|
||||
<span class="info-box-text"><i class="fas fa-address-card"></i> <span class="name">{{ .Name | attrescaper }}</span></span>
|
||||
<span class="info-box-text"><i class="fas fa-ethernet"></i> <span class="mac-address">{{ .MacAddress }}</span></span>
|
||||
<span class="info-box-text"><i class="fas fa-clock"></i>
|
||||
<span class="latest-used">
|
||||
|
@ -120,4 +120,4 @@
|
|||
{{end}}
|
||||
{{define "bottom_js"}}
|
||||
<script src="{{.basePath}}/static/custom/js/wake_on_lan_hosts.js"></script>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
|
|
@ -8,6 +8,7 @@ Address = {{$first :=true}}{{range .serverConfig.Interface.Addresses }}{{if $fir
|
|||
ListenPort = {{ .serverConfig.Interface.ListenPort }}
|
||||
PrivateKey = {{ .serverConfig.KeyPair.PrivateKey }}
|
||||
{{if .globalSettings.MTU}}MTU = {{ .globalSettings.MTU }}{{end}}
|
||||
PreUp = {{ .serverConfig.Interface.PreUp }}
|
||||
PostUp = {{ .serverConfig.Interface.PostUp }}
|
||||
PreDown = {{ .serverConfig.Interface.PreDown }}
|
||||
PostDown = {{ .serverConfig.Interface.PostDown }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue