chore: remove dead service (2nd attempt)

This commit is contained in:
alterware
2025-11-21 16:44:07 +01:00
parent 695a8174c8
commit 72ac6d56aa
4 changed files with 0 additions and 70 deletions

View File

@@ -148,7 +148,6 @@
- Update to prerelease version of the launcher - Update to prerelease version of the launcher
- ```--cdn-url``` - ```--cdn-url```
- ```--offline``` - ```--offline```
- ```--skip-connectivity-check```
##### Example: ##### 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`. - `prerelease`: Update to prerelease version of clients and launcher. Default: `false`.
- `cdn_url` - `cdn_url`
- `offline` - `offline`
- `skip-connectivity-check`
--- ---

View File

@@ -77,54 +77,3 @@ pub static PREFIXES: Lazy<HashMap<&'static str, PrintPrefix>> = Lazy::new(|| {
), ),
]) ])
}); });
pub async fn check_connectivity_and_rate_cdns() -> Pin<Box<dyn Future<Output = bool> + 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<String>,
) -> Pin<Box<dyn Future<Output = bool> + 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
}
})
}

View File

@@ -626,7 +626,6 @@ async fn main() {
println!(" --redist: (Re-)Install redistributables"); println!(" --redist: (Re-)Install redistributables");
println!(" --prerelease: Update to prerelease version of clients and launcher"); println!(" --prerelease: Update to prerelease version of clients and launcher");
println!(" --offline: Run in offline mode"); println!(" --offline: Run in offline mode");
println!(" --skip-connectivity-check: Don't check connectivity");
println!("\nExample:\n alterware-launcher.exe iw6 --pass \"-headless\""); println!("\nExample:\n alterware-launcher.exe iw6 --pass \"-headless\"");
return; return;
} }
@@ -674,11 +673,6 @@ async fn main() {
arg_remove(&mut args, "--offline"); 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() { let initial_cdn = if !cfg.cdn_url.is_empty() {
info!("Using custom CDN URL: {}", cfg.cdn_url); info!("Using custom CDN URL: {}", cfg.cdn_url);
Some(cfg.cdn_url.clone()) Some(cfg.cdn_url.clone())
@@ -686,14 +680,6 @@ async fn main() {
None 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 { if cfg.offline {
// Check if this is a first-time run (no stored data) // Check if this is a first-time run (no stored data)
let stored_data = cache::get_stored_data(); let stored_data = cache::get_stored_data();

View File

@@ -54,8 +54,6 @@ pub struct Config {
pub cdn_url: String, pub cdn_url: String,
#[serde(default)] #[serde(default)]
pub offline: bool, pub offline: bool,
#[serde(default)]
pub skip_connectivity_check: bool,
} }
impl Default for Config { impl Default for Config {
@@ -73,7 +71,6 @@ impl Default for Config {
prerelease: false, prerelease: false,
cdn_url: String::default(), cdn_url: String::default(),
offline: false, offline: false,
skip_connectivity_check: false,
} }
} }
} }