From 68ea077d74c0982d1276f319aa9e96175df9b70c Mon Sep 17 00:00:00 2001 From: Emile Nijssen Date: Mon, 22 Nov 2021 22:54:42 +0100 Subject: [PATCH 1/3] update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b59263a..a70165e 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ To update to the latest version, simply run: ```bash docker stop wg-easy docker rm wg-easy +docker pull weejewel/wg-easy ``` And then run the `docker run -d \ ...` command above again. \ No newline at end of file From 03e8544097670b684c4cac19923df260ddd30828 Mon Sep 17 00:00:00 2001 From: Emile Nijssen Date: Mon, 22 Nov 2021 22:57:29 +0100 Subject: [PATCH 2/3] update readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index a70165e..026cc2f 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,10 @@ The Web UI will now be available on `http://0.0.0.0:51821`. > 💡 Your configuration files will be saved in `~/.wg-easy` +### 3. Sponsor + +Are you enjoying this project? [Buy me a beer!](https://github.com/sponsors/WeeJeWel) 🍻 + ## Options These options can be configured by setting environment variables using `-e KEY="VALUE"` in the `docker run` command. From 1b036c3b4cdb84790937bc087dc274a023fbc93d Mon Sep 17 00:00:00 2001 From: Emile Nijssen Date: Mon, 29 Nov 2021 18:03:39 +0100 Subject: [PATCH 3/3] Add total Download/Upload in title --- src/www/index.html | 4 ++-- src/www/js/app.js | 36 +++++++++++++++++++----------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/www/index.html b/src/www/index.html index 6db84e1..d4d6521 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -154,7 +154,7 @@ - + · @@ -166,7 +166,7 @@ - + · diff --git a/src/www/js/app.js b/src/www/js/app.js index 095115f..df65975 100644 --- a/src/www/js/app.js +++ b/src/www/js/app.js @@ -227,26 +227,10 @@ new Vue({ }, }, filters: { + bytes, timeago: value => { return timeago().format(value); }, - bytes: (bytes, decimals, kib, maxunit) => { - kib = kib || false; - if (bytes === 0) return '0 B'; - if (Number.isNaN(parseFloat(bytes)) && !Number.isFinite(bytes)) return 'NaN'; - const k = kib ? 1024 : 1000; - const dm = decimals != null && !Number.isNaN(decimals) && decimals >= 0 ? decimals : 2; - const sizes = kib - ? ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB', 'BiB'] - : ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB', 'BB']; - let i = Math.floor(Math.log(bytes) / Math.log(k)); - if (maxunit !== undefined) { - const index = sizes.indexOf(maxunit); - if (index !== -1) i = index; - } - // eslint-disable-next-line no-restricted-properties - return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`; - }, }, mounted() { this.api = new API(); @@ -292,3 +276,21 @@ new Vue({ }).catch(console.error); }, }); + +function bytes(bytes, decimals, kib, maxunit) { + kib = kib || false; + if (bytes === 0) return '0 B'; + if (Number.isNaN(parseFloat(bytes)) && !Number.isFinite(bytes)) return 'NaN'; + const k = kib ? 1024 : 1000; + const dm = decimals != null && !Number.isNaN(decimals) && decimals >= 0 ? decimals : 2; + const sizes = kib + ? ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB', 'BiB'] + : ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB', 'BB']; + let i = Math.floor(Math.log(bytes) / Math.log(k)); + if (maxunit !== undefined) { + const index = sizes.indexOf(maxunit); + if (index !== -1) i = index; + } + // eslint-disable-next-line no-restricted-properties + return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`; +}