mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-22 05:55:15 +08:00
feat(official-sync): 支持本地代理下载官方资源
This commit is contained in:
@@ -5,7 +5,9 @@
|
||||
//! discover the latest Windows client package and manifest, while resource
|
||||
//! updates still come from the game client's server-info flow.
|
||||
|
||||
use crate::curl_transfer::run_curl_with_retry as run_curl_command_with_retry;
|
||||
use crate::curl_transfer::{
|
||||
run_curl_with_retry_with_proxy as run_curl_command_with_retry, CurlProxyConfig,
|
||||
};
|
||||
use bat_adapters::official::launcher::{YostarJpLauncherManifestFile, YOSTAR_JP_GAME_TAG};
|
||||
use md5::{Digest, Md5};
|
||||
use serde::Deserialize;
|
||||
@@ -80,6 +82,7 @@ pub struct YostarJpLauncherRemoteManifest {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct OfficialLauncherBootstrapService {
|
||||
curl_command: String,
|
||||
curl_proxy: CurlProxyConfig,
|
||||
launcher_version: String,
|
||||
retry_attempts: usize,
|
||||
}
|
||||
@@ -97,11 +100,18 @@ impl OfficialLauncherBootstrapService {
|
||||
) -> Self {
|
||||
Self {
|
||||
curl_command: curl_command.into(),
|
||||
curl_proxy: CurlProxyConfig::default(),
|
||||
launcher_version: launcher_version.into(),
|
||||
retry_attempts: DEFAULT_LAUNCHER_RETRY_ATTEMPTS,
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets the proxy configuration for launcher `curl` transfers.
|
||||
pub fn with_proxy_config(mut self, curl_proxy: CurlProxyConfig) -> Self {
|
||||
self.curl_proxy = curl_proxy;
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the number of attempts for each launcher `curl` transfer.
|
||||
pub fn with_retry_attempts(mut self, retry_attempts: usize) -> Self {
|
||||
self.retry_attempts = retry_attempts.max(1);
|
||||
@@ -263,6 +273,7 @@ impl OfficialLauncherBootstrapService {
|
||||
url,
|
||||
None,
|
||||
self.retry_attempts,
|
||||
&self.curl_proxy,
|
||||
&mut build_command,
|
||||
)
|
||||
.map_err(|error| error.to_string())
|
||||
|
||||
Reference in New Issue
Block a user