Don't show chapters with empty chapter numbers and bump tokio version

This commit is contained in:
blank X 2021-03-14 15:50:34 +07:00
parent 27c8c76dfe
commit 0d3fde7d47
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
3 changed files with 6 additions and 4 deletions

2
Cargo.lock generated
View File

@ -338,7 +338,7 @@ dependencies = [
[[package]] [[package]]
name = "mangadexrs" name = "mangadexrs"
version = "0.1.0" version = "0.2.0"
dependencies = [ dependencies = [
"clap", "clap",
"quick-xml", "quick-xml",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "mangadexrs" name = "mangadexrs"
version = "0.1.0" version = "0.2.0"
authors = ["blank X <theblankx@protonmail.com>"] authors = ["blank X <theblankx@protonmail.com>"]
edition = "2018" edition = "2018"
@ -10,7 +10,7 @@ edition = "2018"
lto = true lto = true
[dependencies] [dependencies]
tokio = { version = "1.1", features = ["rt-multi-thread"] } tokio = { version = "1.2", features = ["rt-multi-thread"] }
reqwest = "0.11" reqwest = "0.11"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"

View File

@ -17,7 +17,9 @@ pub async fn get_manga(client: reqwest::Client, id: i32) -> Result<Option<struct
return Ok(None); return Ok(None);
} }
resp.error_for_status_ref()?; resp.error_for_status_ref()?;
Ok(Some(serde_json::from_str(&resp.text().await?)?)) let mut manga: structs::Manga = serde_json::from_str(&resp.text().await?)?;
manga.data.chapters.retain(|i| !i.chapter.is_empty());
Ok(Some(manga))
} }
pub async fn get_chapter(client: reqwest::Client, chapter: i32) -> Result<Option<structs::Chapter>, structs::Error> { pub async fn get_chapter(client: reqwest::Client, chapter: i32) -> Result<Option<structs::Chapter>, structs::Error> {