diff options
-rw-r--r-- | src-tauri/src/main.rs | 7 | ||||
-rw-r--r-- | src-tauri/src/mod_management/mod.rs | 18 | ||||
-rw-r--r-- | src-tauri/src/repair_and_verify/mod.rs | 6 |
3 files changed, 17 insertions, 14 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 0e62aa3c..4eab7a00 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -9,7 +9,10 @@ use std::{ time::Duration, }; -use app::{*, constants::{APP_USER_AGENT, MASTER_SERVER_URL, SERVER_BROWSER_ENDPOINT}}; +use app::{ + constants::{APP_USER_AGENT, MASTER_SERVER_URL, SERVER_BROWSER_ENDPOINT}, + *, +}; mod github; use github::release_notes::{ @@ -309,11 +312,9 @@ async fn clean_up_download_folder_caller( } } - /// Gets server and playercount from master server API #[tauri::command] async fn get_server_player_count() -> Result<(i32, usize), String> { - let url = format!("{MASTER_SERVER_URL}{SERVER_BROWSER_ENDPOINT}"); let client = reqwest::Client::new(); let res = client diff --git a/src-tauri/src/mod_management/mod.rs b/src-tauri/src/mod_management/mod.rs index e45fa3c1..c37882fe 100644 --- a/src-tauri/src/mod_management/mod.rs +++ b/src-tauri/src/mod_management/mod.rs @@ -184,7 +184,10 @@ fn parse_for_thunderstore_mod_string(nsmod_path: String) -> Result<String, anyho file.read_to_string(&mut thunderstore_author)?; // Build mod string - let thunderstore_mod_string = format!("{}-{}-{}", thunderstore_author, thunderstore_manifest.name, thunderstore_manifest.version_number); + let thunderstore_mod_string = format!( + "{}-{}-{}", + thunderstore_author, thunderstore_manifest.name, thunderstore_manifest.version_number + ); Ok(thunderstore_mod_string) } @@ -226,11 +229,10 @@ fn parse_installed_mods(game_install: GameInstall) -> Result<Vec<NorthstarMod>, } }; // Get Thunderstore mod string if it exists - let thunderstore_mod_string = - match parse_for_thunderstore_mod_string(directory_str) { - Ok(thunderstore_mod_string) => Some(thunderstore_mod_string), - Err(_err) => None, - }; + let thunderstore_mod_string = match parse_for_thunderstore_mod_string(directory_str) { + Ok(thunderstore_mod_string) => Some(thunderstore_mod_string), + Err(_err) => None, + }; // Get directory path let mod_directory = directory.to_str().unwrap().to_string(); @@ -409,13 +411,11 @@ pub async fn fc_download_mod_and_install( let author = thunderstore_mod_string.split("-").next().unwrap(); // Extract the mod to the mods directory - match thermite::core::manage::install_mod(author, &f, std::path::Path::new(&mods_directory)) - { + match thermite::core::manage::install_mod(author, &f, std::path::Path::new(&mods_directory)) { Ok(()) => (), Err(err) => return Err(err.to_string()), }; - // Delete downloaded zip file std::fs::remove_file(path).unwrap(); diff --git a/src-tauri/src/repair_and_verify/mod.rs b/src-tauri/src/repair_and_verify/mod.rs index 393a8cdd..fb108f37 100644 --- a/src-tauri/src/repair_and_verify/mod.rs +++ b/src-tauri/src/repair_and_verify/mod.rs @@ -1,4 +1,7 @@ -use crate::{mod_management::{set_mod_enabled_status, rebuild_enabled_mods_json}, northstar::CORE_MODS}; +use crate::{ + mod_management::{rebuild_enabled_mods_json, set_mod_enabled_status}, + northstar::CORE_MODS, +}; use anyhow::anyhow; /// Contains various functions to repair common issues and verifying installation use app::{get_enabled_mods, GameInstall}; @@ -14,7 +17,6 @@ pub fn verify_game_files(game_install: GameInstall) -> Result<String, String> { /// Enables core mods if disabled #[tauri::command] pub fn disable_all_but_core(game_install: GameInstall) -> Result<(), String> { - // Rebuild `enabledmods.json` first to ensure all mods are added rebuild_enabled_mods_json(game_install.clone())?; |