feat(m193): 下载并发/重试/gh-proxy 真接进引擎(schema 与引擎同源常量)

- download.concurrency / download.retry_limit 以前引擎侧零消费者(恒用
  EngineConfig::default() 的 64,而 schema 说 8)。现在默认值与硬上限收成
  download/config.rs 的常量,schema、EngineConfig::default()、Semaphore 容量
  三处同源;宿主把三个键翻译成 DownloadTuning 后经 shared::set_tuning(按数据根)
  灌进装配点,改了设置下一次取引擎就生效。
- download.gh_proxy 三态(留空=跟随内置默认 / off=关 / 前缀=覆盖)下沉到
  shared::build,所有走共享引擎的下载路径(内容库/版本清单/字体/安装)一致。
- 删掉 MirrorTable::set_gh_proxy 与 default_gh_proxy 两个改了没用的入口。
- 下载设置页把三条假演示值换成说语义的中文行(含三态说明与 1~64 硬上限)。
- 守卫:探针读 Semaphore 真实许可数(不是读配置),每条配变异证明。
- docs/download-settings.md 记下取证表(另四个键仍零消费,已立 finding)。
This commit is contained in:
worker-dlmsettings authored and AskaEth committed 2026-11-09 05:24:11 +08:00
1 parent 98262d3835
commit e8544b19a7
15 files changed
+958 -200

No files matched your search

+3 -34
View File
@@ -175,49 +175,18 @@ impl MirrorTable {
self.rules.insert(0, rule);
}
/// 覆盖 gh-proxy 前缀(设置项);传 `None` 表示不默认启用。
pub fn set_gh_proxy(&mut self, prefix: Option<&str>) {
match prefix {
Some(prefix) => {
if let Some(proxy) = self.gh_proxies.first_mut() {
proxy.prefix = prefix.to_string();
proxy.enabled = true;
} else {
self.gh_proxies.push(GhProxy {
id: "gh-proxy".to_string(),
name: "自定义 gh-proxy".to_string(),
prefix: prefix.to_string(),
enabled: true,
});
}
}
None => {
for proxy in &mut self.gh_proxies {
proxy.enabled = false;
}
}
}
}
/// 找到第一条命中的前缀规则。
#[must_use]
pub fn prefix_rule_for(&self, url: &str, kind: ResourceKind) -> Option<&PrefixRule> {
self.rules.iter().find(|rule| rule.matches(url, kind))
}
/// 清单里第一个启用的 gh-proxy 前缀(默认值来源;设置层用它初始化地区档案)。
#[must_use]
pub fn default_gh_proxy(&self) -> Option<&str> {
self.gh_proxies
.iter()
.find(|proxy| proxy.enabled && !proxy.prefix.is_empty())
.map(|proxy| proxy.prefix.as_str())
}
/// GitHub host 且允许时套 gh-proxy 前缀。
///
/// **生效前缀的唯一真相源是 `region.gh_proxy`**(设置层/地区判定写入,`None` = 用户关闭)。
/// 表格里的 `gh_proxies` 只是「已知可用前缀」清单,配合 `default_gh_proxy()` 给设置做默认值。
/// 表格里的 `gh_proxies` 只是「已知可用前缀」清单(诊断页可读),**改它不会生效**——M193
/// 删掉了原先那个 `MirrorTable::set_gh_proxy`,正是因为它改了这张表而 `expand()` 读的是档案,
/// 属于「看起来能改、其实没人读」的入口。
#[must_use]
pub fn gh_proxy_candidates(&self, url: &str, region: &RegionProfile) -> Vec<Candidate> {
if region.mode != RegionMode::MirrorFirst {