Skip to content

修复:订阅源获取失败时保留缓存,并完整合并原订阅配置 - #107

Closed
QAQLeonard wants to merge 2 commits into
SubBoost:mainfrom
QAQLeonard:main
Closed

QAQLeonard wants to merge 2 commits into
SubBoost:mainfrom
QAQLeonard:main

Conversation

@QAQLeonard

@QAQLeonard QAQLeonard commented Oct 10, 2026 •

Copy link
Copy Markdown

当某个订阅源返回HTTP错误、空响应或无效内容时,保留该源上次成功获取的节点与完整配置,其他源仍可独立更新。完整Clash YAML中的hosts、DNS、代理组、providers、规则及其他顶层配置在导入、编辑、保存、刷新和生成过程中保留,避免仅导出节点而丢失原订阅信息。

具体改动:

  • 每个订阅源独立保存成功结果,沿用现有加密配置存储,无需数据库迁移。provider模式下保留已缓存的节点,仅在没有成功缓存时生成客户端provider后备配置。
  • 合并原订阅配置,按源隔离代理组和provider名称并修复引用;SubBoost显式设置优先,保持原始节点连接参数不变。
  • 正常刷新时解析hosts别名,补齐别名终点到真实IP的映射,兼容客户端覆盖DNS设置的情况。

已处理Codex审查提出的5项问题:

  1. 移除额外插入的UA,恢复原有4次请求上限与浏览器UA后备,避免浏览器后备被截断。
  2. 接受没有内联节点、但包含可用proxy-providers的配置;修复快照、导入、预览、保存、更新、刷新和导出的空节点判断。真正的空响应仍不覆盖已有缓存。
  3. 导入代理组或节点重命名后,同步重写listeners的proxy引用。
  4. hosts数组按外层最多4个worker顺序解析,并限制每次最多处理512条映射、128个不同DNS目标、4096个值;设置解析深度及调度时间边界,避免并发和工作量失控。超限未解析的原映射保留在配置中。
  5. 订阅正文获取失败时,已配置的流量/到期信息接口仍独立更新;接口失败保留旧信息,最终按源统一汇总,避免新旧流量重复累计。

验证:

  • 本次相关离线回归114项全部通过,覆盖上述问题、配置生成器、请求预算及模拟数据库下的订阅保存、更新和导出。
  • TypeScript类型检查、ESLint和git diff --check通过。

本PR仅包含运行源码。测试在仓库外执行,未提交新增测试、临时配置、部署记录或运行缓存;本次未部署或修改运行中的服务。

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T04:57:55.951717Z 1cfafda PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1cfafda643

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/server-core/src/subscription/user-agents.ts Outdated
Comment thread packages/core/src/subscription/source-snapshot.ts Outdated
Comment thread packages/core/src/generator/source-configs.ts
Comment thread packages/server-core/src/subscription/source-hosts.ts Outdated
Comment thread packages/server-core/src/subscription/refresh-node-snapshot.ts
@QAQLeonard QAQLeonard changed the title fix: preserve complete subscription sources across refresh failures 修复:订阅源获取失败时保留缓存,并完整合并原订阅配置 Oct 10, 2026
@QAQLeonard QAQLeonard closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant