show commits in news section

This commit is contained in:
SpikeHD
2022-05-14 02:05:14 -07:00
parent 053c43a079
commit 3d62512814
5 changed files with 92 additions and 7 deletions

View File

@@ -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;

View File

@@ -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();
}