Full offline compatibility

This commit is contained in:
Thoronium
2023-03-05 19:13:09 -07:00
parent abf7a428f6
commit ea73feb8e9
9 changed files with 250 additions and 170 deletions

View File

@@ -9,8 +9,13 @@ pub(crate) async fn query(site: &str) -> String {
.header(CONTENT_TYPE, "application/json")
.send()
.await
.unwrap();
response.text().await.unwrap()
.ok();
if response.is_some() {
return response.unwrap().text().await.unwrap();
} else {
false.to_string()
}
}
#[tauri::command]
@@ -23,9 +28,13 @@ pub(crate) async fn valid_url(url: String) -> bool {
.header(USER_AGENT, "cultivation")
.send()
.await
.unwrap();
.ok();
response.status().as_str() == "200"
if response.is_some() {
return response.unwrap().status().as_str() == "200";
} else {
false
}
}
#[tauri::command]