M207: UA 收成一份带联系方式 + 两处字符串副本(gh_proxy 键、用例注释)

1) UA 只有一份定义:core 的 `download::http::USER_AGENT`
   (`Unlucky-Launcher/<CARGO_PKG_VERSION> (+仓库 URL)`,不用邮箱)。
   - 引擎侧:`EngineConfig::default().user_agent` 直接取它(config.rs 等量替换,仍是 400 行)
   - 带 header 侧:presenter 不再持有 UA 字面量,`get_with_headers` 发 `engine.config().user_agent`
   M205 复审核实过的缺口:Modrinth 收到的是引擎那份 `UnluckyLauncher/<ver>`(无连字符、无联系方式),
   带联系方式的那份只发给 CurseForge 搜索 —— Modrinth 的 UA 政策在真正会被限流的路径上没被满足。

   断言:core 一条钉形状(版本 == CARGO_PKG_VERSION、联系方式段 == 仓库 URL、不含 `@`);
   presenter 一条在回环上抓**发出去的字节**(两条路径的 UA 逐字节相同且 == EngineConfig::default())。

2) `app-iced/.../java/downloads/engine.rs`:`"download.gh_proxy"` 字面量改成 `KEY_GH_PROXY`。

3) `presenter/src/host/addon/http.rs` 的用例注释改成事实(Modrinth 走 core 的 EngineTransport,
   `get` 的无 header 分支生产零调用者),模块说明表格同步。

4) `docs/download-settings.md`:§6.1 / §6.1.1 / §7 按 M201(iced 真控件 + 快照通路)之后的现状重写。
This commit is contained in:
AskaEth committed 2026-11-09 13:13:20 +08:00
1 parent a853986283
commit e3ae71ac37
5 files changed
+184 -91

No files matched your search

+2 -2
View File
@@ -51,7 +51,7 @@ pub struct EngineConfig {
pub connect_timeout: Duration,
/// 单次读超时(读空闲判定,不是整体超时),默认 30s。
pub read_timeout: Duration,
/// User-Agent。
/// User-Agent(唯一定义在 `http::USER_AGENT`;两条 HTTP 路径发的都是这一份,别在这里另拼)。
pub user_agent: String,
/// 进度事件节流间隔,默认 250ms。
pub progress_throttle: Duration,
@@ -70,7 +70,7 @@ impl Default for EngineConfig {
max_attempts_per_source: DEFAULT_MAX_ATTEMPTS_PER_SOURCE,
connect_timeout: Duration::from_secs(10),
read_timeout: Duration::from_secs(30),
user_agent: concat!("UnluckyLauncher/", env!("CARGO_PKG_VERSION")).to_string(),
user_agent: super::http::USER_AGENT.to_string(),
progress_throttle: Duration::from_millis(250),
backoff: BackoffPolicy::default(),
chunked: ChunkedConfig::default(),