Refresh fetches 8 channel feeds concurrently and mirrors thumbnails to disk so the offline feed still renders. Downloads are capped at 2 and shell out to yt-dlp with an absolute binary path, since GUI apps do not inherit a login shell PATH.
18 lines
571 B
Rust
18 lines
571 B
Rust
//! 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)
|
|
}
|