mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-14 08:04:52 +01:00
split main launcher into seperate file
This commit is contained in:
18
src-tauri/src/gamebanana.rs
Normal file
18
src-tauri/src/gamebanana.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use crate::web;
|
||||
|
||||
static API_URL: &str = "https://api.gamebanana.com";
|
||||
static SITE_URL: &str = "https://gamebanana.com";
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn list_submissions(mode: String) -> String {
|
||||
let res = web::query(
|
||||
format!(
|
||||
"{}/apiv9/Util/Game/Submissions?_idGameRow=8552&_nPage=1&_nPerpage=50&_sMode={}",
|
||||
SITE_URL, mode
|
||||
)
|
||||
.as_str(),
|
||||
)
|
||||
.await;
|
||||
|
||||
res
|
||||
}
|
||||
@@ -12,6 +12,7 @@ use sysinfo::{System, SystemExt};
|
||||
|
||||
mod downloader;
|
||||
mod file_helpers;
|
||||
mod gamebanana;
|
||||
mod lang;
|
||||
mod metadata_patcher;
|
||||
mod proxy;
|
||||
@@ -59,6 +60,7 @@ fn main() {
|
||||
lang::get_languages,
|
||||
web::valid_url,
|
||||
web::web_get,
|
||||
gamebanana::list_submissions,
|
||||
metadata_patcher::patch_metadata
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use reqwest::header::USER_AGENT;
|
||||
use reqwest::header::{CONTENT_TYPE, USER_AGENT};
|
||||
|
||||
pub(crate) async fn query(site: &str) -> String {
|
||||
let client = reqwest::Client::new();
|
||||
@@ -6,6 +6,7 @@ pub(crate) async fn query(site: &str) -> String {
|
||||
let response = client
|
||||
.get(site)
|
||||
.header(USER_AGENT, "cultivation")
|
||||
.header(CONTENT_TYPE, "application/json")
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user