usage -> traffic
This commit is contained in:
parent
117d713ee1
commit
ebc5173bd0
|
@ -98,7 +98,7 @@ These options can be configured by setting environment variables using `-e KEY="
|
||||||
| `WG_PRE_DOWN` | `...` | - | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L27) for the default value. |
|
| `WG_PRE_DOWN` | `...` | - | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L27) for the default value. |
|
||||||
| `WG_POST_DOWN` | `...` | `iptables ...` | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L28) for the default value. |
|
| `WG_POST_DOWN` | `...` | `iptables ...` | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L28) for the default value. |
|
||||||
| `LANG` | `en` | `de` | Web UI language (Supports: en, ru, tr, no, pl, fr, de, ca, es, vi, nl, is, chs, cht,). |
|
| `LANG` | `en` | `de` | Web UI language (Supports: en, ru, tr, no, pl, fr, de, ca, es, vi, nl, is, chs, cht,). |
|
||||||
| `UI_USAGE_STATS` | `false` | `true` | Enable detailed RX / TX client stats in Web UI |
|
| `UI_TRAFFIC_STATS` | `false` | `true` | Enable detailed RX / TX client stats in Web UI |
|
||||||
|
|
||||||
> If you change `WG_PORT`, make sure to also change the exposed port.
|
> If you change `WG_PORT`, make sure to also change the exposed port.
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ services:
|
||||||
# - WG_POST_UP=echo "Post Up" > /etc/wireguard/post-up.txt
|
# - WG_POST_UP=echo "Post Up" > /etc/wireguard/post-up.txt
|
||||||
# - WG_PRE_DOWN=echo "Pre Down" > /etc/wireguard/pre-down.txt
|
# - WG_PRE_DOWN=echo "Pre Down" > /etc/wireguard/pre-down.txt
|
||||||
# - WG_POST_DOWN=echo "Post Down" > /etc/wireguard/post-down.txt
|
# - WG_POST_DOWN=echo "Post Down" > /etc/wireguard/post-down.txt
|
||||||
# - UI_USAGE_STATS=true
|
# - UI_TRAFFIC_STATS=true
|
||||||
|
|
||||||
image: ghcr.io/wg-easy/wg-easy
|
image: ghcr.io/wg-easy/wg-easy
|
||||||
container_name: wg-easy
|
container_name: wg-easy
|
||||||
|
|
|
@ -29,4 +29,4 @@ iptables -A FORWARD -o wg0 -j ACCEPT;
|
||||||
module.exports.WG_PRE_DOWN = process.env.WG_PRE_DOWN || '';
|
module.exports.WG_PRE_DOWN = process.env.WG_PRE_DOWN || '';
|
||||||
module.exports.WG_POST_DOWN = process.env.WG_POST_DOWN || '';
|
module.exports.WG_POST_DOWN = process.env.WG_POST_DOWN || '';
|
||||||
module.exports.LANG = process.env.LANG || 'en';
|
module.exports.LANG = process.env.LANG || 'en';
|
||||||
module.exports.UI_USAGE_STATS = process.env.UI_USAGE_STATS || 'false';
|
module.exports.UI_TRAFFIC_STATS = process.env.UI_TRAFFIC_STATS || 'false';
|
||||||
|
|
|
@ -18,7 +18,7 @@ const {
|
||||||
RELEASE,
|
RELEASE,
|
||||||
PASSWORD,
|
PASSWORD,
|
||||||
LANG,
|
LANG,
|
||||||
UI_USAGE_STATS,
|
UI_TRAFFIC_STATS,
|
||||||
} = require('../config');
|
} = require('../config');
|
||||||
|
|
||||||
module.exports = class Server {
|
module.exports = class Server {
|
||||||
|
@ -45,8 +45,8 @@ module.exports = class Server {
|
||||||
.get('/api/lang', (Util.promisify(async () => {
|
.get('/api/lang', (Util.promisify(async () => {
|
||||||
return LANG;
|
return LANG;
|
||||||
})))
|
})))
|
||||||
.get('/api/ui-usage-stats', (Util.promisify(async () => {
|
.get('/api/ui-traffic-stats', (Util.promisify(async () => {
|
||||||
return UI_USAGE_STATS === 'true';
|
return UI_TRAFFIC_STATS === 'true';
|
||||||
})))
|
})))
|
||||||
|
|
||||||
// Authentication
|
// Authentication
|
||||||
|
|
|
@ -162,7 +162,7 @@
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<!-- Inline Transfer TX -->
|
<!-- Inline Transfer TX -->
|
||||||
<span v-if="!uiUsageStats && client.transferTx" :title="$t('totalDownload') + bytes(client.transferTx)">
|
<span v-if="!uiTrafficStats && client.transferTx" :title="$t('totalDownload') + bytes(client.transferTx)">
|
||||||
·
|
·
|
||||||
<svg class="align-middle h-3 inline" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
<svg class="align-middle h-3 inline" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
||||||
<path fill-rule="evenodd"
|
<path fill-rule="evenodd"
|
||||||
|
@ -173,7 +173,7 @@
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<!-- Inline Transfer RX -->
|
<!-- Inline Transfer RX -->
|
||||||
<span v-if="!uiUsageStats && client.transferRx" :title="$t('totalUpload') + bytes(client.transferRx)">
|
<span v-if="!uiTrafficStats && client.transferRx" :title="$t('totalUpload') + bytes(client.transferRx)">
|
||||||
·
|
·
|
||||||
<svg class="align-middle h-3 inline" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
<svg class="align-middle h-3 inline" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
||||||
<path fill-rule="evenodd"
|
<path fill-rule="evenodd"
|
||||||
|
@ -185,13 +185,13 @@
|
||||||
<!-- Last seen -->
|
<!-- Last seen -->
|
||||||
<span class="text-gray-400 dark:text-neutral-500" v-if="client.latestHandshakeAt"
|
<span class="text-gray-400 dark:text-neutral-500" v-if="client.latestHandshakeAt"
|
||||||
:title="$t('lastSeen') + dateTime(new Date(client.latestHandshakeAt))">
|
:title="$t('lastSeen') + dateTime(new Date(client.latestHandshakeAt))">
|
||||||
{{!uiUsageStats ? " · " : ""}}{{new Date(client.latestHandshakeAt) | timeago}}
|
{{!uiTrafficStats ? " · " : ""}}{{new Date(client.latestHandshakeAt) | timeago}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Info -->
|
<!-- Info -->
|
||||||
<div v-if="uiUsageStats"
|
<div v-if="uiTrafficStats"
|
||||||
class="flex gap-2 items-center shrink-0 text-gray-400 dark:text-neutral-400 text-xs mt-px justify-end">
|
class="flex gap-2 items-center shrink-0 text-gray-400 dark:text-neutral-400 text-xs mt-px justify-end">
|
||||||
|
|
||||||
<!-- Transfer TX -->
|
<!-- Transfer TX -->
|
||||||
|
|
|
@ -43,10 +43,10 @@ class API {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getuiUsageStats() {
|
async getuiTrafficStats() {
|
||||||
return this.call({
|
return this.call({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
path: '/ui-usage-stats',
|
path: '/ui-traffic-stats',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ new Vue({
|
||||||
latestRelease: null,
|
latestRelease: null,
|
||||||
|
|
||||||
isDark: null,
|
isDark: null,
|
||||||
uiUsageStats: false,
|
uiTrafficStats: false,
|
||||||
|
|
||||||
chartOptions: {
|
chartOptions: {
|
||||||
chart: {
|
chart: {
|
||||||
|
@ -293,13 +293,13 @@ new Vue({
|
||||||
}).catch(console.error);
|
}).catch(console.error);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
this.api.getuiUsageStats()
|
this.api.getuiTrafficStats()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.uiUsageStats = res;
|
this.uiTrafficStats = res;
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
console.log('Failed to get ui-usage-stats');
|
console.log('Failed to get ui-traffic-stats');
|
||||||
this.uiUsageStats = false;
|
this.uiTrafficStats = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
Promise.resolve().then(async () => {
|
Promise.resolve().then(async () => {
|
||||||
|
|
Loading…
Reference in New Issue