diff --git a/README.md b/README.md index 61c6cb3..ca6c9ac 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,6 @@ - Update to prerelease version of the launcher - ```--cdn-url``` - ```--offline``` -- ```--skip-connectivity-check``` ##### Example: @@ -173,7 +172,6 @@ alterware-launcher.exe iw6 --bonus -u --path "C:\Games\IW6x" --pass "-headless" - `prerelease`: Update to prerelease version of clients and launcher. Default: `false`. - `cdn_url` - `offline` -- `skip-connectivity-check` --- diff --git a/src/global.rs b/src/global.rs index 5f11fba..829f20e 100644 --- a/src/global.rs +++ b/src/global.rs @@ -77,54 +77,3 @@ pub static PREFIXES: Lazy> = Lazy::new(|| { ), ]) }); - -pub async fn check_connectivity_and_rate_cdns() -> Pin + Send>> { - Box::pin(async move { - crate::println_info!("Initializing CDN rating system..."); - let hosts = Hosts::new().await; - let best_cdn = hosts.get_master_url(); - - if let Some(cdn_url) = best_cdn { - let cdn_url = cdn_url.trim_end_matches('/'); - *MASTER_URL.lock().unwrap() = cdn_url.to_string(); - crate::println_info!("Selected CDN: {}", cdn_url); - - match crate::http_async::get_body_string(cdn_url).await { - Ok(_) => { - info!("Successfully connected to CDN: {}", cdn_url); - true - } - Err(e) => { - error!("Failed to connect to selected CDN {}: {}", cdn_url, e); - *IS_OFFLINE.lock().unwrap() = true; - false - } - } - } else { - crate::println_error!("No CDN hosts are available"); - *IS_OFFLINE.lock().unwrap() = true; - false - } - }) -} - -pub fn check_connectivity( - master_url: Option, -) -> Pin + Send>> { - Box::pin(async move { - if let Some(url) = master_url { - *MASTER_URL.lock().unwrap() = url.clone(); - crate::println_info!("Using fallback connectivity check on {}", url); - - match crate::http_async::get_body_string(&url).await { - Ok(_) => true, - Err(_) => { - *IS_OFFLINE.lock().unwrap() = true; - false - } - } - } else { - check_connectivity_and_rate_cdns().await.await - } - }) -} diff --git a/src/main.rs b/src/main.rs index 2ce10c2..19d98a2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -626,7 +626,6 @@ async fn main() { println!(" --redist: (Re-)Install redistributables"); println!(" --prerelease: Update to prerelease version of clients and launcher"); println!(" --offline: Run in offline mode"); - println!(" --skip-connectivity-check: Don't check connectivity"); println!("\nExample:\n alterware-launcher.exe iw6 --pass \"-headless\""); return; } @@ -674,11 +673,6 @@ async fn main() { arg_remove(&mut args, "--offline"); } - if arg_bool(&args, "--skip-connectivity-check") { - cfg.skip_connectivity_check = true; - arg_remove(&mut args, "--skip-connectivity-check"); - } - let initial_cdn = if !cfg.cdn_url.is_empty() { info!("Using custom CDN URL: {}", cfg.cdn_url); Some(cfg.cdn_url.clone()) @@ -686,14 +680,6 @@ async fn main() { None }; - if !cfg.offline && !cfg.skip_connectivity_check { - if initial_cdn.is_some() { - cfg.offline = !global::check_connectivity(initial_cdn).await; - } else { - cfg.offline = !global::check_connectivity_and_rate_cdns().await.await; - } - } - if cfg.offline { // Check if this is a first-time run (no stored data) let stored_data = cache::get_stored_data(); diff --git a/src/structs.rs b/src/structs.rs index acc056d..c395cd0 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -54,8 +54,6 @@ pub struct Config { pub cdn_url: String, #[serde(default)] pub offline: bool, - #[serde(default)] - pub skip_connectivity_check: bool, } impl Default for Config { @@ -73,7 +71,6 @@ impl Default for Config { prerelease: false, cdn_url: String::default(), offline: false, - skip_connectivity_check: false, } } }