diff --git a/src/main.rs b/src/main.rs index 5d80207..02a47c6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,13 +17,28 @@ fn publicise() { } #[allow(unused)] -async fn traverse(password: &str) -> Result> { +async fn get_folder_contents(password: String, url_tail: &str) -> Result> { + debug!("Entering: get_folder_contents()"); let root_url = "https://theadamcooper.com"; - let url_tail = "/nextcloud/remote.php/dav/files/adam/public"; let method = reqwest::Method::from_bytes(b"PROPFIND").unwrap(); let client = reqwest::Client::new(); - let response = client.request(method, root_url) + let url = format!("{}{}", root_url, url_tail); + debug!("url: {}", url); + let body = String::from(r#" + + + + + + + + + + + "#); + let response = client.request(method, url) .basic_auth("adam", Some(password)) + .body(body) .send() .await?; debug!("{:?}", response); @@ -41,9 +56,14 @@ fn get_password() -> Result { } } -fn main() { +#[tokio::main] +async fn main() -> Result<(), Box> { env_logger::Builder::from_env(Env::default().default_filter_or("trace")).target(Target::Stdout).init(); println!("Publicise it!"); let password = get_password().unwrap(); debug!("Received password: {}", password); + + let folder_contents = get_folder_contents(password, "/nextcloud/remote.php/dav/files/adam/public").await?; + debug!("{:?}", folder_contents); + Ok(()) }