shrupl/src/main.rs

30 lines
745 B
Rust
Raw Normal View History

2025-05-22 17:34:44 +00:00
mod sharry;
use log::info;
2025-05-24 00:48:59 +00:00
use sharry::{Alias, File, NewShareRequest, Share};
2025-05-22 17:34:44 +00:00
use std::time::Duration;
use ureq::Agent;
2025-05-17 23:57:52 +00:00
fn main() {
2025-05-22 17:34:44 +00:00
env_logger::init();
let agent: Agent = Agent::config_builder()
.timeout_global(Some(Duration::from_secs(5)))
.build()
.into();
2025-05-22 21:07:49 +00:00
let alias = Alias::new(
2025-05-24 00:22:24 +00:00
"sharry.yavook.de".into(),
2025-05-22 21:07:49 +00:00
"G7RYoWME1W7-pcgipemJcr8-39FcMd92gBu-RgufeHc51z6",
);
2025-05-22 17:34:44 +00:00
2025-05-24 00:22:24 +00:00
let share = NewShareRequest::new(Some("foo"), "", 10);
let share = Share::create(&agent, &alias, share).unwrap();
2025-05-22 21:07:49 +00:00
info!("share: {:?}", share);
2025-05-24 00:48:59 +00:00
let file = File::create(&agent, &share, "/lib/x86_64-linux-gnu/liblldb-14.so.1").unwrap();
info!("file: {:?}", file);
2025-05-23 01:11:11 +00:00
2025-05-22 21:07:49 +00:00
share.notify(&agent).unwrap();
2025-05-17 23:57:52 +00:00
}