commit 5d7cebaafbeaa06ed81e7c55f877cdfa2c4e654c Author: darkmage <165251+mikedesu@users.noreply.github.com> Date: Sat Dec 23 11:37:29 2023 -0600 first diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..96ef6c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..870fda7 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "hp" +version = "0.1.0" +edition = "2021" +[dependencies] +reqwest = { version = "0.11.11", features = ["stream","multipart","json", "blocking"] } diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..6d01d8d --- /dev/null +++ b/src/main.rs @@ -0,0 +1,25 @@ +use reqwest::blocking::Client; +use reqwest::blocking::multipart::Form; +use reqwest::redirect::Policy; +use std::env::args; +use std::time::Duration; +fn main() -> Result<(), Box> { + let args: Vec = args().collect(); + if args.len() < 2 { + println!("Usage: hardfiles "); + return Ok(()); + } + let filepath = &args[1]; + let client = Client::builder() + .redirect(Policy::none()) + .timeout(Duration::from_secs(180)) + .build()?; + let form = Form::new() + .file("file", filepath)?; + let res = client.post("https://hardfiles.org") + .multipart(form) + .send()?; + println!("{}", res.text()?); + Ok(()) +} +