Conversation
yovinchen
marked this pull request as ready for review
September 13, 2026 16:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issue
Closes #807
Closes #808
Summary
修复 HTTP 隧道的两个路径问题:Desktop 单独配置 Gateway 端口时,面板和 TunnelManager 输出会丢失端口;页面动态插入 script/link 时,原生资源加载器会请求 Gateway 根路径并返回 404。
统一从
gatewayUrl与gatewayPort生成公开基址,使http://127.0.0.1+3000正确生成http://127.0.0.1:3000/t/<slug>/。隧道运行时在原生 URL 属性赋值、属性设置和节点插入前同步处理动态 script/link 路径,同时保留外部来源、相对地址和已带前缀的资源。运行时从 Go 字符串提取为嵌入的 JavaScript,HTML 注入和 CSP 哈希仍使用同一份字节。没有新增依赖或修改协议。
Change scope
ChatPage.tsx、useSendChatTurn.ts、RemoteSection.tsx、gatewayPublicUrl.ts、internal/server/tunnel_rewrite.go和tunnel_runtime.js。Screenshots / preview
下面是真实 Chromium 浏览器中的最小复现页面截图,不是产品界面截图。左侧使用 main@4eb6a4a8 的原版运行时,右侧使用本 PR 的嵌入运行时;端口行执行对应的基址生成逻辑。
另外在本地 Docker Gateway + Desktop 的真实隧道上复测,原复现页由 8/9 通过变为 9/9 通过(包含动态脚本与按钮交互)。
Verification
make check-all完整通过:21/21 检查项 PASS,包含 Shared UI 边界与类型检查、GUI/WebUI 构建和 lint、Go lint 与全部 Go 测试、前端/发布脚本测试、Rust 全目标与 doc tests、Proto lint 和 breaking check。macOS arm64 上使用独立临时目录,排除其他 golangci-lint 进程锁冲突;需要进程查询和日志写入的 Rust 测试在正常权限下执行,1003 项通过、3 项原有忽略。21 项针对性 Node 回归测试通过,覆盖端口归一化、TunnelManager 输出、动态 script/link、克隆和片段插入、已带前缀及外部资源保持、fetch/XHR 回归。
Chromium 前后对照验证通过,截图见上。
git diff --check通过。兼容范围:本次修复限定为公开基址和动态 DOM script/link 资源。原生 ES module 根路径导入、Worker、客户端路由和动态 HTML 字符串仍可能需要应用自身的 basePath 适配,文档已明确说明。
Pre-submit checklist