mirror of
https://github.com/DJSundog/wg-portal.git
synced 2024-11-23 15:13:52 -05:00
more ui improvements, fix peer template for clients
This commit is contained in:
parent
ba768dd2c3
commit
b4f3228bec
@ -89,3 +89,15 @@ a.advanced-settings:before {
|
|||||||
a.advanced-settings.collapsed:before {
|
a.advanced-settings.collapsed:before {
|
||||||
content: "Show";
|
content: "Show";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-group.global-config label:after, .custom-control.global-config label:after {
|
||||||
|
content: "g";
|
||||||
|
color: #0057bb;
|
||||||
|
font-size: xx-small;
|
||||||
|
top: -5px;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-blue {
|
||||||
|
color: #0057bb;
|
||||||
|
}
|
@ -77,23 +77,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12 global-config">
|
||||||
<label for="server_AllowedIP">Allowed IPs</label>
|
<label for="server_AllowedIP">Allowed IPs</label>
|
||||||
<input type="text" name="allowedip" class="form-control" id="server_AllowedIP" value="{{.Peer.AllowedIPsStr}}">
|
<input type="text" name="allowedip" class="form-control" id="server_AllowedIP" value="{{.Peer.AllowedIPsStr}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12 global-config">
|
||||||
<label for="server_DNS">Client DNS Servers</label>
|
<label for="server_DNS">Client DNS Servers</label>
|
||||||
<input type="text" name="dns" class="form-control" id="server_DNS" value="{{.Peer.DNSStr}}">
|
<input type="text" name="dns" class="form-control" id="server_DNS" value="{{.Peer.DNSStr}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6 global-config">
|
||||||
<label for="server_PersistentKeepalive">Persistent Keepalive (0 = off)</label>
|
<label for="server_PersistentKeepalive">Persistent Keepalive (0 = off)</label>
|
||||||
<input type="number" name="keepalive" class="form-control" id="server_PersistentKeepalive" placeholder="16" value="{{.Peer.PersistentKeepalive}}">
|
<input type="number" name="keepalive" class="form-control" id="server_PersistentKeepalive" placeholder="16" value="{{.Peer.PersistentKeepalive}}">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6 global-config">
|
||||||
<label for="server_MTU">Client MTU (0 = default)</label>
|
<label for="server_MTU">Client MTU (0 = default)</label>
|
||||||
<input type="number" name="mtu" class="form-control" id="server_MTU" placeholder="" value="{{.Peer.Mtu}}">
|
<input type="number" name="mtu" class="form-control" id="server_MTU" placeholder="" value="{{.Peer.Mtu}}">
|
||||||
</div>
|
</div>
|
||||||
@ -110,7 +110,7 @@
|
|||||||
<div class="custom-control custom-switch">
|
<div class="custom-control custom-switch">
|
||||||
<input class="custom-control-input" name="ignoreglobalsettings" type="checkbox" value="true" id="server_IgnoreGlobalSettings" {{if .Peer.IgnoreGlobalSettings}}checked{{end}}>
|
<input class="custom-control-input" name="ignoreglobalsettings" type="checkbox" value="true" id="server_IgnoreGlobalSettings" {{if .Peer.IgnoreGlobalSettings}}checked{{end}}>
|
||||||
<label class="custom-control-label" for="server_IgnoreGlobalSettings">
|
<label class="custom-control-label" for="server_IgnoreGlobalSettings">
|
||||||
Ignore global settings
|
Ignore global settings (<span class="text-blue">g</span>)
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -168,10 +168,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-6">
|
||||||
<label for="client_PersistentKeepalive">Persistent Keepalive (0 = off)</label>
|
<label for="client_PersistentKeepalive">Persistent Keepalive (0 = off)</label>
|
||||||
<input type="number" name="keepalive" class="form-control" id="client_PersistentKeepalive" placeholder="16" value="{{.Peer.PersistentKeepalive}}">
|
<input type="number" name="keepalive" class="form-control" id="client_PersistentKeepalive" placeholder="16" value="{{.Peer.PersistentKeepalive}}">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="client_IP">Ping-Check IP Address</label>
|
||||||
|
<input type="text" name="ip" class="form-control" id="client_IP" value="{{.Peer.IPsStr}}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
<input type="text" name="ip" class="form-control" id="server_IPs" placeholder="10.6.6.1/24" value="{{.Device.IPsStr}}" required>
|
<input type="text" name="ip" class="form-control" id="server_IPs" placeholder="10.6.6.1/24" value="{{.Device.IPsStr}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h3>Client's global configuration</h3>
|
<h3>Client's global configuration (<span class="text-blue">g</span>)</h3>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="server_PublicEndpoint">Public Endpoint for Clients</label>
|
<label for="server_PublicEndpoint">Public Endpoint for Clients</label>
|
||||||
@ -156,7 +156,7 @@
|
|||||||
|
|
||||||
<button type="submit" class="btn btn-primary">Save</button>
|
<button type="submit" class="btn btn-primary">Save</button>
|
||||||
<a href="/admin" class="btn btn-secondary">Cancel</a>
|
<a href="/admin" class="btn btn-secondary">Cancel</a>
|
||||||
<a href="/admin/device/applyglobals" class="btn btn-dark float-right">Apply Global Settings to clients</a>
|
<a href="/admin/device/applyglobals" class="btn btn-dark float-right">Apply Global Settings (<span class="text-blue">g</span>) to clients</a>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -147,8 +147,15 @@
|
|||||||
<th scope="col" class="list-image-cell"></th><!-- Status and expand -->
|
<th scope="col" class="list-image-cell"></th><!-- Status and expand -->
|
||||||
<th scope="col"><a href="?sort=id">Identifier <i class="fa fa-fw {{.Session.GetSortIcon "peers" "id"}}"></i></a></th>
|
<th scope="col"><a href="?sort=id">Identifier <i class="fa fa-fw {{.Session.GetSortIcon "peers" "id"}}"></i></a></th>
|
||||||
<th scope="col"><a href="?sort=pubKey">Public Key <i class="fa fa-fw {{.Session.GetSortIcon "peers" "pubKey"}}"></i></a></th>
|
<th scope="col"><a href="?sort=pubKey">Public Key <i class="fa fa-fw {{.Session.GetSortIcon "peers" "pubKey"}}"></i></a></th>
|
||||||
|
{{if eq $.Device.Type "server"}}
|
||||||
<th scope="col"><a href="?sort=mail">E-Mail <i class="fa fa-fw {{.Session.GetSortIcon "peers" "mail"}}"></i></a></th>
|
<th scope="col"><a href="?sort=mail">E-Mail <i class="fa fa-fw {{.Session.GetSortIcon "peers" "mail"}}"></i></a></th>
|
||||||
|
{{end}}
|
||||||
|
{{if eq $.Device.Type "server"}}
|
||||||
<th scope="col"><a href="?sort=ip">IP's <i class="fa fa-fw {{.Session.GetSortIcon "peers" "ip"}}"></i></a></th>
|
<th scope="col"><a href="?sort=ip">IP's <i class="fa fa-fw {{.Session.GetSortIcon "peers" "ip"}}"></i></a></th>
|
||||||
|
{{end}}
|
||||||
|
{{if eq $.Device.Type "client"}}
|
||||||
|
<th scope="col"><a href="?sort=endpoint">Endpoint <i class="fa fa-fw {{.Session.GetSortIcon "peers" "endpoint"}}"></i></a></th>
|
||||||
|
{{end}}
|
||||||
<th scope="col"><a href="?sort=handshake">Handshake <i class="fa fa-fw {{.Session.GetSortIcon "peers" "handshake"}}"></i></a></th>
|
<th scope="col"><a href="?sort=handshake">Handshake <i class="fa fa-fw {{.Session.GetSortIcon "peers" "handshake"}}"></i></a></th>
|
||||||
<th scope="col"></th><!-- Actions -->
|
<th scope="col"></th><!-- Actions -->
|
||||||
</tr>
|
</tr>
|
||||||
@ -164,8 +171,15 @@
|
|||||||
</th>
|
</th>
|
||||||
<td>{{$p.Identifier}}</td>
|
<td>{{$p.Identifier}}</td>
|
||||||
<td>{{$p.PublicKey}}</td>
|
<td>{{$p.PublicKey}}</td>
|
||||||
|
{{if eq $.Device.Type "server"}}
|
||||||
<td>{{$p.Email}}</td>
|
<td>{{$p.Email}}</td>
|
||||||
|
{{end}}
|
||||||
|
{{if eq $.Device.Type "server"}}
|
||||||
<td>{{$p.IPsStr}}</td>
|
<td>{{$p.IPsStr}}</td>
|
||||||
|
{{end}}
|
||||||
|
{{if eq $.Device.Type "client"}}
|
||||||
|
<td>{{$p.Endpoint}}</td>
|
||||||
|
{{end}}
|
||||||
<td><span data-toggle="tooltip" data-placement="left" title="" data-original-title="{{$p.LastHandshakeTime}}">{{$p.LastHandshake}}</span></td>
|
<td><span data-toggle="tooltip" data-placement="left" title="" data-original-title="{{$p.LastHandshakeTime}}">{{$p.LastHandshake}}</span></td>
|
||||||
<td>
|
<td>
|
||||||
{{if eq $.Session.IsAdmin true}}
|
{{if eq $.Session.IsAdmin true}}
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
<button class="btn btn-lg btn-primary btn-block mt-5" type="submit">Sign in</button>
|
<button class="btn btn-lg btn-primary btn-block mt-5" type="submit">Sign in</button>
|
||||||
|
|
||||||
{{ if eq .error true }}
|
{{ if eq .error true }}
|
||||||
<div class="alert alert-danger" role="alert">
|
<div class="alert alert-danger mt-3" role="alert">
|
||||||
{{.message}}
|
{{.message}}
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -106,7 +106,7 @@ func NewConfig() *Config {
|
|||||||
cfg.LDAP.DisabledAttribute = "userAccountControl"
|
cfg.LDAP.DisabledAttribute = "userAccountControl"
|
||||||
cfg.LDAP.AdminLdapGroup = "CN=WireGuardAdmins,OU=_O_IT,DC=COMPANY,DC=LOCAL"
|
cfg.LDAP.AdminLdapGroup = "CN=WireGuardAdmins,OU=_O_IT,DC=COMPANY,DC=LOCAL"
|
||||||
|
|
||||||
cfg.WG.DeviceNames = []string{"wg0", "wg1"}
|
cfg.WG.DeviceNames = []string{"wg0"}
|
||||||
cfg.WG.DefaultDeviceName = "wg0"
|
cfg.WG.DefaultDeviceName = "wg0"
|
||||||
cfg.WG.ConfigDirectoryPath = "/etc/wireguard"
|
cfg.WG.ConfigDirectoryPath = "/etc/wireguard"
|
||||||
cfg.WG.ManageIPAddresses = true
|
cfg.WG.ManageIPAddresses = true
|
||||||
|
@ -574,39 +574,7 @@ func (m *PeerManager) GetFilteredAndSortedPeers(device, sortKey, sortDirection,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Slice(filteredPeers, func(i, j int) bool {
|
sortPeers(sortKey, sortDirection, filteredPeers)
|
||||||
var sortValueLeft string
|
|
||||||
var sortValueRight string
|
|
||||||
|
|
||||||
switch sortKey {
|
|
||||||
case "id":
|
|
||||||
sortValueLeft = filteredPeers[i].Identifier
|
|
||||||
sortValueRight = filteredPeers[j].Identifier
|
|
||||||
case "pubKey":
|
|
||||||
sortValueLeft = filteredPeers[i].PublicKey
|
|
||||||
sortValueRight = filteredPeers[j].PublicKey
|
|
||||||
case "mail":
|
|
||||||
sortValueLeft = filteredPeers[i].Email
|
|
||||||
sortValueRight = filteredPeers[j].Email
|
|
||||||
case "ip":
|
|
||||||
sortValueLeft = filteredPeers[i].IPsStr
|
|
||||||
sortValueRight = filteredPeers[j].IPsStr
|
|
||||||
case "handshake":
|
|
||||||
if filteredPeers[i].Peer == nil {
|
|
||||||
return false
|
|
||||||
} else if filteredPeers[j].Peer == nil {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
sortValueLeft = filteredPeers[i].Peer.LastHandshakeTime.Format(time.RFC3339)
|
|
||||||
sortValueRight = filteredPeers[j].Peer.LastHandshakeTime.Format(time.RFC3339)
|
|
||||||
}
|
|
||||||
|
|
||||||
if sortDirection == "asc" {
|
|
||||||
return sortValueLeft < sortValueRight
|
|
||||||
} else {
|
|
||||||
return sortValueLeft > sortValueRight
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return filteredPeers
|
return filteredPeers
|
||||||
}
|
}
|
||||||
@ -619,6 +587,12 @@ func (m *PeerManager) GetSortedPeersForEmail(sortKey, sortDirection, email strin
|
|||||||
m.populatePeerData(&peers[i])
|
m.populatePeerData(&peers[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sortPeers(sortKey, sortDirection, peers)
|
||||||
|
|
||||||
|
return peers
|
||||||
|
}
|
||||||
|
|
||||||
|
func sortPeers(sortKey string, sortDirection string, peers []Peer) {
|
||||||
sort.Slice(peers, func(i, j int) bool {
|
sort.Slice(peers, func(i, j int) bool {
|
||||||
var sortValueLeft string
|
var sortValueLeft string
|
||||||
var sortValueRight string
|
var sortValueRight string
|
||||||
@ -636,6 +610,9 @@ func (m *PeerManager) GetSortedPeersForEmail(sortKey, sortDirection, email strin
|
|||||||
case "ip":
|
case "ip":
|
||||||
sortValueLeft = peers[i].IPsStr
|
sortValueLeft = peers[i].IPsStr
|
||||||
sortValueRight = peers[j].IPsStr
|
sortValueRight = peers[j].IPsStr
|
||||||
|
case "endpoint":
|
||||||
|
sortValueLeft = peers[i].Endpoint
|
||||||
|
sortValueRight = peers[j].Endpoint
|
||||||
case "handshake":
|
case "handshake":
|
||||||
if peers[i].Peer == nil {
|
if peers[i].Peer == nil {
|
||||||
return true
|
return true
|
||||||
@ -652,8 +629,6 @@ func (m *PeerManager) GetSortedPeersForEmail(sortKey, sortDirection, email strin
|
|||||||
return sortValueLeft > sortValueRight
|
return sortValueLeft > sortValueRight
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return peers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *PeerManager) GetDevice(device string) Device {
|
func (m *PeerManager) GetDevice(device string) Device {
|
||||||
|
@ -17,7 +17,7 @@ MTU = {{.Peer.Mtu}}
|
|||||||
{{- end}}
|
{{- end}}
|
||||||
|
|
||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = {{ .Peer.PublicKey }}
|
PublicKey = {{ .Interface.PublicKey }}
|
||||||
Endpoint = {{ .Peer.Endpoint }}
|
Endpoint = {{ .Peer.Endpoint }}
|
||||||
{{- if .Peer.AllowedIPsStr}}
|
{{- if .Peer.AllowedIPsStr}}
|
||||||
AllowedIPs = {{ .Peer.AllowedIPsStr }}
|
AllowedIPs = {{ .Peer.AllowedIPsStr }}
|
||||||
|
Loading…
Reference in New Issue
Block a user