Repository navigation
Studio: show the LAN address on the API page when LAN access is on - #12906
Conversation
NilayYadav
left a comment
There was a problem hiding this comment.
Review + reproduction evidence
Pinned review: ffa8ef2f. 1 finding in the submitted head (273f7b49), fixed in ffa8ef2f.
I reproduced the flow (start Studio at 127.0.0.1, log in, Settings > Remote & LAN > LAN access > Start, open the API page) on fresh upstream main with a real install.sh --local --no-torch install on Linux, Chromium 1440x900:
- main
0587140f: Base URL stayshttp://127.0.0.1:8888/v1with LAN access online, live and after a reload, while Settings listshttp://172.20.3.58:8888. - PR head
ffa8ef2f: Base URL ishttp://172.20.34.198:8888/v1, the same address Settings lists, live and after a reload. Stop in Settings puts it back tohttp://127.0.0.1:8888/v1without a reload. A browser opened at the LAN address keeps its own origin./v1/modelson the shown address answers 401 without a key, same as on 127.0.0.1.
- Fixed in
ffa8ef2f: the submitted head also used launch-managed LAN addresses (-H 0.0.0.0, which is how the Docker image starts). Opened through a forwardedlocalhost:9000(thedocker -p/ssh -Lcase) it showedhttp://172.20.25.65:8888/v1, the container's internal address and port, instead ofhttp://localhost:9000/v1. Only LAN access started from Settings now feeds the Base URL (lanApiUrls, with a test); the same flow showshttp://localhost:9000/v1again, as on main. - Tests:
remote-access-state.test.tsfails on main (not ok 6, actualhttp://127.0.0.1:8888) and passes on the branch;lan-access-state.test.ts28/28 with the fix; related suites 111/111; build passes. eslint on the touched files reports the same 10 pre-existing errors as main. - Not on a hot path: one extra settings GET on API page mount and window focus.
Conclusion: real bug, fixed. Fork Actions runs for both arms were still queued when I finished, and upstream CI restarted on ffa8ef2f. Desktop app, Cloudflare plus LAN, and non-Chromium browsers were not run by hand.
|
Codex review coverage, run on a mirror of this branch (NilayYadav#472):
Round 1 item:
The forwarded-port fix in |
|
The red |
Review and verification evidenceReviewed final source head
|
mahiatlinux
left a comment
There was a problem hiding this comment.
LGTM! Ready to merge, all manually checked.


With LAN access on, the API page still shows http://127.0.0.1:/v1 as the base URL, in the desktop app and in a browser on the same machine. That address only works on the machine itself, so copying it to a phone or another computer fails, even though the LAN address in Settings works.
The API page now shows the LAN address as the base URL when LAN access is on and no Cloudflare URL is active. A Cloudflare URL still takes priority, a browser that opened Studio over the LAN keeps its own address, and the base URL goes back to 127.0.0.1 when LAN access is turned off.