mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-15 08:34:43 +01:00
18 lines
528 B
Rust
18 lines
528 B
Rust
use reqwest::header::USER_AGENT;
|
|
|
|
pub(crate) async fn query(site: &str) -> String {
|
|
let client = reqwest::Client::new();
|
|
|
|
let response = client.get(site).header(USER_AGENT, "cultivation").send().await.unwrap();
|
|
response.text().await.unwrap()
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub(crate) async fn valid_url(url: String) -> bool {
|
|
// Check if we get a 200 response
|
|
let client = reqwest::Client::new();
|
|
|
|
let response = client.get(url).header(USER_AGENT, "cultivation").send().await.unwrap();
|
|
|
|
response.status().as_str() == "200"
|
|
} |