mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-12 23:24:35 +01:00
show commits in news section
This commit is contained in:
@@ -3,7 +3,6 @@ all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use open;
|
||||
use structs::{APIQuery};
|
||||
|
||||
@@ -20,6 +19,7 @@ fn main() {
|
||||
disconnect,
|
||||
run_program,
|
||||
run_jar,
|
||||
req_get,
|
||||
get_bg_file,
|
||||
downloader::download_file,
|
||||
downloader::stop_download,
|
||||
@@ -65,6 +65,15 @@ fn run_jar(path: String, execute_in: String) {
|
||||
};
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn req_get(url: String) -> String {
|
||||
// Send a GET request to the specified URL.
|
||||
let response = web::query(&url.to_string()).await;
|
||||
|
||||
// Send the response body back to the client.
|
||||
return response;
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn get_bg_file() -> String {
|
||||
let query = web::query("https://api.grasscutters.xyz/cultivation/query").await;
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
use reqwest::header::USER_AGENT;
|
||||
|
||||
pub(crate) async fn query(site: &str) -> String {
|
||||
let response = reqwest::get(site).await.unwrap();
|
||||
let client = reqwest::Client::new();
|
||||
|
||||
let response = client.get(site).header(USER_AGENT, "cultivation").send().await.unwrap();
|
||||
return response.text().await.unwrap();
|
||||
}
|
||||
Reference in New Issue
Block a user