feat: support proxy_url in CPA auth files#51
Merged
cnlimiter merged 1 commit intocnlimiter:masterfrom Mar 20, 2026
Merged
Conversation
Owner
|
没问题,感谢贡献! |
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.
背景
当前项目虽然支持动态代理/代理池参与注册流程,但账号上传到 CPA 时,生成的 auth file 里不会带上任务实际使用的代理信息。
这会导致一个比较常见的问题:
proxy_url这次 PR 的目标就是补上这条能力:
变更内容
1. 为 CPA 服务增加服务级开关
新增
include_proxy_url配置字段,用来控制该服务在上传 auth file 时是否写入proxy_url。涉及:
src/database/models.pysrc/database/session.pysrc/database/crud.pysrc/web/routes/upload/cpa_services.py同时补上 SQLite 自动迁移,已有库会自动新增该字段。
2. CPA auth file 生成逻辑支持可选写入
proxy_url扩展
generate_token_json(...):proxy_urlinclude_proxy_url=True时才写入account.proxy_usedproxy_url涉及:
src/core/upload/cpa_upload.py3. 单个上传 / 批量上传接入这条开关
上传到指定 CPA 服务时,会读取该服务的
include_proxy_url设置,并决定是否把代理写入 auth file。涉及:
src/web/routes/accounts.py4. 注册成功后的自动上传也接入
对于“注册完成后自动上传到一个或多个 CPA 服务”的路径,也会按每个服务自己的开关分别生成 auth file。
也就是说:
include_proxy_urlproxy_url的 auth file,B 仍然保持原格式涉及:
src/web/routes/registration.py5. 设置页补齐 UI
在 CPA 服务管理页增加:
涉及:
templates/settings.htmlstatic/js/settings.js6. 文档和测试补充
proxy_url注入逻辑涉及:
README.mdtests/test_cpa_upload.py行为说明
这个 PR 不会让 CPA 上传请求本身走代理。
CPA 上传仍然保持现在的行为:
proxy_url也就是说,这次变更是“把代理配置带到认证文件里”,不是“改变上传链路本身的网络出口”。
测试
已本地验证:
结果:
6 passed兼容性
include_proxy_url的 CPA 服务行为与之前完全一致备注
这次先只覆盖 上传到 CPA / 注册后自动上传到 CPA 两条链路。
导出 CPA 格式 JSON目前未与该开关联动,避免把这次 PR 做得过大。如果需要,我可以后续再补一条 PR,把导出逻辑也统一成同一套策略。