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:
2026-07-28 00:42:12 +08:00
parent 1b58cd1a35
commit 59cf9825d1
4 changed files with 63 additions and 4 deletions
+3
View File
@@ -251,6 +251,9 @@ func (s *Supervisor) loop(ctx context.Context) {
// runOnce 跑一次 collector direct 行程,串流其 stdout JSON 更新狀態,回傳退出原因。
func (s *Supervisor) runOnce(ctx context.Context) error {
cmd := exec.CommandContext(ctx, s.BinPath, "direct", "--config", s.ConfigPath)
// t75Windows 上不要讓 collector 彈出 console 視窗(每輪閃一次,使用者會以為中毒)。
// 非 Windows 平台為 no-op,見 hidewindow_*.go。
hideChildWindow(cmd)
stdout, err := cmd.StdoutPipe()
if err != nil {
return err