feat(stockbit): print the ssh forward when the shell is remote

The login page listens on 127.0.0.1, so a browser on the Mac driving a VM
could never reach it. Over SSH, idx now picks port 7878, skips opening a
browser on the VM, and prints the exact ssh -L to run where the browser
is.
This commit is contained in:
hermes 2026-10-23 13:52:15 +00:00
commit cb532b670b
3 changed files with 54 additions and 8 deletions

View file

@ -99,12 +99,17 @@ minutes). A session Stockbit refuses leaves a previously stored one in place.
The page listens on this machine's loopback interface only, so the browser
must run on the same machine: from another host over SSH, or from a browser
outside a container or WSL distro, `127.0.0.1` is a different machine and the
page will not load. Forward it instead, with a pinned port:
page will not load. idx notices an SSH session (`SSH_CONNECTION`) and prints
the exact command to run on the machine with the browser, on port 7878:
```bash
ssh -L 7878:127.0.0.1:7878 <this-host> # run where the browser is, keep it open
```
Elsewhere, pin the port yourself and forward it the same way:
```bash
idx stockbit login --no-browser --port 7878
# from the machine with the browser:
ssh -L 7878:127.0.0.1:7878 <this-host> # then open the printed URL
```
**One refresher per session.** Stockbit replaces the refresh token every time