This commit is contained in:
darkmage 2023-12-23 11:37:29 -06:00
commit 5d7cebaafb
3 changed files with 33 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/target
Cargo.lock

6
Cargo.toml Normal file
View File

@ -0,0 +1,6 @@
[package]
name = "hp"
version = "0.1.0"
edition = "2021"
[dependencies]
reqwest = { version = "0.11.11", features = ["stream","multipart","json", "blocking"] }

25
src/main.rs Normal file
View File

@ -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<dyn std::error::Error>> {
let args: Vec<String> = args().collect();
if args.len() < 2 {
println!("Usage: hardfiles <file>");
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(())
}