6 Commits

Author SHA1 Message Date
root 19f851afb0 Auto-update on startup: prompt + apply + auto-restart
Build / test (push) Successful in 1m15s
Build / build-windows (push) Successful in 57s
Release / release (push) Successful in 3m16s
Double-clicking drover.exe now silently checks for updates first
(8s timeout, ignores network failures). If a newer release is
published, a YES/NO message box asks the user; on YES we download,
verify SHA256, apply via selfupdate, and re-launch the binary so
the user immediately sees the new version's window.

NO or no update → straight to the smoke-test window as before.
Update errors show an error dialog, then continue.

Implementation:
- internal/updater is reused as-is — the existing CheckForUpdate +
  ApplyUpdate API is enough.
- autoupdate_windows.go owns the dialog and re-launch logic
  (golang.org/x/sys/windows for MessageBoxW, os/exec for fresh
  process). autoupdate_other.go is the no-op stub for Linux CI.
- relaunchSelf uses cmd.Start (fire and forget) — no Wait. Current
  process os.Exit(0) immediately so the OS doesn't keep both
  generations of drover running.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 03:21:59 +03:00
root 5da30ad058 GUI subsystem: -H=windowsgui + AttachConsole, MB_TOPMOST on test window
Build / test (push) Successful in 1m13s
Build / build-windows (push) Successful in 55s
drover.exe is now a GUI subsystem binary:
  - Double-click no longer flashes a console window — a clean
    smoke-test message box opens immediately.
  - When run from cmd / PowerShell, AttachConsole reattaches stdout
    and stderr to the parent terminal so '--version', 'check', etc.
    still print as expected.
  - MB_TOPMOST flag added to MessageBox so the window can't be
    obscured by other windows on launch (this was the actual cause
    of "I clicked but nothing happened" reports).

Verified locally: built with GOOS=windows GOARCH=amd64 -H=windowsgui;
running drover-gui.exe --version prints to PowerShell, drover-gui.exe
gui shows the message box on top of the active window.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 03:11:50 +03:00
root 15e4156802 main.go: open test window on bare 'drover' (no subcommand)
Build / test (push) Successful in 19s
Build / build-windows (push) Successful in 6s
Release / release (push) Successful in 1m48s
Without this, double-clicking drover.exe printed CLI help to stdout —
fine in a terminal but invisible to a user who just clicked an icon.
Adding a RunE on the root command opens the smoke-test message box
when no subcommand was given. CLI flags (--version, --help) and
explicit subcommands keep their old behaviour.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 03:02:02 +03:00
root 349711bcf0 Add 'drover gui' subcommand: native Win32 MessageBox smoke test
Build / test (push) Successful in 20s
Build / build-windows (push) Successful in 6s
Release / release (push) Successful in 1m45s
Shows a small message box with version metadata + build info. Used as
a fastest possible end-user smoke check after install: double-click
drover.exe in a portable bundle (or run 'drover gui' from cmd) and
see "OK — the binary launched and the Windows API is reachable" with
the right version on screen. No network calls, no admin needed.

Implementation: cgo-free, uses only golang.org/x/sys/windows (already
pulled in by the updater package). gui_other.go is a stub so the
package still compiles on Linux for the CI smoke build.

Locally verified: built with -X main.Version=test-local, ran
'drover.exe gui' on Windows 11, message box appeared with correct
version/commit/Go runtime info.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 02:55:29 +03:00
root 1ad8de32f2 Implement internal/updater: selfupdate via Forgejo Releases API
Adds a small, well-tested package that:
- Queries /api/v1/repos/root/drover-go/releases/latest (404 = no updates,
  not an error).
- Compares the published tag against the running Version using
  golang.org/x/mod/semver, so v0.1.0-rc.2 < v0.1.0. "dev" or any
  semver-invalid current version is treated as "always update".
- Downloads the windows-amd64 asset + SHA256SUMS.txt, verifies the
  sha256 of the binary against its line in the sums file (tolerates
  the asterisk binary-mode prefix), and atomically swaps the running
  exe via github.com/minio/selfupdate.
- Uses a 15s connect timeout with no overall request deadline, so
  large asset downloads aren't truncated.
- Reports progress via an optional callback.

Public surface: Source interface + ForgejoSource implementation,
CheckForUpdate, ApplyUpdate, SetVersion. No GUI/cobra/Wails imports
in the package, so the same code is reusable from the CLI, the
Windows service, and the future tray UI.

Wires the package into "drover update" / "drover update --check-only"
in cmd/drover/main.go. --check-only exits 0 whether or not an update
is available; only network/sha/apply errors are non-zero.

Tests cover CheckForUpdate (table-driven incl. semver pre-release
ordering, dev fallthrough, source errors), parseSHA256Sums (text and
binary modes, CRLF, malformed lines, missing entries),
ForgejoSource.Latest (httptest with canned JSON, 404, 500, missing
asset, missing SHA256SUMS), and downloadAndVerify (success, sha
mismatch, HTTP 404, context cancellation). All run with -race.

Smoke-tested manually: built drover.exe and "drover update --check-only"
against git.okcu.io prints "No updates available" and exits 0 (no
releases yet).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 00:20:24 +03:00
root 0acbc83e40 Add directory skeleton and CLI entry point with Cobra
- Create internal/{app,config,engine,divert,socks5,bypass,checker,service,tray,procscan,updater} with placeholder doc.go per package.
- Add .gitkeep stubs for internal/frontend, third_party/{windivert,icons}, installer/, .forgejo/workflows/, docs/.
- Implement cmd/drover/main.go: Cobra root with Version/Commit/BuildDate ldflags, --config global flag, and stub subcommands (check, update --check-only, service install/uninstall/start/stop).
- Add github.com/spf13/cobra v1.10.2 dependency.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 00:10:30 +03:00