feat: preview the host's dev servers through the dev tunnel
- loopback dev-server URLs are no longer opened on the phone's network: the panel binds a local 127.0.0.1 TCP listener and pipes each connection over an authenticated WebSocket to the host's /api/dev-tunnel, which dials its own loopback port; the WebView keeps the original address in the bar while the page, absolute URLs, cookies and HMR sockets use the tunneled origin - the empty state lists /api/dev-servers results for the project (only ports that answered with a web page), with title, URL and command; tapping one opens it through the tunnel - relay transports mint oc_url_token themselves; a direct connection mints and caches /auth/url-token and also sends the bearer - a new loopback port opened from a tunnelled page gets its own tunnel - version 0.7.1+701; tests cover the URL mapping and tunnel helpers
This commit is contained in:
1 parent
318276d3b9
commit
695d27cdd7
12 files changed
+545
-39
No files matched your search
@@ -5,6 +5,18 @@
|
||||
|
||||
---
|
||||
|
||||
## 0.7.1 浏览器通过服务端 dev tunnel 预览(分支 `flutter`)
|
||||
|
||||
| 项 | 结果 |
|
||||
| --- | --- |
|
||||
| 网络 | 不再是手机本机网络:`localhost` / `127.0.0.1` 地址改为在手机本地绑定一个随机端口的 TCP 监听器,每条连接通过 Relay/直连的 WebSocket 连到服务端 `/api/dev-tunnel?port=…&oc_url_token=…`,由服务端连接它自己 loopback 上的 dev server;页面 origin 是本地监听器,绝对路径、Cookie、HMR WebSocket 都按这个 origin 工作 |
|
||||
| dev server 列表 | 从 `/api/dev-servers` 读取服务端发现且返回了网页的项目 dev server(按当前项目目录过滤,过滤掉 adb/模拟器等没有页面的端口);空状态列出标题 / URL / 命令,点击即可预览;也可以手动输入 URL |
|
||||
| 地址栏 | 显示原始 `http://localhost:端口/...`,内部加载本地隧道地址;页面里的同源链接会重写到隧道,跳到另一个 loopback 端口会为新端口开隧道;历史记录保存原始地址 |
|
||||
| 鉴权 | Relay 由 `RelayTransport` 自动 mint `oc_url_token`;直连时客户端 `POST /auth/url-token` 取短期 token 并缓存,WebSocket 同时带 bearer;服务端仍只允许它发现列表里的端口 |
|
||||
| 版本 | **0.7.1(code 701)** |
|
||||
|
||||
---
|
||||
|
||||
## 0.7.0 浏览器地址栏菜单与网络说明(分支 `flutter`)
|
||||
|
||||
| 项 | 结果 |
|
||||
|
||||
Reference in new issue
Block a user