fix(auth): M117 微软登录缺 client id 说「未配置」而不是「未支持」

用户实跑 debug 二进制看到「本期未支持」,误以为功能没做;实际是构建/启动时
没注入 Azure 公共客户端 id(登录三轨已实现、白名单已批、真机验签过)。

- core/auth/microsoft/client_id.rs(新):id 的来源判定(env > build,空白值不算配)、
  `ClientIdStatus`/`log_line()` 那行 `[auth] msa client_id=… source=…`、以及
  「未配置 + 怎么配(含可照抄命令)」的共用文案 `MISSING_CLIENT_ID_MESSAGE`。零网络。
- core/auth/error.rs:`AuthError::Unsupported` 不再统一拼「本期未支持:」前缀——该变体
  全仓唯一构造点就是缺 client id,硬拼前缀让「没配置」被读成「没实现」。`code()` 仍是
  `unsupported`,枚举形状与其它分支不动(tower 批的最小改动)。
- core/auth/microsoft/mod.rs:`from_env()` 走 `resolve_client_id()`,失败措辞取自上面那条
  文案,且在网络之前早退(连 HTTP 客户端都不建);导出 `client_id_status()`。
- cli:`map_auth_error` 的 Unsupported hint 给两条能照抄的命令;`accounts` 帮助说清
  「不是功能缺失」与两种注入方式;新增 `msa_client_id_log_line()` 给 GUI 侧出面。
- app-iced:`on_boot` 打一行 `[auth] msa client_id=… source=…`(判据来自 core,不重算)。
- i18n:`LaunchMsaNotConfigured` 中英各一条,golden 按 `Key::ALL` 顺序在
  `LaunchFailedWithCode` 之后追加一行。

本地便利路径(gitignored,随报告交付):`DevDocs/ops/ull-msa-run.sh` 读本地 id 文件
或 `azure-msa-app.md` 注入环境变量再起 GUI,脚本本身不含 id。
This commit is contained in:
AskaEth committed 2026-11-05 07:31:55 +08:00
1 parent 7ddcec4941
commit 8780f26308
8 files changed
+380 -43

No files matched your search

+1
View File
@@ -51,6 +51,7 @@ pub(super) const GOLDEN: &[(&str, &str, &str)] = &[
("LaunchOutcomeCrash", "The game crashed", "游戏崩溃"),
("LaunchOutcomeSilent", "Suspected silent failure: exit code 0, but the game never really started", "疑似静默失败:退出码 0,但游戏没真正跑起来"),
("LaunchFailedWithCode", "Launch failed (exit {code}): {reason}", "启动失败(退出码 {code}):{reason}"),
("LaunchMsaNotConfigured", "Microsoft sign-in is not configured: it needs an Azure public client id (the login flow itself is implemented). Build with ULL_MSA_CLIENT_ID=<id>, or set that environment variable before launching.", "微软登录未配置:缺少 Azure 公共客户端 id(登录功能已实现,只差这一项配置)。构建时注入:ULL_MSA_CLIENT_ID=<id> cargo build;或启动前设置同名环境变量 ULL_MSA_CLIENT_ID=<id>。"),
("FontCjkNeedsDownload", "No Chinese font found on this system. Download an open-source (OFL) Chinese font?", "系统里没找到中文字体。要下载一套开源(OFL)中文字体吗?"),
("FontCjkDownloading", "Downloading Chinese font… {percent}%", "正在下载中文字体… {percent}%"),
("FontCjkDownloadFailed", "Chinese font download failed; the interface stays in English.", "中文字体下载失败,界面暂时保持英文。"),
+38
View File
@@ -14,8 +14,46 @@ macro_rules! launch_entries {
"疑似静默失败:退出码 0,但游戏没真正跑起来"
),
LaunchFailedWithCode => ("Launch failed (exit {code}): {reason}", "启动失败(退出码 {code}):{reason}"),
// M117:微软轨的 client id 没配是**配置缺失**,不是「本期未支持」。这句话是那条
// 启动失败文案的**双语口径**(真源在 `core::auth::microsoft` 的
// `MISSING_CLIENT_ID_MESSAGE`,中文逐字一致;英文这条给 En 界面用)。
// 判据:中英都点名 `ULL_MSA_CLIENT_ID` 并给出构建期注入这条路,且**不许**出现
// 「unsupported / 未支持」——用户实跑就是被那句误导读成「功能没做」。
LaunchMsaNotConfigured => (
"Microsoft sign-in is not configured: it needs an Azure public client id (the login flow itself is implemented). Build with ULL_MSA_CLIENT_ID=<id>, or set that environment variable before launching.",
"微软登录未配置:缺少 Azure 公共客户端 id(登录功能已实现,只差这一项配置)。构建时注入:ULL_MSA_CLIENT_ID=<id> cargo build;或启动前设置同名环境变量 ULL_MSA_CLIENT_ID=<id>。"
),
} }
};
}
pub(crate) use launch_entries;
#[cfg(test)]
mod tests {
use crate::{Catalog, Key, Lang};
#[test]
fn msa_not_configured_copy_is_accurate_in_both_languages() {
// 抓得住:文案退回「本期未支持」这类说法(M117 用户实跑踩到的原 bug),
// 以及两条译文只剩一句「需要 id」却不给怎么配。
// 抓不住:读起来顺不顺——那要靠 review 与截图。
let en = Catalog::of(Lang::En).text(Key::LaunchMsaNotConfigured);
let zh = Catalog::of(Lang::ZhCn).text(Key::LaunchMsaNotConfigured);
for (tag, text) in [("en", en), ("zh-CN", zh)] {
assert!(text.contains("ULL_MSA_CLIENT_ID"), "{tag}: {text}");
}
assert!(en.contains("client id"), "{en}");
assert!(en.contains("not configured"), "{en}");
assert!(!en.to_lowercase().contains("unsupported"), "{en}");
assert!(!en.to_lowercase().contains("not implemented"), "{en}");
assert!(zh.contains("客户端 id"), "{zh}");
assert!(zh.contains("未配置"), "{zh}");
assert!(!zh.contains("未支持"), "{zh}");
assert!(!zh.contains("未实现"), "{zh}");
// 硬约束:词条里只许出现 `<id>` 占位,不出现真 id(repo 任何文件都不许带)。
assert!(en.contains("<id>") && zh.contains("<id>"));
}
}