From 986404236abd48a56a2ed67ddee4bb1f175e8a3e Mon Sep 17 00:00:00 2001 From: 0xCA Date: Tue, 9 Jan 2024 19:26:24 +0500 Subject: [PATCH] Support for notes about clients --- handler/routes.go | 1 + model/client.go | 1 + templates/base.html | 9 ++++++++- templates/clients.html | 10 +++++++++- templates/wg.conf | 4 ++++ util/util.go | 11 ++++++++++- 6 files changed, 33 insertions(+), 3 deletions(-) diff --git a/handler/routes.go b/handler/routes.go index ef01d08..42047dc 100644 --- a/handler/routes.go +++ b/handler/routes.go @@ -720,6 +720,7 @@ func UpdateClient(db store.IStore) echo.HandlerFunc { client.PublicKey = _client.PublicKey client.PresharedKey = _client.PresharedKey client.UpdatedAt = time.Now().UTC() + client.AdditionalNotes = strings.ReplaceAll(strings.Trim(_client.AdditionalNotes, "\r\n"), "\r\n", "\n") // write to the database if err := db.SaveClient(client); err != nil { diff --git a/model/client.go b/model/client.go index cb00016..d835124 100644 --- a/model/client.go +++ b/model/client.go @@ -18,6 +18,7 @@ type Client struct { AllowedIPs []string `json:"allowed_ips"` ExtraAllowedIPs []string `json:"extra_allowed_ips"` Endpoint string `json:"endpoint"` + AdditionalNotes string `json:"additional_notes"` UseServerDNS bool `json:"use_server_dns"` Enabled bool `json:"enabled"` CreatedAt time.Time `json:"created_at"` diff --git a/templates/base.html b/templates/base.html index ab086e1..b45eb6c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -288,6 +288,10 @@ +
+ + +
+
+ + +