downloading and extracting

This commit is contained in:
SpikeHD
2022-07-24 18:14:18 -07:00
parent 975b04fd0e
commit 36c2302f1b
13 changed files with 143 additions and 28 deletions

View File

@@ -8,6 +8,13 @@ use std::path::PathBuf;
static API_URL: &str = "https://api.gamebanana.com";
static SITE_URL: &str = "https://gamebanana.com";
#[tauri::command]
pub async fn get_download_links(modId: String) -> String {
let res = web::query(format!("{}/apiv9/Mod/{}/DownloadPage", SITE_URL, modId).as_str()).await;
res
}
#[tauri::command]
pub async fn list_submissions(mode: String) -> String {
let res = web::query(

View File

@@ -60,6 +60,7 @@ fn main() {
lang::get_languages,
web::valid_url,
web::web_get,
gamebanana::get_download_links,
gamebanana::list_submissions,
gamebanana::list_mods,
metadata_patcher::patch_metadata

View File

@@ -3,7 +3,7 @@ use std::path;
use std::thread;
#[tauri::command]
pub fn unzip(window: tauri::Window, zipfile: String, destpath: String) {
pub fn unzip(window: tauri::Window, zipfile: String, destpath: String, top_level: Option<bool>) {
// Read file TODO: replace test file
let f = match File::open(&zipfile) {
Ok(f) => f,
@@ -21,7 +21,7 @@ pub fn unzip(window: tauri::Window, zipfile: String, destpath: String) {
window.emit("extract_start", &zipfile).unwrap();
match zip_extract::extract(&f, &full_path, true) {
match zip_extract::extract(&f, &full_path, top_level.unwrap_or(false)) {
Ok(_) => {
println!(
"Extracted zip file to: {}",