Compare commits
No commits in common. "main" and "011-fix-url" have entirely different histories.
main
...
011-fix-ur
3 changed files with 4 additions and 23 deletions
13
LICENSE
13
LICENSE
|
@ -1,13 +0,0 @@
|
|||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
@ -1,5 +0,0 @@
|
|||
### publicise-rs
|
||||
|
||||
_Publicise_ is an application which traverses a Nextcloud folder and creates a public share for each file.
|
||||
|
||||
The application was originally devised as a way to share photos with people without Instagram accounts, and as an exploration of Rust.
|
|
@ -226,26 +226,25 @@ async fn traverse(mut result: Multistatus, config: &Config) -> Result<bool, Box<
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
|
||||
env_logger::Builder::from_env(Env::default()).init();
|
||||
println!("Publicise it!\n\n");
|
||||
|
||||
let mut config = init().unwrap();
|
||||
if config.credentials.password == None {
|
||||
let output = Command::new(&config.credentials.password_script.as_ref().unwrap()).output().unwrap();
|
||||
if output.stdout.len() == 0 {
|
||||
panic!("[main] Failed to acquire password from provided script.");
|
||||
}
|
||||
config.credentials.password = Some(String::from_utf8(output.stdout).unwrap());
|
||||
}
|
||||
debug!("[main] {:?}", &config);
|
||||
|
||||
let full_path = &(String::from("/remote.php/dav/files/") + &config.credentials.username + "/" + &config.paths.target);
|
||||
let folder_contents: String =
|
||||
get_folder_contents(full_path, &config)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let result: Multistatus = from_str(&folder_contents).unwrap();
|
||||
debug!("[main] {:?}", result);
|
||||
|
||||
let _ = traverse(result, &config).await.unwrap();
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue