From c6a353be1d10a19702d0f72f3003b6d97d1ff59d Mon Sep 17 00:00:00 2001 From: Ruthenic Date: Sat, 22 Apr 2023 21:01:43 -0400 Subject: [PATCH] stuff --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- src/main.rs | 6 ++++-- src/routes/search.rs | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 00b2267..84d68be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2020,9 +2020,9 @@ checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "wattpad" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a19887ffed259ee2c57d877f9ae7112ff4b1ec28eee2442df985335ab62155" +checksum = "c4f36c412d45e66fa542363f2fac20e9b3158044d662616c8ecf5a1e27e813a7" dependencies = [ "anyhow", "regex", diff --git a/Cargo.toml b/Cargo.toml index 40b8615..05e37ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,4 +19,4 @@ serde_json = "1.0.94" tokio = { version = "1.26.0", features = ["full"] } tracing = "0.1.37" tracing-subscriber = "0.3.16" -wattpad = "0.3.0" +wattpad = "0.3.1" diff --git a/src/main.rs b/src/main.rs index 4968981..4a72c59 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,8 +15,10 @@ use web_api::get_story; lazy_static! { pub static ref TOKIO: Runtime = Runtime::new().unwrap(); - pub static ref WATTPAD: Wattpad = - TOKIO.block_on(async { Wattpad::new().await.expect("Failed to initialize Wattpad!") }); + pub static ref WATTPAD: Wattpad = TOKIO.block_on(async { + let watt = Wattpad::new().await.expect("Failed to initialize Wattpad!"); + watt + }); } fn main() { diff --git a/src/routes/search.rs b/src/routes/search.rs index 3522e20..8ae4f5f 100644 --- a/src/routes/search.rs +++ b/src/routes/search.rs @@ -156,7 +156,7 @@ pub async fn render(Query(params): Query) -> Markup { a href=(format!("/search?query={}&type={}&sort={}&page={}", query, search_type, search_sort, page_number-1)) { "<" } } " | " - @if results.stories.clone().len() == 30 { + @if search.page(page_number).await.expect("Failed to get search results 2").stories.len() > 0 { a href=(format!("/search?query={}&type={}&sort={}&page={}", query, search_type, search_sort, page_number+1)) { ">" } } }