From 63f88ab63d0721120ffcd1cc0297b525a1532c89 Mon Sep 17 00:00:00 2001 From: Quentin Machu Date: Sun, 10 Apr 2022 20:01:46 +0800 Subject: [PATCH] *: allows for BASE_PATH configuration This should unblock users who'd like to run the UI under a subpath on an existing vhost of their reverse proxy. This is far from behind the most pretty/smart way to do it, but it works for all intent and purposes. Fixes https://github.com/ngoduykhanh/wireguard-ui/issues/37 --- README.md | 2 ++ custom/js/helper.js | 2 +- handler/routes.go | 4 +-- handler/session.go | 4 +-- main.go | 60 +++++++++++++++++--------------- templates/base.html | 50 +++++++++++++------------- templates/clients.html | 16 ++++----- templates/global_settings.html | 2 +- templates/login.html | 16 ++++----- templates/server.html | 4 +-- templates/wake_on_lan_hosts.html | 2 +- util/config.go | 13 +++++++ 12 files changed, 97 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index 0940706..ee3bb44 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ Set the `SESSION_SECRET` environment variable to a random value. To use custom `wg.conf` template set the `WG_CONF_TEMPLATE` environment variable to a path to such file. Make sure `wireguard-ui` will be able to work with it - use [default template](templates/wg.conf) for reference. +Set the `BASE_PATH` environment variable if you run wireguard-ui under a subpath of your reverse proxy virtual host (e.g. /wireguard). + In order to sent the wireguard configuration to clients via email, set the following environment variables: - using SendGrid API diff --git a/custom/js/helper.js b/custom/js/helper.js index b742472..86f6dc7 100644 --- a/custom/js/helper.js +++ b/custom/js/helper.js @@ -26,7 +26,7 @@ function renderClientList(data) {
{{if .baseData.CurrentUser}} - {{end}}
@@ -75,7 +75,7 @@