From 6eebf6811da719023a4c6922f413d574678d8601 Mon Sep 17 00:00:00 2001 From: genshen Date: Wed, 7 Feb 2024 21:50:42 +0800 Subject: [PATCH 1/2] feat(gui): add a tab for separating basic and vpn settings --- client-ui/main.go | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/client-ui/main.go b/client-ui/main.go index 9605f66..5b815e1 100644 --- a/client-ui/main.go +++ b/client-ui/main.go @@ -1,9 +1,12 @@ package main import ( + "fmt" + "fyne.io/fyne/v2" "fyne.io/fyne/v2/app" "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/dialog" + "fyne.io/fyne/v2/layout" "fyne.io/fyne/v2/theme" "fyne.io/fyne/v2/widget" resource "github.com/genshen/wssocks-plugin-ustb/client-ui/resources" @@ -153,8 +156,10 @@ func main() { return } - w.SetContent(container.NewVBox( - widget.NewCard("", "Basic", + tabs := container.NewAppTabs( + container.NewTabItemWithIcon( + "Basic", + theme.SettingsIcon(), &widget.Form{Items: []*widget.FormItem{ {Text: "socks5 address", Widget: uiLocalAddr}, {Text: "remote address", Widget: uiRemoteAddr}, @@ -162,8 +167,10 @@ func main() { {Text: "http(s) address", Widget: uiHttpLocalAddr}, {Text: "skip TSL verify", Widget: uiSkipTSLVerify}, }}, - ), // end group - widget.NewCard("", "USTB VPN", + ), + container.NewTabItemWithIcon( + "USTB VPN", + theme.AccountIcon(), &widget.Form{Items: []*widget.FormItem{ {Text: "enable", Widget: uiVpnEnable}, {Text: "force logout", Widget: uiVpnForceLogout}, @@ -172,8 +179,14 @@ func main() { {Text: "username", Widget: uiVpnUsername}, {Text: "password", Widget: uiVpnPassword}, }}, - ), // end group + ), + ) + tabs.SetTabLocation(container.TabLocationTop) + + w.SetContent(container.NewVBox( + widget.NewCard("Settings", "", tabs), btnStart, + &widget.Separator{}, container.NewGridWithColumns(2, container.NewHBox( NewHyperlinkIcon(resource.GithubIcon(), coreRepoUrl), @@ -188,7 +201,16 @@ func main() { ), container.NewGridWithColumns(2, widget.NewLabel("v"+pluginversion.VERSION), - NewHyperlinkIcon(theme.HelpIcon(), docUrl), + container.NewHBox( + layout.NewSpacer(), + widget.NewToolbar( + widget.NewToolbarAction(theme.HelpIcon(), func() { + if err := fyne.CurrentApp().OpenURL(docUrl); err != nil { + dialog.ShowError(fmt.Errorf("open link %s failed", docUrl), w) + } + }), + ), + ), ), ), )) From 8974e7440efa87fe93733b36b583de4a464da7d6 Mon Sep 17 00:00:00 2001 From: genshen Date: Wed, 7 Feb 2024 22:25:40 +0800 Subject: [PATCH 2/2] feat(gui): add input for accept the proxy auth token Note: passing proxy auth token to wssocks core is WIP. --- client-ui/main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client-ui/main.go b/client-ui/main.go index 5b815e1..d211a54 100644 --- a/client-ui/main.go +++ b/client-ui/main.go @@ -56,6 +56,7 @@ func main() { // basic input uiLocalAddr := &widget.Entry{PlaceHolder: "socks5 listen address", Text: "127.0.0.1:1080"} uiRemoteAddr := &widget.Entry{PlaceHolder: "wssocks server address"} + uiAuthToken := &widget.Entry{PlaceHolder: "the token for proxy authentication"} uiHttpEnable := newCheckbox("", false, nil) uiHttpLocalAddr := &widget.Entry{PlaceHolder: "http listen address", Text: "127.0.0.1:1086"} uiSkipTSLVerify := newCheckbox("", false, nil) @@ -163,6 +164,7 @@ func main() { &widget.Form{Items: []*widget.FormItem{ {Text: "socks5 address", Widget: uiLocalAddr}, {Text: "remote address", Widget: uiRemoteAddr}, + {Text: "auth token", Widget: uiAuthToken}, {Text: "http(s) proxy", Widget: uiHttpEnable}, {Text: "http(s) address", Widget: uiHttpLocalAddr}, {Text: "skip TSL verify", Widget: uiSkipTSLVerify},