fix: report legacy TLS subscription failures

This commit is contained in:
Tunglies
2026-05-25 22:22:24 +08:00
parent 8ccb0b9abd
commit ec9ef0f85e
5 changed files with 39 additions and 8 deletions
+9 -1
View File
@@ -24,6 +24,14 @@ use std::time::Duration;
static CURRENT_SWITCHING_PROFILE: AtomicBool = AtomicBool::new(false);
fn profile_import_error(err: &anyhow::Error) -> std::string::String {
if let Some(cause) = err.chain().find(|cause| cause.to_string().contains("TLS 1.0/1.1")) {
return cause.to_string();
}
format!("导入订阅失败: {err:#}")
}
#[tauri::command]
pub async fn get_profiles() -> CmdResult<SharedDraft<IProfiles>> {
logging!(debug, Type::Cmd, "获取配置文件列表");
@@ -70,7 +78,7 @@ pub async fn import_profile(url: std::string::String, option: Option<PrfOption>)
}
Err(e) => {
logging!(error, Type::Cmd, "[导入订阅] 下载失败: {}", e);
return Err(format!("导入订阅失败: {}", e).into());
return Err(profile_import_error(&e).into());
}
};