From 40430182f5e654e259789d1608a0a5010bb88b8c Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Sat, 27 Jul 2019 11:01:07 +0200 Subject: [PATCH] Add Notes field to client config --- config.go | 2 ++ server.go | 4 ++++ ui/src/EditClient.svelte | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/config.go b/config.go index 923d4f5..7ff6c1b 100644 --- a/config.go +++ b/config.go @@ -27,6 +27,7 @@ type ClientConfig struct { PrivateKey string PublicKey string IP net.IP + Notes string } func NewServerConfig(cfgPath string) *ServerConfig { @@ -92,6 +93,7 @@ func NewClientConfig(ip net.IP) *ClientConfig { PrivateKey: key.String(), PublicKey: key.PublicKey().String(), IP: ip, + Notes: "", } return &cfg diff --git a/server.go b/server.go index 27b0633..930fab8 100644 --- a/server.go +++ b/server.go @@ -451,6 +451,10 @@ func (s *Server) EditClient(w http.ResponseWriter, r *http.Request, ps httproute client.Name = cfg.Name } + if cfg.Notes != "" { + client.Notes = cfg.Notes + } + s.reconfigure() w.WriteHeader(http.StatusOK) diff --git a/ui/src/EditClient.svelte b/ui/src/EditClient.svelte index 8e142f8..cf6e172 100644 --- a/ui/src/EditClient.svelte +++ b/ui/src/EditClient.svelte @@ -61,6 +61,12 @@ margin-top: 1em; Friendly name of client. +
+ +