[wip] Mostly debugging statements
This commit is contained in:
parent
b331363d09
commit
062d973d8a
1 changed files with 14 additions and 1 deletions
15
src/main.rs
15
src/main.rs
|
@ -138,9 +138,13 @@ async fn traverse(mut result: Multistatus) {
|
||||||
|
|
||||||
// Depth first traversal
|
// Depth first traversal
|
||||||
while current_index < (&mut result.response).len() {
|
while current_index < (&mut result.response).len() {
|
||||||
|
debug!("current_index: {:?}", current_index);
|
||||||
// If result.response[current_index] has not been visited
|
// If result.response[current_index] has not been visited
|
||||||
if !visited_items.contains_key(&mut result.response[current_index].propstat[0].prop.get_etag) {
|
if !visited_items.contains_key(&mut result.response[current_index].propstat[0].prop.get_etag) {
|
||||||
|
debug!("Fresh item...");
|
||||||
|
// if it's a collection
|
||||||
if !(&mut result.response[current_index].propstat[0].prop.resource_type.collection).is_empty() {
|
if !(&mut result.response[current_index].propstat[0].prop.resource_type.collection).is_empty() {
|
||||||
|
debug!("Collection...");
|
||||||
// Get the contents XML
|
// Get the contents XML
|
||||||
let folder_contents: String = get_folder_contents(
|
let folder_contents: String = get_folder_contents(
|
||||||
&result.response[current_index].href, // change to mutable borrow if necessary
|
&result.response[current_index].href, // change to mutable borrow if necessary
|
||||||
|
@ -150,9 +154,16 @@ async fn traverse(mut result: Multistatus) {
|
||||||
debug!("{:?}", folder_contents);
|
debug!("{:?}", folder_contents);
|
||||||
// Parse the contents XML into Multistatus
|
// Parse the contents XML into Multistatus
|
||||||
let mut new_result: Multistatus = from_str(&String::from(folder_contents)).unwrap();
|
let mut new_result: Multistatus = from_str(&String::from(folder_contents)).unwrap();
|
||||||
|
debug!("\nParsed:\n{:?}", new_result);
|
||||||
// Append the NextcloudResponse vector to result.response
|
// Append the NextcloudResponse vector to result.response
|
||||||
result.response.append(&mut new_result.response);
|
result.response.append(&mut new_result.response);
|
||||||
} // else if it's not public, publicise it.
|
} else {
|
||||||
|
debug!("Node...");
|
||||||
|
// else it's a node. if it's not public, publicise it.
|
||||||
|
if !(&mut result.response[current_index].propstat[0].prop.share_types).contains(&ShareType{ share_type: 3 }) {
|
||||||
|
println!("it's not public");
|
||||||
|
}
|
||||||
|
}
|
||||||
// also add debugging statements in this function throughout!
|
// also add debugging statements in this function throughout!
|
||||||
}
|
}
|
||||||
current_index += 1;
|
current_index += 1;
|
||||||
|
@ -187,6 +198,8 @@ async fn main() -> std::io::Result<()> {
|
||||||
.init();
|
.init();
|
||||||
println!("Publicise it!");
|
println!("Publicise it!");
|
||||||
|
|
||||||
|
// TODO: Call get_password here. Maybe get_password should then store the password in the
|
||||||
|
// environment?
|
||||||
let folder_contents: String =
|
let folder_contents: String =
|
||||||
// get_folder_contents("/nextcloud/remote.php/dav/files/adam/test_public/2019_test_public")
|
// get_folder_contents("/nextcloud/remote.php/dav/files/adam/test_public/2019_test_public")
|
||||||
get_folder_contents(&String::from("/nextcloud/remote.php/dav/files/adam/test_public"))
|
get_folder_contents(&String::from("/nextcloud/remote.php/dav/files/adam/test_public"))
|
||||||
|
|
Loading…
Reference in a new issue