diff options
| author | A Farzat <a@farzat.xyz> | 2026-02-11 10:09:32 +0300 |
|---|---|---|
| committer | A Farzat <a@farzat.xyz> | 2026-02-11 10:09:32 +0300 |
| commit | 3321918c009e9d7a7a3c3c2a1f490bb91fefb2bc (patch) | |
| tree | 261a7228b3199c689e6970effd9bb8d4fc609531 /src/main.rs | |
| parent | 001304d3f27a5fa1ca4d06d4c352d248b45640e0 (diff) | |
| download | safaribooks-rs-3321918c009e9d7a7a3c3c2a1f490bb91fefb2bc.tar.gz safaribooks-rs-3321918c009e9d7a7a3c3c2a1f490bb91fefb2bc.zip | |
Add reqwest HttpClient skeleton (cookies-only)
- Build a reqwest::Client with Cookie and browser-like default headers
- Wire into main without performing any HTTP calls
Note: Keep cookie header internal; never log values
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index e582af9..6981b8e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,15 +2,16 @@ mod cli; mod config; mod cookies; mod display; +mod http_client; use clap::Parser; use cli::Args; use cookies::CookieStore; use display::Display; +use http_client::HttpClient; fn main() { let args = Args::parse(); - let mut ui = Display::new(&args.bookid); let cookies_path = config::cookies_file(); @@ -38,6 +39,13 @@ fn main() { names.join(", ") )); + // Build the HTTP client with our cookies (no network calls yet). + let _client = match HttpClient::from_store(&store) { + Ok(c) => c, + Err(e) => ui.error_and_exit(&format!("Failed to build HTTP client: {e}")), + }; + ui.info("HTTP client initialized with cookies (no requests performed)."); + let output_dir = config::books_root().join(format!("(pending) ({})", args.bookid)); ui.set_output_dir(output_dir); |
