fix: 本地部署默认走 Nitro 下载代理#175
Open
cloudy-liu wants to merge 1 commit into
Open
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.
改动内容
/api/web/proxy/download,用于本地部署和 Web 部署场景下载文章内容与资源。preferences.privateProxyList或 legacywechat-proxy中残留的是项目内置公开代理地址,会视为历史默认值并回落到本地代理。问题背景
内置公开代理池可能失效或不可用。本地部署时,如果继续默认走公开代理,会导致文章内容抓取失败。
另外,已有用户的浏览器本地存储中可能已经持久化了旧的公开代理列表到
preferences.privateProxyList。如果只判断代理列表是否非空,这些历史公开代理会被误认为是用户私有代理,从而绕过本地 Nitro 代理,导致升级后仍然抓取失败。这个修复将“历史内置公开代理”和“用户真正自定义的私有代理”区分开:本地部署默认使用同源 Nitro 代理,同时不破坏用户自建代理的配置。
验证
node_modules\.bin\jiti.cmd test\download_proxy_list.tsnode_modules\.bin\jiti.cmd test\download_proxy_target.tsgit diff --check upstream/master..HEAD$env:NODE_OPTIONS='--max-old-space-size=4096'; yarn build