From c1d541b78ff112936c5fd08450384f96758e3852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kasi=C4=8D?= Date: Sat, 6 Nov 2021 13:15:14 +0100 Subject: [PATCH 01/20] Fix generating IPv6 address (#105) --- handler/routes.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/handler/routes.go b/handler/routes.go index 8e8289f..8fcbab7 100644 --- a/handler/routes.go +++ b/handler/routes.go @@ -621,7 +621,11 @@ func SuggestIPAllocation(db store.IStore) echo.HandlerFunc { fmt.Sprintf("Cannot suggest ip allocation: failed to get available ip from network %s", cidr), }) } - suggestedIPs = append(suggestedIPs, fmt.Sprintf("%s/32", ip)) + if (strings.Contains(ip, ":")) { + suggestedIPs = append(suggestedIPs, fmt.Sprintf("%s/128", ip)) + } else { + suggestedIPs = append(suggestedIPs, fmt.Sprintf("%s/32", ip)) + } } return c.JSON(http.StatusOK, suggestedIPs) From cb6dd3cef1bc882537709547d0201830023e9e30 Mon Sep 17 00:00:00 2001 From: Daniel Scrivano Date: Sat, 6 Nov 2021 05:15:24 -0700 Subject: [PATCH 02/20] fix typo (#104) --- templates/wg.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/wg.conf b/templates/wg.conf index f4b1981..1e240b9 100644 --- a/templates/wg.conf +++ b/templates/wg.conf @@ -1,5 +1,5 @@ # This file was generated using wireguard-ui (https://github.com/ngoduykhanh/wireguard-ui) -# Please don't modify it manually, otherwise your change might got replaced. +# Please don't modify it manually, otherwise your change might get replaced. # Address updated at: {{ .serverConfig.Interface.UpdatedAt }} # Private Key updated at: {{ .serverConfig.KeyPair.UpdatedAt }} From 4093722926f7f2234616e7abe5ebed619d3410ab Mon Sep 17 00:00:00 2001 From: Seubpong Monsar Date: Tue, 9 Nov 2021 17:01:42 +0700 Subject: [PATCH 03/20] Fixed typo (#113) --- README.md | 2 +- docker-compose.yaml | 2 +- main.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 496121f..dec0978 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ In order to sent the wireguard configuration to clients via email (using sendgri ``` SENDGRID_API_KEY: Your sendgrid api key -EMAIL_FROM: the email address you registered on sendgrid +EMAIL_FROM_ADDRESS: the email address you registered on sendgrid EMAIL_FROM_NAME: the sender's email address ``` diff --git a/docker-compose.yaml b/docker-compose.yaml index ffcd9b1..814a671 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -10,7 +10,7 @@ services: network_mode: host environment: - SENDGRID_API_KEY - - EMAIL_FROM + - EMAIL_FROM_ADDRESS - EMAIL_FROM_NAME - SESSION_SECRET - WGUI_USERNAME=alpha diff --git a/main.go b/main.go index fe1ba68..6c1ff12 100644 --- a/main.go +++ b/main.go @@ -34,7 +34,7 @@ var ( const ( defaultEmailSubject = "Your wireguard configuration" defaultEmailContent = `Hi,
-

in this email you can file your personal configuration for our wireguard server.

+

In this email you can find your personal configuration for our wireguard server.

Best

` From 93e3e847f2b52f295c91a45968924eb17a75f5fc Mon Sep 17 00:00:00 2001 From: Hoang Nguyen <50922013+catmandx@users.noreply.github.com> Date: Tue, 9 Nov 2021 17:06:19 +0700 Subject: [PATCH 04/20] Update helper.js (#66) --- custom/js/helper.js | 7 ++----- handler/routes.go | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/custom/js/helper.js b/custom/js/helper.js index feab9ac..c386ca0 100644 --- a/custom/js/helper.js +++ b/custom/js/helper.js @@ -27,11 +27,8 @@ function renderClientList(data) {
- - + Download diff --git a/handler/routes.go b/handler/routes.go index 8fcbab7..db837db 100644 --- a/handler/routes.go +++ b/handler/routes.go @@ -346,7 +346,7 @@ func DownloadClient(db store.IStore) echo.HandlerFunc { reader := strings.NewReader(config) // set response header for downloading - c.Response().Header().Set(echo.HeaderContentDisposition, "attachment; filename=wg0.conf") + c.Response().Header().Set(echo.HeaderContentDisposition, fmt.Sprintf("attachment; filename=%s.conf", clientData.Client.Name)) return c.Stream(http.StatusOK, "text/plain", reader) } } From 4829dd3cfda460b76a0d45144041864b5d11dd89 Mon Sep 17 00:00:00 2001 From: Yumin Wu Date: Fri, 12 Nov 2021 20:39:50 +0800 Subject: [PATCH 05/20] fix:Convenient to use the enter key on the keyboard (#116) --- templates/login.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/login.html b/templates/login.html index 9bfaeb5..174ef6f 100644 --- a/templates/login.html +++ b/templates/login.html @@ -57,7 +57,7 @@
- +
From 80ce35b133ad4d7d87fe305d1c6b551fb9109bdc Mon Sep 17 00:00:00 2001 From: Khanh Ngo Date: Fri, 12 Nov 2021 14:29:52 +0100 Subject: [PATCH 06/20] Adjust datetime format in UI (#117) --- custom/js/helper.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/custom/js/helper.js b/custom/js/helper.js index c386ca0..c9ecefe 100644 --- a/custom/js/helper.js +++ b/custom/js/helper.js @@ -43,9 +43,9 @@ function renderClientList(data) { ${obj.Client.name} ${obj.Client.email} - ${obj.Client.created_at} + ${prettyDateTime(obj.Client.created_at)} - ${obj.Client.updated_at} + ${prettyDateTime(obj.Client.updated_at)} ${obj.Client.use_server_dns ? 'DNS enabled' : 'DNS disabled'} IP Allocation` @@ -60,3 +60,10 @@ function renderClientList(data) { $('#client-list').append(html); }); } + +function prettyDateTime(timeStr) { + const dt = new Date(timeStr); + const offsetMs = dt.getTimezoneOffset() * 60 * 1000; + const dateLocal = new Date(dt.getTime() - offsetMs); + return dateLocal.toISOString().slice(0, 19).replace(/-/g, "/").replace("T", " "); +} From d1507726a406251305ac33e7b717365e020081ce Mon Sep 17 00:00:00 2001 From: Giannis Mathioudakis Date: Fri, 12 Nov 2021 22:12:17 +0200 Subject: [PATCH 07/20] Fix form submit, preventing login. (#118) --- templates/login.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templates/login.html b/templates/login.html index 174ef6f..81f2b15 100644 --- a/templates/login.html +++ b/templates/login.html @@ -91,6 +91,11 @@ Wireguard UI. All rights reserved. From edba46d2e167705fde4aa3da0a28f01a73aced64 Mon Sep 17 00:00:00 2001 From: Khanh Ngo Date: Sat, 4 Dec 2021 09:02:29 +0100 Subject: [PATCH 18/20] Update Dockerfile --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 86574cc..7b3e5e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,10 @@ # Build stage FROM golang:1.16.7-alpine3.14 as builder LABEL maintainer="Khanh Ngo Date: Sat, 4 Dec 2021 09:03:56 +0100 Subject: [PATCH 19/20] I've modify the place where I inserted code to minimize the number of files touched. (#131) --- prepare_assets.sh | 4 +++- templates/status.html | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/prepare_assets.sh b/prepare_assets.sh index 31dd1bb..66a66b3 100755 --- a/prepare_assets.sh +++ b/prepare_assets.sh @@ -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" && \ diff --git a/templates/status.html b/templates/status.html index f3311a5..d373c54 100644 --- a/templates/status.html +++ b/templates/status.html @@ -14,6 +14,20 @@ Connected Peers {{end}} {{define "page_content"}} +
{{ if .error }} @@ -41,8 +55,8 @@ Connected Peers {{ $peer.Name }} {{ $peer.Email }} {{ $peer.PublicKey }} - {{ $peer.ReceivedBytes }} - {{ $peer.TransmitBytes }} + + {{ $peer.Connected }} {{ $peer.LastHandshakeTime }} From f3a788e3a43fb93df7fe87d9848ea2f34e2d0d8d Mon Sep 17 00:00:00 2001 From: Khanh Ngo Date: Sun, 5 Dec 2021 14:02:07 +0100 Subject: [PATCH 20/20] Create Jenkinsfile --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..920c694 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,2 @@ +@Library('ndk-jenkins-shared-libs')_ +imageBuilder('wireguard-ui')