From 0ccf7ad37fe98c22220e9f2bf557107c17f88a76 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 Signed-off-by: Jason A. Donenfeld --- ui/editdialog.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ui') 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