fix: 汉化版检测兜底——版本号含 -zh 时强制判定为汉化版

Rust get_version_info + Web dev-api.js get_version_info:
如果检测到的版本号包含 "-zh" 后缀,直接覆盖 source 为 "chinese",
不再依赖文件系统路径检测(Windows .cmd shim 路径不含包名信息)
This commit is contained in:
晴天
2026-03-26 06:36:20 +08:00
parent 535f72d1f9
commit ac903f84b4
2 changed files with 10 additions and 2 deletions

View File

@@ -2983,8 +2983,10 @@ const handlers = {
// 版本信息
async get_version_info() {
const source = detectInstalledSource()
let source = detectInstalledSource()
const current = getLocalOpenclawVersion()
// 兜底:版本号含 -zh 则一定是汉化版
if (current && current.includes('-zh') && source !== 'chinese') source = 'chinese'
const latest = await getLatestVersionFor(source)
const recommended = recommendedVersionFor(source)

View File

@@ -1390,7 +1390,13 @@ fn detect_installed_source() -> String {
#[tauri::command]
pub async fn get_version_info() -> Result<VersionInfo, String> {
let current = get_local_version().await;
let source = detect_installed_source();
let mut source = detect_installed_source();
// 兜底:版本号含 -zh 则一定是汉化版(文件系统检测可能误判)
if let Some(ref ver) = current {
if ver.contains("-zh") && source != "chinese" {
source = "chinese".to_string();
}
}
let latest = get_latest_version_for(&source).await;
let recommended = recommended_version_for(&source);
let update_available = match (&current, &recommended) {