mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-04-19 19:59:13 +03:00
Merge branch 'master' of github.com:ngoduykhanh/wireguard-ui
This commit is contained in:
commit
65db3671a6
2 changed files with 19 additions and 3 deletions
|
@ -4,7 +4,9 @@ set -e
|
|||
DIR=$(dirname "$0")
|
||||
|
||||
# install node modules
|
||||
yarn install --pure-lockfile --production
|
||||
YARN=yarn
|
||||
[ -x /usr/bin/lsb_release ] && [ -n "`lsb_release -i | grep Debian`" ] && YARN=yarnpkg
|
||||
$YARN install --pure-lockfile --production
|
||||
|
||||
# Copy admin-lte dist
|
||||
mkdir -p "${DIR}/assets/dist/js" "${DIR}/assets/dist/css" && \
|
||||
|
|
|
@ -14,6 +14,20 @@ Connected Peers
|
|||
{{end}}
|
||||
|
||||
{{define "page_content"}}
|
||||
<script>
|
||||
function bytesToHumanReadable(temporal) {
|
||||
const units = [" ", " K", " M", " G", " T", " P", " E", " Z", " Y"]
|
||||
let pow = 0
|
||||
|
||||
while (temporal > 1024) {
|
||||
temporal /= 1024
|
||||
pow ++
|
||||
if (pow == units.length-1) break
|
||||
}
|
||||
|
||||
return parseFloat(temporal.toFixed(3)) + units[pow]+"Bytes"
|
||||
}
|
||||
</script>
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
{{ if .error }}
|
||||
|
@ -41,8 +55,8 @@ Connected Peers
|
|||
<td>{{ $peer.Name }}</td>
|
||||
<td>{{ $peer.Email }}</td>
|
||||
<td>{{ $peer.PublicKey }}</td>
|
||||
<td>{{ $peer.ReceivedBytes }}</td>
|
||||
<td>{{ $peer.TransmitBytes }}</td>
|
||||
<td title="{{ $peer.ReceivedBytes }} Bytes"><script>document.write(bytesToHumanReadable({{ $peer.ReceivedBytes }}))</script></td>
|
||||
<td title="{{ $peer.TransmitBytes }} Bytes"><script>document.write(bytesToHumanReadable({{ $peer.TransmitBytes }}))</script></td>
|
||||
<td>{{ $peer.Connected }}</td>
|
||||
<td>{{ $peer.LastHandshakeTime }}</td>
|
||||
</tr>
|
||||
|
|
Loading…
Add table
Reference in a new issue