emergency metadata recovery

This commit is contained in:
SpikeHD
2022-07-15 19:35:57 -07:00
parent a1b0fec871
commit bd54a78e4b
7 changed files with 88 additions and 2 deletions

View File

@@ -66,7 +66,13 @@ pub fn copy_file_with_new_name(path: String, new_path: String, new_name: String)
// If the new path doesn't exist, create it.
if !dir_exists(new_path_buf.pop().to_string().as_str()) {
std::fs::create_dir_all(&new_path).unwrap();
match std::fs::create_dir_all(&new_path) {
Ok(_) => {}
Err(e) => {
println!("Failed to create directory: {}", e);
return false;
}
};
}
// Copy old to new

View File

@@ -54,6 +54,7 @@ fn main() {
lang::get_lang,
lang::get_languages,
web::valid_url,
web::web_get,
metadata_patcher::patch_metadata
])
.run(tauri::generate_context!())

View File

@@ -15,4 +15,10 @@ pub(crate) async fn valid_url(url: String) -> bool {
let response = client.get(url).header(USER_AGENT, "cultivation").send().await.unwrap();
response.status().as_str() == "200"
}
#[tauri::command]
pub async fn web_get(url: String) -> String {
// Send a GET request to the specified URL and send the response body back to the client.
query(&url).await
}