//! Connectivity probing. //! //! The webview's `navigator.onLine` reports link state, not reachability — it //! is true on a captive-portal wifi with no real internet, which is exactly the //! situation this app exists for. So we actually talk to YouTube. use std::time::Duration; pub async fn is_online(client: &reqwest::Client) -> bool { client .head("https://www.youtube.com/") .timeout(Duration::from_secs(5)) .send() .await .map(|r| r.status().is_success() || r.status().is_redirection()) .unwrap_or(false) }