master
Drake 1 year ago
parent b7151ff9ad
commit c6a353be1d

4
Cargo.lock generated

@ -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",

@ -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"

@ -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() {

@ -156,7 +156,7 @@ pub async fn render(Query(params): Query<SearchParams>) -> 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)) { ">" }
}
}

Loading…
Cancel
Save