From 3f1fb96cfe68e1bc51278e24aadf4f533f62323c Mon Sep 17 00:00:00 2001 From: Steven Honson Date: Sat, 11 May 2019 21:54:19 +1000 Subject: ui: use ipc client to list existing tunnels The manager service and ui application may be running as different users, and therefore use different configurations directories. Using the ipc client ensures that tunnels are listed from the perspective of the service. Signed-off-by: Steven Honson --- ui/editdialog.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ui/editdialog.go') diff --git a/ui/editdialog.go b/ui/editdialog.go index ac441f32..ba868893 100644 --- a/ui/editdialog.go +++ b/ui/editdialog.go @@ -257,13 +257,14 @@ func (dlg *EditDialog) onSaveButtonClicked() { return } - names, err := conf.ListConfigNames() + existingTunnelList, err := service.IPCClientTunnels() if err != nil { walk.MsgBox(dlg, "Unable to list existing tunnels", err.Error(), walk.MsgBoxIconError) return } - for _, name := range names { - if strings.ToLower(name) == strings.ToLower(newName) { + newNameLower := strings.ToLower(newName) + for _, tunnel := range existingTunnelList { + if strings.ToLower(tunnel.Name) == newNameLower { walk.MsgBox(dlg, "Tunnel already exists", fmt.Sprintf("Another tunnel already exists with the name ā€˜%sā€™.", newName), walk.MsgBoxIconWarning) return } -- cgit v1.2.3-59-g8ed1b