继续多语言处理

This commit is contained in:
xintaofei
2026-03-07 15:49:00 +08:00
parent 931f69c421
commit 6e5219cc10
18 changed files with 466 additions and 234 deletions

View File

@@ -1,3 +1,4 @@
use crate::app_error::{AppCommandError, AppErrorCode};
use crate::models::SystemProxySettings;
const PROXY_ENV_KEYS: [&str; 6] = [
@@ -9,14 +10,19 @@ const PROXY_ENV_KEYS: [&str; 6] = [
"all_proxy",
];
pub fn apply_system_proxy_settings(settings: &SystemProxySettings) -> Result<(), String> {
pub fn apply_system_proxy_settings(settings: &SystemProxySettings) -> Result<(), AppCommandError> {
if settings.enabled {
let proxy_url = settings
.proxy_url
.as_deref()
.map(str::trim)
.filter(|value| !value.is_empty())
.ok_or_else(|| "proxy url is required when proxy is enabled".to_string())?;
.ok_or_else(|| {
AppCommandError::new(
AppErrorCode::ConfigurationMissing,
"Proxy URL is required when proxy is enabled",
)
})?;
for key in PROXY_ENV_KEYS {
unsafe {