mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-14 16:14:48 +01:00
emergency metadata recovery
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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!())
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user