feat: 移植忽略 SSL 证书错误选项(设置开关 + 重建 HTTP 客户端)
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled

This commit is contained in:
AxTps committed 2026-10-02 21:20:26 +08:00
1 parent d2c32ed14f
commit ead942abb2
9 files changed
+78 -6

No files matched your search

+25 -3
View File
@@ -608,7 +608,11 @@ impl State {
config: &crate::util::proxy::ProxyConfig,
) -> crate::Result<()> {
let _update = self.configured_http_client_update.lock().await;
let client = crate::util::fetch::build_configured_client(config)?;
let settings = Settings::get(&self.pool).await?;
let client = crate::util::fetch::build_configured_client(
config,
settings.ignore_ssl_errors,
)?;
crate::state::proxy_settings::set(&self.pool, config).await?;
*self.configured_http_client.write() = client;
Ok(())
@@ -618,6 +622,21 @@ impl State {
self.configured_http_client.read().clone()
}
/// 在设置变更(如忽略 SSL 证书开关)后重建 HTTP 客户端。
pub(crate) async fn update_http_client_for_settings(
&self,
settings: &Settings,
) -> crate::Result<()> {
let _update = self.configured_http_client_update.lock().await;
let proxy = crate::state::proxy_settings::get(&self.pool).await?;
let client = crate::util::fetch::build_configured_client(
&proxy,
settings.ignore_ssl_errors,
)?;
*self.configured_http_client.write() = client;
Ok(())
}
pub(crate) fn auto_prefers_mirror(&self) -> bool {
self.auto_prefers_mirror.load(Ordering::Relaxed)
}
@@ -839,7 +858,10 @@ impl State {
let auto_prefers_mirror = settings.auto_prefers_mirror();
let proxy_config = proxy_settings::get(&pool).await?;
let configured_http_client =
crate::util::fetch::build_configured_client(&proxy_config)?;
crate::util::fetch::build_configured_client(
&proxy_config,
settings.ignore_ssl_errors,
)?;
tracing::info!("Initializing directories");
DirectoryInfo::move_launcher_directory(
@@ -955,7 +977,7 @@ pub(crate) async fn test_state(
let file_watcher = instances::watcher::init_watcher().await?;
let proxy_config = proxy_settings::get(&pool).await?;
let configured_http_client =
crate::util::fetch::build_configured_client(&proxy_config)?;
crate::util::fetch::build_configured_client(&proxy_config, false)?;
Ok(Arc::new(State {
directories,