mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-27 11:07:08 +00:00
feat: add resumability detection and pause warnings
- Update 'fetch_metadata' to detect 'Accept-Ranges' HTTP header - Persist 'resumable' flag in DownloadItem across backend and frontend - Add confirmation dialog when pausing non-resumable downloads (single and bulk actions) - Improve UI for start/pause/options buttons by adopting the application accent color on hover
This commit is contained in:
@@ -21,6 +21,7 @@ pub struct MetadataResponse {
|
||||
size: String,
|
||||
#[ts(type = "number")]
|
||||
size_bytes: u64,
|
||||
resumable: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, serde::Deserialize, Clone, TS)]
|
||||
@@ -954,11 +955,21 @@ async fn fetch_metadata(
|
||||
}
|
||||
}
|
||||
|
||||
let mut resumable = false;
|
||||
if let Some(accept_ranges) = res.headers().get(reqwest::header::ACCEPT_RANGES) {
|
||||
if let Ok(accept_ranges_str) = accept_ranges.to_str() {
|
||||
if accept_ranges_str.to_lowercase().contains("bytes") {
|
||||
resumable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(MetadataResponse {
|
||||
url: current_url,
|
||||
filename,
|
||||
size: size_str,
|
||||
size_bytes,
|
||||
resumable,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user