diff --git a/README.md b/README.md new file mode 100644 index 0000000..17e31a3 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# WireGuard Portal + +[![Build Status](https://travis-ci.com/h44z/wg-portal.svg?token=q4pSqaqT58Jzpxdx62xk&branch=master)](https://travis-ci.com/h44z/wg-portal) diff --git a/assets/js/custom.js b/assets/js/custom.js index 8534ac4..005dc92 100644 --- a/assets/js/custom.js +++ b/assets/js/custom.js @@ -13,6 +13,18 @@ $(function () { $('[data-toggle="tooltip"]').tooltip() }); + + $(".online-status").each(function(){ + const onlineStatusID = "#" + $(this).attr('id'); + $.get( "/user/status?pkey=" + encodeURIComponent($(this).attr('data-pkey')), function( data ) { + console.log(onlineStatusID + " " + data) + if(data === true) { + $(onlineStatusID).html(''); + } else { + $(onlineStatusID).html(''); + } + }); + }); })(jQuery); // End of use strict diff --git a/assets/tpl/admin_create_clients.html b/assets/tpl/admin_create_clients.html index 53be56b..b36bbe7 100644 --- a/assets/tpl/admin_create_clients.html +++ b/assets/tpl/admin_create_clients.html @@ -18,12 +18,7 @@

Create new clients

Enter valid LDAP user email addresses to quickly create new accounts.

- {{if $.Alerts.HasAlert}} - - {{end}} - + {{template "prt_flashes.html" .}}
diff --git a/assets/tpl/admin_edit_client.html b/assets/tpl/admin_edit_client.html index 41203ce..92aa68c 100644 --- a/assets/tpl/admin_edit_client.html +++ b/assets/tpl/admin_edit_client.html @@ -19,22 +19,39 @@

Edit client {{.Peer.Identifier}}

{{end}} - {{if $.Alerts.HasAlert}} - - {{end}} + {{template "prt_flashes.html" .}} - - -
-
- - + {{if .EditableKeys}} +
+
+ + +
-
+
+
+ + +
+
+
+
+ + +
+
+ {{else}} + + +
+
+ + +
+
+ {{end}}
diff --git a/assets/tpl/admin_edit_interface.html b/assets/tpl/admin_edit_interface.html index 3a0380a..a8d870a 100644 --- a/assets/tpl/admin_edit_interface.html +++ b/assets/tpl/admin_edit_interface.html @@ -14,12 +14,7 @@ {{template "prt_nav.html" .}}

Edit interface {{.Device.DeviceName}}

- - {{if $.Alerts.HasAlert}} - - {{end}} + {{template "prt_flashes.html" .}} @@ -96,6 +91,7 @@ Cancel + Apply Allowed IP's to clients
{{template "prt_footer.html" .}} diff --git a/assets/tpl/admin_index.html b/assets/tpl/admin_index.html index 25be8a4..c059ea0 100644 --- a/assets/tpl/admin_index.html +++ b/assets/tpl/admin_index.html @@ -14,11 +14,7 @@ {{template "prt_nav.html" .}}

WireGuard VPN Administration

- {{if $.Alerts.HasAlert}} - - {{end}} + {{template "prt_flashes.html" .}}
@@ -116,6 +112,7 @@ + {{$p.Identifier}} {{$p.PublicKey}} @@ -162,7 +159,7 @@ {{if not $p.Peer}}

No Traffic data available...

{{else}} -

{{if $p.DeactivatedAt}}-{{else}}{{$p.Peer.ReceiveBytes}} / {{$p.Peer.TransmitBytes}}{{end}}

+

{{if $p.DeactivatedAt}}-{{else}} {{formatBytes $p.Peer.ReceiveBytes}} / {{formatBytes $p.Peer.TransmitBytes}}{{end}}

{{end}}
diff --git a/assets/tpl/index.html b/assets/tpl/index.html index c2e0a10..1536271 100644 --- a/assets/tpl/index.html +++ b/assets/tpl/index.html @@ -17,6 +17,7 @@ + {{template "prt_flashes.html" .}}

WireGuard® is an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more useful than IPsec, while avoiding the massive headache. It intends to be considerably more performant than OpenVPN.

VPN Profiles and configuration

diff --git a/assets/tpl/login.html b/assets/tpl/login.html index 8277098..f7f25f1 100644 --- a/assets/tpl/login.html +++ b/assets/tpl/login.html @@ -43,6 +43,7 @@
+ {{template "prt_flashes.html" .}}
diff --git a/assets/tpl/prt_flashes.html b/assets/tpl/prt_flashes.html new file mode 100644 index 0000000..f21c787 --- /dev/null +++ b/assets/tpl/prt_flashes.html @@ -0,0 +1,5 @@ +{{range $flash := $.Alerts}} + +{{end}} \ No newline at end of file diff --git a/assets/tpl/prt_nav.html b/assets/tpl/prt_nav.html index afb071a..c400cad 100644 --- a/assets/tpl/prt_nav.html +++ b/assets/tpl/prt_nav.html @@ -7,12 +7,12 @@