mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-14 16:14:48 +01:00
Merge branch 'main' into patching
This commit is contained in:
@@ -3,7 +3,12 @@ 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();
|
||||
let response = client
|
||||
.get(site)
|
||||
.header(USER_AGENT, "cultivation")
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
response.text().await.unwrap()
|
||||
}
|
||||
|
||||
@@ -12,7 +17,12 @@ 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();
|
||||
let response = client
|
||||
.get(url)
|
||||
.header(USER_AGENT, "cultivation")
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
response.status().as_str() == "200"
|
||||
}
|
||||
@@ -21,4 +31,4 @@ pub(crate) async fn valid_url(url: String) -> bool {
|
||||
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