#4839:为桌面端新增网络代理模式设置,#6785
Draft
ljluestc wants to merge 2 commits into
Draft
Conversation
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.
close #4839
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
本 PR 实现了 #4839:为桌面端新增网络代理模式设置,支持用户在
system、http、socks5三种模式间切换,解决仅依赖系统代理时无法灵活选择 HTTP/SOCKS5 的问题。背景与目标
主要改动
设置页新增代理模式配置
Network Proxy Mode选择项:system / http / socks5。system模式下,展示并保存Proxy Host、Proxy Port输入项。127.0.0.1:7890。前端状态扩展
proxyModeproxyHostproxyPortPROXY_MODES与ProxyMode类型定义,保证模式值可控。桌面流式请求链路接入代理 URL
app/utils/stream.ts中根据模式与 host/port 生成proxy_url。system模式不传代理;http/socks5模式构造对应协议 URL。stream_fetch时新增proxy_url参数透传。Rust 后端支持代理模式
src-tauri/src/stream.rs的stream_fetch增加proxy_url: Option<String>。proxy_url有效时,通过reqwest::Proxy::all(...)注入代理。no_proxy().proxy(...)显式应用用户配置代理。依赖能力补齐
src-tauri/Cargo.toml中为reqwest启用socksfeature,确保 SOCKS5 可用。涉及文件
app/components/settings.tsxapp/store/access.tsapp/utils/stream.tssrc-tauri/src/stream.rssrc-tauri/Cargo.toml最终效果
system:使用系统默认代理行为(不强制覆盖)。http:桌面请求走http://<host>:<port>。socks5:桌面请求走socks5://<host>:<port>。📝 补充信息 | Additional Information