From 44d139936aa3fa11f293aea42f67b9311e236bb7 Mon Sep 17 00:00:00 2001 From: Gerhard Tan Date: Sat, 17 Feb 2024 00:13:49 +0800 Subject: [PATCH] Fix admin server config and ui --- pkg/config/client.go | 2 ++ pkg/consts/res.go | 2 +- ui/editclient.go | 12 ++++++++---- ui/proxyview.go | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pkg/config/client.go b/pkg/config/client.go index cc104ad0..e33f2e3f 100644 --- a/pkg/config/client.go +++ b/pkg/config/client.go @@ -417,6 +417,8 @@ func (conf *ClientConfig) Complete(read bool) { conf.AdminUser = "" conf.AdminPwd = "" conf.AssetsDir = "" + conf.AdminTLS = v1.TLSConfig{} + conf.PprofEnable = false } conf.AutoDelete = conf.AutoDelete.Complete() if !conf.TCPMux { diff --git a/pkg/consts/res.go b/pkg/consts/res.go index 04275bb1..7224b273 100644 --- a/pkg/consts/res.go +++ b/pkg/consts/res.go @@ -51,7 +51,7 @@ const ( IconHttpFile = 69 IconHttpProxy = 114 IconOpenPort = 135 - IconVpn = 47 + IconLock = 47 IconNewVersion1 = -1028 IconNewVersion2 = 1 IconUpdate = -47 diff --git a/ui/editclient.go b/ui/editclient.go index ea6e51b4..783d948d 100644 --- a/ui/editclient.go +++ b/ui/editclient.go @@ -209,9 +209,13 @@ func (cd *EditClientDialog) adminConfPage() TabPage { LineEdit{Text: Bind("AdminAddr"), StretchFactor: 2}, Label{Text: ":"}, LineEdit{Name: "adminPort", Text: Bind("AdminPort", consts.ValidateInteger)}, - ToolButton{Image: loadSysIcon("shell32", consts.IconVpn, 16), ToolTipText: "TLS", OnClicked: func() { - cd.adminTLSDialog().Run(cd.Form()) - }}, + ToolButton{ + Enabled: Bind("adminPort.Text != ''"), + Image: loadSysIcon("shell32", consts.IconLock, 16), + ToolTipText: "TLS", OnClicked: func() { + cd.adminTLSDialog().Run(cd.Form()) + }, + }, }, }, Label{Enabled: Bind("adminPort.Text != ''"), Text: i18n.SprintfColon("User")}, @@ -397,7 +401,7 @@ func (cd *EditClientDialog) experimentDialog() Dialog { func (cd *EditClientDialog) adminTLSDialog() Dialog { var widgets [4]*walk.LineEdit customDialog := NewBasicDialog(nil, "TLS", - loadSysIcon("shell32", consts.IconVpn, 32), + loadSysIcon("shell32", consts.IconLock, 32), DataBinder{DataSource: &cd.binder.AdminTLS}, nil, Label{Text: i18n.SprintfColon("Host Name")}, LineEdit{AssignTo: &widgets[0], Text: Bind("ServerName")}, diff --git a/ui/proxyview.go b/ui/proxyview.go index ea09b673..c01f9a59 100644 --- a/ui/proxyview.go +++ b/ui/proxyview.go @@ -170,9 +170,9 @@ func (pv *ProxyView) createToolbar() ToolBar { Action{ AssignTo: &pv.vpnAction, Text: "OpenVPN", - Image: loadSysIcon("shell32", consts.IconVpn, 16), + Image: loadSysIcon("shell32", consts.IconLock, 16), OnTriggered: func() { - pv.onQuickAdd(NewSimpleProxyDialog("OpenVPN", loadSysIcon("shell32", consts.IconVpn, 32), + pv.onQuickAdd(NewSimpleProxyDialog("OpenVPN", loadSysIcon("shell32", consts.IconLock, 32), "openvpn", []string{consts.ProxyTypeTCP, consts.ProxyTypeUDP}, ":1194")) }, },