2727 startServerFunc func ()
2828 shutdownServerFunc func ()
2929 getURLFunc func () string
30+ getBrowserURLFunc func () string
3031 getConfigDirFunc func () (string , error )
3132 getStoreUrlsFunc func () []string
3233 toggleTailscaleFunc func () error
@@ -62,6 +63,7 @@ const noRequestedExitCode int32 = -1
6263// startServer: 启动服务器的函数
6364// shutdownServer: 清理服务器的函数
6465// getURL: 获取服务器URL的函数
66+ // getBrowserURL: 获取本机浏览器URL的函数
6567// getConfigDir: 获取配置目录的函数
6668// getStoreUrls: 获取书库URL列表的函数
6769// toggleTailscale: 切换Tailscale状态的函数
@@ -72,6 +74,7 @@ const noRequestedExitCode int32 = -1
7274func SetupSystray (
7375 startServer , shutdownServer func (),
7476 getURL func () string ,
77+ getBrowserURL func () string ,
7578 getConfigDir func () (string , error ),
7679 getStoreUrls func () []string ,
7780 toggleTailscale func () error ,
@@ -82,6 +85,7 @@ func SetupSystray(
8285 startServerFunc = startServer
8386 shutdownServerFunc = shutdownServer
8487 getURLFunc = getURL
88+ getBrowserURLFunc = getBrowserURL
8589 getConfigDirFunc = getConfigDir
8690 getStoreUrlsFunc = getStoreUrls
8791 toggleTailscaleFunc = toggleTailscale
@@ -142,8 +146,8 @@ func initMenuItems() {
142146 // 创建菜单项
143147 menuItems .mOpenBrowser = systray .AddMenuItem (locale .GetString ("systray_open_browser" ), locale .GetString ("systray_open_browser_tooltip" ))
144148 menuItems .mOpenBrowser .Click (func () {
145- if getURLFunc != nil {
146- url := getURLFunc ()
149+ if getBrowserURLFunc != nil {
150+ url := getBrowserURLFunc ()
147151 go tools .OpenBrowserByURL (url )
148152 logger .Infof (locale .GetString ("log_opening_browser" ), url )
149153 }
0 commit comments