fix(app-iced): M120 r1 —— 徽标判据改回「类型是原版」;旧串黑名单翻成白名单

r1 复审 p2-1(真回归,我引入的):`loader_badge` 把「非原版 + 空版本号」也送进了
`Key::LoaderVanilla`。而 `host::game::loader_from_id("1.20.1-forge")` 这类 id 取不到版本段
(它按 `forge-` 找,id 却是 `-forge` 结尾),`LoaderInfo::badge()` 对它们给的正是品牌名
`Forge` / `NeoForge` / `OptiFine` —— 于是这三个显示成「原版 / Vanilla」。

判据改成「**加载器类型本身是原版** ⇒ 过词表,其余交给 `badge()`」:
- 修的是判据,不是加分支:函数注释本来就写着「只有原版这一支要过词表」,代码与注释相矛盾。
- 新回归测试 `the_loader_badge_keeps_the_brand_when_the_version_is_missing`:
  `1.20.1-forge` / `1.20.1-neoforge` / `1.20.1-OptiFine` 三条 id 各断言列表副文案与 LOADER
  卡的值都是品牌名(中英两套语言各跑一遍,品牌名两套语言相同)。
  变异实测:把判据改回旧写法 ⇒ 立刻红(`left: "1.20.4 · Vanilla" / right: "1.20.4 · Forge"`,
  与复审给的实证逐字相同)。

r1 复审 p2-2(不阻塞,按塔台要求顺手做):源码反扫从**黑名单 29 条旧串**翻成**白名单**。
- 先数过:五个页面源码里一共 13 个字面量,其中带 ASCII 单词的只有 6 条,全是专有名词 /
  技术标识 / 占位符名 / 族名前缀(`{date} {time} UTC` / `isolated` / `shared` / `pid` /
  `reason` / `Instances`),逐条写了理由。
- 判据反过来之后,往页面里**新写**一句英文也会红(复审抓到的哑点)——变异实测:
  写进 `"Ready"` ⇒ 红;写回 `"ALL INSTANCES"` ⇒ 红。
- 反向锚保留:扫描器必须真扫到 ≥6 条、`Texts::of(` / `Header::new(texts.title())` /
  `Key::Instances` / `Key::InstancesStage` 必须在用(防止断言空转)。
This commit is contained in:
AskaEth committed 2026-11-05 13:36:45 +08:00
1 parent 1a4e1fee12
commit f86be2bd38
3 files changed
+122 -58

No files matched your search

+11 -10
View File
@@ -32,17 +32,18 @@ pub(super) fn supporting_line(instance: &InstanceSummary, catalog: Catalog) -> S
)
}
/// 加载器徽标:原版走词表,其余是品牌 + 版本号(原样)。
/// 加载器徽标:原版走词表,其余交给 `LoaderInfo::badge()`(品牌 + 版本号,原样)。
///
/// **判据只能是「加载器类型本身是原版」**。曾经写成「原版 **或** 版本号为空」⇒
/// `1.20.1-forge` / `1.20.1-neoforge` / `1.20.1-OptiFine` 这类**取不到版本段**的 id(`badge()`
/// 对它们给的就是品牌名 `Forge` / `NeoForge` / `OptiFine`)会被显示成「原版 / Vanilla」——
/// 那是 M120 r1 的 p2-1 回归,`the_loader_badge_keeps_the_brand_when_the_version_is_missing` 守着。
fn loader_badge(instance: &InstanceSummary, catalog: Catalog) -> String {
// `badge()` 在「原版 / 版本号为空」两种情况都给 `kind.label()`(中文「原版」),只有这一支要过词表。
if instance.loader.kind == LoaderKind::Vanilla || instance.loader.version.is_empty() {
catalog.text(Key::LoaderVanilla).to_string()
} else {
format!(
"{} {}",
instance.loader.kind.label(),
instance.loader.version
)
match instance.loader.kind {
// 唯一需要过词表的一支:`LoaderKind::label()` 对原版返回的是**中文**「原版」
LoaderKind::Vanilla => catalog.text(Key::LoaderVanilla).to_string(),
// 其余品牌名不翻译;版本号为空时 `badge()` 自己就只给品牌名
_ => instance.loader.badge(),
}
}