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:
blumia committed 2026-12-04 12:21:09 +08:00
1 parent 318276d3b9
commit 695d27cdd7
12 files changed
+545 -39

No files matched your search

+6 -1
View File
@@ -645,5 +645,10 @@ const Map<String, String> chineseStrings = {
'Invalid URL': '无效的网址',
'Could not open the browser: {0}': '无法打开浏览器:{0}',
'No history': '暂无历史记录',
'The browser runs on this device; for a dev server on the OpenChamber host, enter the host\'s LAN address.': '浏览器在手机本机网络上运行;要预览 OpenChamber 主机上的开发服务器,请输入该主机的局域网地址。',
'Dev servers': '开发服务器',
'Enter a URL above, or open a dev server found on the OpenChamber host': '在上方输入网址,或打开在 OpenChamber 主机上发现的开发服务器',
'Could not list dev servers: {0}': '无法获取开发服务器列表:{0}',
'No dev servers found. Start one in the terminal, then refresh.': '没有发现开发服务器。请在终端启动一个,然后刷新。',
'Loopback dev servers (localhost) are previewed through the OpenChamber host; other addresses use this device\'s network.': '本机回环地址(localhost)的开发服务器会通过 OpenChamber 主机预览;其他地址使用手机网络。',
'Could not open the dev server: {0}': '无法打开开发服务器:{0}',
};