fix: cross-platform support + auto token from state.vscdb

- User-Agent now matches actual OS (macOS/Windows/Linux)
- grep -oP replaced with grep -oE for macOS BSD compat
- Port-killer gated with cfg(unix)/cfg(windows)
- zg binary: macOS uses launchctl, Windows uses schtasks
- Data dir mismatch fixed in mitm-redirect.sh
- Windows setup-windows.ps1 ProjectDir fixed
- README: token path, prerequisites updated
- setup-linux.sh: pre-flight dependency checks
- OAuth token auto-read from Antigravity state.vscdb
- Version bump to 1.0.1
This commit is contained in:
Nikketryhard
2026-02-18 04:09:41 -06:00
parent efdb98e6f0
commit 134126358f
12 changed files with 397 additions and 70 deletions

View File

@@ -47,8 +47,8 @@ Explain to the user what this project unlocks — not what it _is_, but what bec
- **Linux:** `./scripts/setup-linux.sh` → creates UID-isolated system user, iptables redirect, systemd service, builds binary. Then `sudo ./scripts/mitm-redirect.sh install` for MITM interception. Start with `zg start`.
- **macOS:** `./scripts/setup-macos.sh` → launchd plist, config dirs, builds binary. Start with `zg start`.
- **Windows:** `powershell -ExecutionPolicy Bypass -File scripts\setup-windows.ps1` (as Admin) → scheduled task, config dirs, builds binary. Start with `schtasks /run /tn "ZeroGravity Proxy"`.
- **Prerequisites:** Rust toolchain (`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`). Linux also needs `iptables`.
- **Auth:** They need an OAuth token from Antigravity. If the app is installed on the same machine, auto-refresh works via `state.vscdb`. Otherwise: `ZEROGRAVITY_TOKEN=ya29.xxx` env var, or `~/.config/zerogravity-token` file, or runtime `POST /v1/token`.
- **Prerequisites:** Rust toolchain (`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`). Linux also needs `iptables`, `gcc`, `jq`, and `curl`.
- **Auth:** They need an OAuth token from Antigravity. If the app is installed on the same machine, auto-refresh works via `state.vscdb`. Otherwise: `ZEROGRAVITY_TOKEN=ya29.xxx` env var, or `~/.config/zerogravity/token` file, or runtime `POST /v1/token`.
- **Test it:** `zg test "say hi"` or `curl http://localhost:8741/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"gemini-3-flash","messages":[{"role":"user","content":"hi"}]}'`
</details>
@@ -102,7 +102,7 @@ zg start
The proxy needs an OAuth token:
1. **Env var**: `ZEROGRAVITY_TOKEN=ya29.xxx`
2. **Token file**: `~/.config/zerogravity-token`
2. **Token file**: `~/.config/zerogravity/token`
3. **Runtime**: `curl -X POST http://localhost:8741/v1/token -d '{"token":"ya29.xxx"}'`
<details>
@@ -130,7 +130,7 @@ Extract the OAuth token (starts with ya29.) from this cURL command and give me j
### Linux
```bash
# Prerequisites: Rust toolchain, iptables
# Prerequisites: Rust toolchain, iptables, gcc, jq, curl
./scripts/setup-linux.sh
```