fix(t75 ④⑤): 連線精靈不再清空輸入+Windows 不再每幾秒閃 console 視窗
leo 同事真機實測撞到的兩個最嚴重問題。
④ 連線失敗會清空使用者輸入(leo:「很糟糕」)
真兇:失敗後呼叫 showConnectWizard(),註解寫著「不要把他丟回空白畫面」
**但行為與註解相反**——它重建整個對話框,urlEntry 是全新的,
而 cfg.CypherURL 因連線失敗根本沒寫入 ⇒ 欄位就是空的 ⇒ 使用者整段重打。
修:改 showConnectWizardWith(prevURL, prevEmail) 帶回上次輸入,
讓他只改錯的那個字。密碼不帶回(打錯時重打較安全,也少留記憶體)。
⑤ daemon 開著時每幾秒閃一個方框(約半螢幕)
真兇:arcrun-collector.exe 是 console 型執行檔,supervisor 每輪 exec 起它,
**Windows 預設會為 console 程式配可見視窗** ⇒ 每輪閃一次。
Mac/Linux 無此概念故開發期完全沒想到。
修:新增 hidewindow_windows.go(HideWindow + CREATE_NO_WINDOW)
+hidewindow_other.go(no-op),編譯期分平台不寫 runtime.GOOS 判斷。
註:-H windowsgui 是連結期選項(管自己有沒有視窗),與此(管起別人時給不給視窗)
是兩件事,兩者都要做才乾淨。
驗證:Mac 與 Windows 交叉編譯皆 exit=0 且產物生成;collector 全測試綠。
⚠️ 未真機驗——⑤ 的效果必須在真 Windows 上確認方框消失。
This commit is contained in:
+19
-4
@@ -422,16 +422,30 @@ func main() {
|
||||
|
||||
// t54 連線精靈:輸入知識庫網址+帳密 → 換設定 → 寫檔 → 開始看守。
|
||||
// 沒連線過的機器一開 app 就自動跳;之後也能從選單「重新連線…」再開。
|
||||
// t75(2026-07-28,leo 同事真機實測):**連線失敗重試時必須把使用者剛打的內容帶回來**。
|
||||
//
|
||||
// 原本的寫法是失敗後直接呼叫 `showConnectWizard()`,註解寫著「不要把他丟回空白畫面」——
|
||||
// **但行為與註解相反**:它重建整個對話框、`urlEntry` 是全新的,而 `cfg.CypherURL`
|
||||
// 因為連線失敗根本沒被寫入 ⇒ 欄位就是空的 ⇒ **使用者得整段重打**。
|
||||
// leo 原話:「貼上網址後說這不是個網址然後清空內容,**很糟糕**」。
|
||||
// ⇒ 改成帶入上次輸入(prefill)。密碼不帶回(打錯密碼時重打比較安全,也避免把密碼留在記憶體更久)。
|
||||
var showConnectWizard func()
|
||||
showConnectWizard = func() {
|
||||
var showConnectWizardWith func(prevURL, prevEmail string)
|
||||
showConnectWizard = func() { showConnectWizardWith("", "") }
|
||||
showConnectWizardWith = func(prevURL, prevEmail string) {
|
||||
urlEntry := widget.NewEntry()
|
||||
urlEntry.SetPlaceHolder("https://…workers.dev/portal/")
|
||||
if cfg.CypherURL != "" {
|
||||
// 優先用「使用者剛才打的」,其次才是已存的設定——重試時他要看到的是自己的輸入。
|
||||
if prevURL != "" {
|
||||
urlEntry.SetText(prevURL)
|
||||
} else if cfg.CypherURL != "" {
|
||||
urlEntry.SetText(cfg.CypherURL)
|
||||
}
|
||||
emailEntry := widget.NewEntry()
|
||||
emailEntry.SetPlaceHolder("你的 Email")
|
||||
if cfg.Email != "" {
|
||||
if prevEmail != "" {
|
||||
emailEntry.SetText(prevEmail)
|
||||
} else if cfg.Email != "" {
|
||||
emailEntry.SetText(cfg.Email)
|
||||
}
|
||||
pwEntry := widget.NewPasswordEntry()
|
||||
@@ -454,7 +468,8 @@ func main() {
|
||||
if err != nil {
|
||||
// fyne 的 UI 更新須回主執行緒;用 dialog 顯示即可(它內部處理)
|
||||
dialog.ShowError(err, win)
|
||||
showConnectWizard() // 讓用戶改完再試,不要把他丟回空白畫面
|
||||
// t75:把剛才打的網址與 email 帶回去,讓他只改錯的那個字,不必整段重打。
|
||||
showConnectWizardWith(urlEntry.Text, emailEntry.Text)
|
||||
return
|
||||
}
|
||||
applyRemoteConfig(cfg, r)
|
||||
|
||||
Reference in New Issue
Block a user