diff --git a/Cargo.lock b/Cargo.lock index 30c8aaf38..49a344502 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4685,7 +4685,7 @@ dependencies = [ [[package]] name = "theseus" -version = "0.5.4" +version = "0.6.0" dependencies = [ "async-recursion", "async-tungstenite", @@ -4733,7 +4733,7 @@ dependencies = [ [[package]] name = "theseus_cli" -version = "0.5.4" +version = "0.6.0" dependencies = [ "argh", "color-eyre", @@ -4760,7 +4760,7 @@ dependencies = [ [[package]] name = "theseus_gui" -version = "0.5.4" +version = "0.6.0" dependencies = [ "chrono", "cocoa", diff --git a/theseus/Cargo.toml b/theseus/Cargo.toml index fd558a0f4..6e5fcaad0 100644 --- a/theseus/Cargo.toml +++ b/theseus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "theseus" -version = "0.5.4" +version = "0.6.0" authors = ["Jai A "] edition = "2018" diff --git a/theseus/src/api/auth.rs b/theseus/src/api/auth.rs index 99cdea414..36c80816f 100644 --- a/theseus/src/api/auth.rs +++ b/theseus/src/api/auth.rs @@ -68,10 +68,14 @@ pub async fn refresh(user: uuid::Uuid) -> crate::Result { } // Update player info from bearer token - let player_info = hydra::stages::player_info::fetch_info(&credentials.access_token).await.map_err(|_err| { - crate::ErrorKind::HydraError("No Minecraft account for your profile. Make sure you own the game and have set a username through the official Minecraft launcher." - .to_string()) - })?; + let player_info = + hydra::stages::player_info::fetch_info(&credentials.access_token) + .await + .map_err(|_err| { + crate::ErrorKind::HydraError( + "No Minecraft account for your profile. Please try again or contact support in our Discord for help!".to_string(), + ) + })?; credentials.username = player_info.name; users.insert(&credentials).await?; diff --git a/theseus/src/api/hydra/stages/player_info.rs b/theseus/src/api/hydra/stages/player_info.rs index 45248fd67..15923efb8 100644 --- a/theseus/src/api/hydra/stages/player_info.rs +++ b/theseus/src/api/hydra/stages/player_info.rs @@ -13,7 +13,7 @@ impl Default for PlayerInfo { fn default() -> Self { Self { id: "606e2ff0ed7748429d6ce1d3321c7838".to_string(), - name: String::from("???"), + name: String::from("Unknown"), } } } diff --git a/theseus/src/api/jre.rs b/theseus/src/api/jre.rs index bc81f70c1..915c46ba6 100644 --- a/theseus/src/api/jre.rs +++ b/theseus/src/api/jre.rs @@ -127,7 +127,7 @@ pub async fn auto_install_java(java_version: u32) -> crate::Result { // removes the old installation of java if let Some(file) = archive.file_names().next() { - if let Some(dir) = file.split("/").next() { + if let Some(dir) = file.split('/').next() { let path = path.join(dir); if path.exists() { diff --git a/theseus/src/api/pack/import/atlauncher.rs b/theseus/src/api/pack/import/atlauncher.rs index b4341b37a..8aa31758d 100644 --- a/theseus/src/api/pack/import/atlauncher.rs +++ b/theseus/src/api/pack/import/atlauncher.rs @@ -245,8 +245,12 @@ async fn import_atlauncher_unmanaged( if let Some(profile_val) = crate::api::profile::get(&profile_path, None).await? { - crate::launcher::install_minecraft(&profile_val, Some(loading_bar)) - .await?; + crate::launcher::install_minecraft( + &profile_val, + Some(loading_bar), + false, + ) + .await?; { let state = State::get().await?; let mut file_watcher = state.file_watcher.write().await; diff --git a/theseus/src/api/pack/import/curseforge.rs b/theseus/src/api/pack/import/curseforge.rs index 25a917377..16e0dd44a 100644 --- a/theseus/src/api/pack/import/curseforge.rs +++ b/theseus/src/api/pack/import/curseforge.rs @@ -199,8 +199,12 @@ pub async fn import_curseforge( if let Some(profile_val) = crate::api::profile::get(&profile_path, None).await? { - crate::launcher::install_minecraft(&profile_val, Some(loading_bar)) - .await?; + crate::launcher::install_minecraft( + &profile_val, + Some(loading_bar), + false, + ) + .await?; { let state = State::get().await?; diff --git a/theseus/src/api/pack/import/gdlauncher.rs b/theseus/src/api/pack/import/gdlauncher.rs index 022552d01..67c4d31a7 100644 --- a/theseus/src/api/pack/import/gdlauncher.rs +++ b/theseus/src/api/pack/import/gdlauncher.rs @@ -112,8 +112,12 @@ pub async fn import_gdlauncher( if let Some(profile_val) = crate::api::profile::get(&profile_path, None).await? { - crate::launcher::install_minecraft(&profile_val, Some(loading_bar)) - .await?; + crate::launcher::install_minecraft( + &profile_val, + Some(loading_bar), + false, + ) + .await?; { let state = State::get().await?; let mut file_watcher = state.file_watcher.write().await; diff --git a/theseus/src/api/pack/import/mmc.rs b/theseus/src/api/pack/import/mmc.rs index bdd06439c..9c2757f71 100644 --- a/theseus/src/api/pack/import/mmc.rs +++ b/theseus/src/api/pack/import/mmc.rs @@ -323,8 +323,12 @@ async fn import_mmc_unmanaged( if let Some(profile_val) = crate::api::profile::get(&profile_path, None).await? { - crate::launcher::install_minecraft(&profile_val, Some(loading_bar)) - .await?; + crate::launcher::install_minecraft( + &profile_val, + Some(loading_bar), + false, + ) + .await?; { let state = State::get().await?; let mut file_watcher = state.file_watcher.write().await; diff --git a/theseus/src/api/pack/install_mrpack.rs b/theseus/src/api/pack/install_mrpack.rs index ee15ae03f..8f19f9c21 100644 --- a/theseus/src/api/pack/install_mrpack.rs +++ b/theseus/src/api/pack/install_mrpack.rs @@ -283,8 +283,12 @@ pub async fn install_zipped_mrpack_files( } if let Some(profile_val) = profile::get(&profile_path, None).await? { - crate::launcher::install_minecraft(&profile_val, Some(loading_bar)) - .await?; + crate::launcher::install_minecraft( + &profile_val, + Some(loading_bar), + false, + ) + .await?; State::sync().await?; } diff --git a/theseus/src/api/profile/create.rs b/theseus/src/api/profile/create.rs index 17271db7e..803df3e47 100644 --- a/theseus/src/api/profile/create.rs +++ b/theseus/src/api/profile/create.rs @@ -125,7 +125,7 @@ pub async fn profile_create( } if !skip_install_profile.unwrap_or(false) { - crate::launcher::install_minecraft(&profile, None).await?; + crate::launcher::install_minecraft(&profile, None, false).await?; } State::sync().await?; @@ -196,7 +196,8 @@ pub async fn profile_create_from_duplicate( ErrorKind::UnmanagedProfileError(profile_path_id.to_string()) })?; - crate::launcher::install_minecraft(&duplicated_profile, Some(bar)).await?; + crate::launcher::install_minecraft(&duplicated_profile, Some(bar), false) + .await?; { let state = State::get().await?; let mut file_watcher = state.file_watcher.write().await; diff --git a/theseus/src/api/profile/mod.rs b/theseus/src/api/profile/mod.rs index 52e006eb1..4f5e87932 100644 --- a/theseus/src/api/profile/mod.rs +++ b/theseus/src/api/profile/mod.rs @@ -281,9 +281,9 @@ pub async fn list( /// Installs/Repairs a profile #[tracing::instrument] -pub async fn install(path: &ProfilePathId) -> crate::Result<()> { +pub async fn install(path: &ProfilePathId, force: bool) -> crate::Result<()> { if let Some(profile) = get(path, None).await? { - crate::launcher::install_minecraft(&profile, None).await?; + crate::launcher::install_minecraft(&profile, None, force).await?; } else { return Err(crate::ErrorKind::UnmanagedProfileError(path.to_string()) .as_error()); diff --git a/theseus/src/launcher/args.rs b/theseus/src/launcher/args.rs index 5ee75e9a8..884fb831e 100644 --- a/theseus/src/launcher/args.rs +++ b/theseus/src/launcher/args.rs @@ -1,6 +1,6 @@ //! Minecraft CLI argument logic -// TODO: Rafactor this section -use super::{auth::Credentials, parse_rule}; +use super::auth::Credentials; +use crate::launcher::parse_rules; use crate::{ state::{MemorySettings, WindowSize}, util::{io::IOError, platform::classpath_separator}, @@ -23,12 +23,13 @@ pub fn get_class_paths( libraries: &[Library], client_path: &Path, java_arch: &str, + minecraft_updated: bool, ) -> crate::Result { let mut cps = libraries .iter() .filter_map(|library| { if let Some(rules) = &library.rules { - if !rules.iter().any(|x| parse_rule(x, java_arch)) { + if !parse_rules(rules, java_arch, minecraft_updated) { return None; } } @@ -335,7 +336,7 @@ where } } Argument::Ruled { rules, value } => { - if rules.iter().any(|x| parse_rule(x, java_arch)) { + if parse_rules(rules, java_arch, true) { match value { ArgumentValue::Single(arg) => { parsed_arguments.push(parse_function( diff --git a/theseus/src/launcher/download.rs b/theseus/src/launcher/download.rs index 001886268..baf447f86 100644 --- a/theseus/src/launcher/download.rs +++ b/theseus/src/launcher/download.rs @@ -1,5 +1,6 @@ //! Downloader for Minecraft data +use crate::launcher::parse_rules; use crate::state::CredentialsStore; use crate::{ event::{ @@ -26,11 +27,13 @@ pub async fn download_minecraft( version: &GameVersionInfo, loading_bar: &LoadingBarId, java_arch: &str, + force: bool, + minecraft_updated: bool, ) -> crate::Result<()> { tracing::info!("Downloading Minecraft version {}", version.id); // 5 let assets_index = - download_assets_index(st, version, Some(loading_bar)).await?; + download_assets_index(st, version, Some(loading_bar), force).await?; let amount = if version .processors @@ -45,9 +48,9 @@ pub async fn download_minecraft( tokio::try_join! { // Total loading sums to 90/60 - download_client(st, version, Some(loading_bar)), // 10 - download_assets(st, version.assets == "legacy", &assets_index, Some(loading_bar), amount), // 40 - download_libraries(st, version.libraries.as_slice(), &version.id, Some(loading_bar), amount, java_arch) // 40 + download_client(st, version, Some(loading_bar), force), // 10 + download_assets(st, version.assets == "legacy", &assets_index, Some(loading_bar), amount, force), // 40 + download_libraries(st, version.libraries.as_slice(), &version.id, Some(loading_bar), amount, java_arch, force, minecraft_updated) // 40 }?; tracing::info!("Done downloading Minecraft!"); @@ -105,6 +108,7 @@ pub async fn download_client( st: &State, version_info: &GameVersionInfo, loading_bar: Option<&LoadingBarId>, + force: bool, ) -> crate::Result<()> { let version = &version_info.id; tracing::debug!("Locating client for version {version}"); @@ -123,7 +127,7 @@ pub async fn download_client( .await .join(format!("{version}.jar")); - if !path.exists() { + if !path.exists() || force { let bytes = fetch( &client_download.url, Some(&client_download.sha1), @@ -148,6 +152,7 @@ pub async fn download_assets_index( st: &State, version: &GameVersionInfo, loading_bar: Option<&LoadingBarId>, + force: bool, ) -> crate::Result { tracing::debug!("Loading assets index"); let path = st @@ -156,7 +161,7 @@ pub async fn download_assets_index( .await .join(format!("{}.json", &version.asset_index.id)); - let res = if path.exists() { + let res = if path.exists() && !force { io::read(path) .err_into::() .await @@ -183,6 +188,7 @@ pub async fn download_assets( index: &AssetsIndex, loading_bar: Option<&LoadingBarId>, loading_amount: f64, + force: bool, ) -> crate::Result<()> { tracing::debug!("Loading assets"); let num_futs = index.objects.len(); @@ -206,7 +212,7 @@ pub async fn download_assets( let fetch_cell = OnceCell::::new(); tokio::try_join! { async { - if !resource_path.exists() { + if !resource_path.exists() || force { let resource = fetch_cell .get_or_try_init(|| fetch(&url, Some(hash), &st.fetch_semaphore, &CredentialsStore(None))) .await?; @@ -216,13 +222,14 @@ pub async fn download_assets( Ok::<_, crate::Error>(()) }, async { - if with_legacy { + let resource_path = st.directories.legacy_assets_dir().await.join( + name.replace('/', &String::from(std::path::MAIN_SEPARATOR)) + ); + + if with_legacy && !resource_path.exists() || force { let resource = fetch_cell .get_or_try_init(|| fetch(&url, Some(hash), &st.fetch_semaphore, &CredentialsStore(None))) .await?; - let resource_path = st.directories.legacy_assets_dir().await.join( - name.replace('/', &String::from(std::path::MAIN_SEPARATOR)) - ); write(&resource_path, resource, &st.io_semaphore).await?; tracing::trace!("Fetched legacy asset with hash {hash}"); } @@ -239,6 +246,7 @@ pub async fn download_assets( #[tracing::instrument(skip(st, libraries))] #[theseus_macros::debug_pin] +#[allow(clippy::too_many_arguments)] pub async fn download_libraries( st: &State, libraries: &[Library], @@ -246,6 +254,8 @@ pub async fn download_libraries( loading_bar: Option<&LoadingBarId>, loading_amount: f64, java_arch: &str, + force: bool, + minecraft_updated: bool, ) -> crate::Result<()> { tracing::debug!("Loading libraries"); @@ -258,7 +268,7 @@ pub async fn download_libraries( stream::iter(libraries.iter()) .map(Ok::<&Library, crate::Error>), None, loading_bar,loading_amount,num_files, None,|library| async move { if let Some(rules) = &library.rules { - if !rules.iter().any(|x| super::parse_rule(x, java_arch)) { + if !parse_rules(rules, java_arch, minecraft_updated) { tracing::trace!("Skipped library {}", &library.name); return Ok(()); } @@ -270,7 +280,7 @@ pub async fn download_libraries( let path = st.directories.libraries_dir().await.join(&artifact_path); match library.downloads { - _ if path.exists() => Ok(()), + _ if path.exists() && !force => Ok(()), Some(d::minecraft::LibraryDownloads { artifact: Some(ref artifact), .. diff --git a/theseus/src/launcher/mod.rs b/theseus/src/launcher/mod.rs index 4b0290a28..1a4167e00 100644 --- a/theseus/src/launcher/mod.rs +++ b/theseus/src/launcher/mod.rs @@ -13,7 +13,7 @@ use crate::{ }; use chrono::Utc; use daedalus as d; -use daedalus::minecraft::VersionInfo; +use daedalus::minecraft::{RuleAction, VersionInfo}; use st::Profile; use std::collections::HashMap; use std::{process::Stdio, sync::Arc}; @@ -25,14 +25,48 @@ mod args; pub mod auth; pub mod download; +// All nones -> disallowed +// 1+ true -> allowed +// 1+ false -> disallowed #[tracing::instrument] -pub fn parse_rule(rule: &d::minecraft::Rule, java_version: &str) -> bool { +pub fn parse_rules( + rules: &[d::minecraft::Rule], + java_version: &str, + minecraft_updated: bool, +) -> bool { + let mut x = rules + .iter() + .map(|x| parse_rule(x, java_version, minecraft_updated)) + .collect::>>(); + + if rules + .iter() + .all(|x| matches!(x.action, RuleAction::Disallow)) + { + x.push(Some(true)) + } + + !(x.iter().any(|x| x == &Some(false)) || x.iter().all(|x| x.is_none())) +} + +// if anything is disallowed, it should NOT be included +// if anything is not disallowed, it shouldn't factor in final result +// if anything is not allowed, it shouldn't factor in final result +// if anything is allowed, it should be included +#[tracing::instrument] +pub fn parse_rule( + rule: &d::minecraft::Rule, + java_version: &str, + minecraft_updated: bool, +) -> Option { use d::minecraft::{Rule, RuleAction}; let res = match rule { Rule { os: Some(ref os), .. - } => crate::util::platform::os_rule(os, java_version), + } => { + crate::util::platform::os_rule(os, java_version, minecraft_updated) + } Rule { features: Some(ref features), .. @@ -44,12 +78,24 @@ pub fn parse_rule(rule: &d::minecraft::Rule, java_version: &str) -> bool { || !features.is_quick_play_realms.unwrap_or(true) || !features.is_quick_play_singleplayer.unwrap_or(true) } - _ => false, + _ => return Some(true), }; match rule.action { - RuleAction::Allow => res, - RuleAction::Disallow => !res, + RuleAction::Allow => { + if res { + Some(true) + } else { + None + } + } + RuleAction::Disallow => { + if res { + Some(false) + } else { + None + } + } } } @@ -102,6 +148,7 @@ pub async fn get_java_version_from_profile( pub async fn install_minecraft( profile: &Profile, existing_loading_bar: Option, + repairing: bool, ) -> crate::Result<()> { let sync_projects = existing_loading_bar.is_some(); let loading_bar = init_or_edit_loading( @@ -133,15 +180,23 @@ pub async fn install_minecraft( &io::canonicalize(&profile.get_profile_full_path().await?)?; let metadata = state.metadata.read().await; - let version = metadata + let version_index = metadata .minecraft .versions .iter() - .find(|it| it.id == profile.metadata.game_version) + .position(|it| it.id == profile.metadata.game_version) .ok_or(crate::ErrorKind::LauncherError(format!( "Invalid game version: {}", profile.metadata.game_version )))?; + let version = &metadata.minecraft.versions[version_index]; + let minecraft_updated = version_index + <= metadata + .minecraft + .versions + .iter() + .position(|x| x.id == "22w16a") + .unwrap_or(0); let version_jar = profile .metadata @@ -156,7 +211,7 @@ pub async fn install_minecraft( &state, version, profile.metadata.loader_version.as_ref(), - None, + Some(repairing), Some(&loading_bar), ) .await?; @@ -185,6 +240,8 @@ pub async fn install_minecraft( &version_info, &loading_bar, &java_version.architecture, + repairing, + minecraft_updated, ) .await?; @@ -325,7 +382,7 @@ pub async fn launch_minecraft( } if profile.install_stage != ProfileInstallStage::Installed { - install_minecraft(profile, None).await?; + install_minecraft(profile, None, false).await?; } let state = State::get().await?; @@ -334,15 +391,23 @@ pub async fn launch_minecraft( let instance_path = profile.get_profile_full_path().await?; let instance_path = &io::canonicalize(instance_path)?; - let version = metadata + let version_index = metadata .minecraft .versions .iter() - .find(|it| it.id == profile.metadata.game_version) + .position(|it| it.id == profile.metadata.game_version) .ok_or(crate::ErrorKind::LauncherError(format!( "Invalid game version: {}", profile.metadata.game_version )))?; + let version = &metadata.minecraft.versions[version_index]; + let minecraft_updated = version_index + <= metadata + .minecraft + .versions + .iter() + .position(|x| x.id == "22w16a") + .unwrap_or(0); let version_jar = profile .metadata @@ -418,6 +483,7 @@ pub async fn launch_minecraft( version_info.libraries.as_slice(), &client_path, &java_version.architecture, + minecraft_updated, )?, &version_jar, *memory, diff --git a/theseus/src/state/mr_auth.rs b/theseus/src/state/mr_auth.rs index ac54ad538..383660fc5 100644 --- a/theseus/src/state/mr_auth.rs +++ b/theseus/src/state/mr_auth.rs @@ -322,29 +322,6 @@ pub async fn create_account( get_creds_from_res(response, semaphore).await } -pub async fn login_minecraft( - flow: &str, - semaphore: &FetchSemaphore, -) -> crate::Result { - let resp = fetch_advanced( - Method::POST, - &format!("{MODRINTH_API_URL}auth/login/minecraft"), - None, - Some(serde_json::json!({ - "flow": flow, - })), - None, - None, - semaphore, - &CredentialsStore(None), - ) - .await?; - - let response = serde_json::from_slice::>(&resp)?; - - get_result_from_res("session", response, semaphore).await -} - pub async fn refresh_credentials( credentials_store: &mut CredentialsStore, semaphore: &FetchSemaphore, diff --git a/theseus/src/state/profiles.rs b/theseus/src/state/profiles.rs index b5e3bdab6..add80b399 100644 --- a/theseus/src/state/profiles.rs +++ b/theseus/src/state/profiles.rs @@ -889,8 +889,6 @@ impl Profiles { // Fetch online from Modrinth each latest version future::try_join_all(modrinth_updatables.into_iter().map( |(profile_path, linked_project)| { - let profile_path = profile_path; - let linked_project = linked_project; let state = state.clone(); async move { let creds = state.credentials.read().await; diff --git a/theseus/src/util/jre.rs b/theseus/src/util/jre.rs index f236bcb4e..6c571424b 100644 --- a/theseus/src/util/jre.rs +++ b/theseus/src/util/jre.rs @@ -43,7 +43,9 @@ pub async fn get_all_jre() -> Result, JREError> { r"C:\Program Files (x86)\Eclipse Adoptium", ]; for java_path in java_paths { - let Ok(java_subpaths) = std::fs::read_dir(java_path) else {continue }; + let Ok(java_subpaths) = std::fs::read_dir(java_path) else { + continue; + }; for java_subpath in java_subpaths.flatten() { let path = java_subpath.path(); jre_paths.insert(path.join("bin")); @@ -97,7 +99,7 @@ pub fn get_paths_from_jre_winregkey(jre_key: RegKey) -> HashSet { for subkey_value in subkey_value_names { let path: Result = subkey.get_value(subkey_value); - let Ok(path) = path else {continue}; + let Ok(path) = path else { continue }; jre_paths.insert(PathBuf::from(path).join("bin")); } @@ -264,7 +266,9 @@ pub async fn check_java_at_filepaths( pub async fn check_java_at_filepath(path: &Path) -> Option { // Attempt to canonicalize the potential java filepath // If it fails, this path does not exist and None is returned (no Java here) - let Ok(path) = io::canonicalize(path) else { return None }; + let Ok(path) = io::canonicalize(path) else { + return None; + }; // Checks for existence of Java at this filepath // Adds JAVA_BIN to the end of the path if it is not already there diff --git a/theseus/src/util/platform.rs b/theseus/src/util/platform.rs index 9509ab6ea..564d8b03e 100644 --- a/theseus/src/util/platform.rs +++ b/theseus/src/util/platform.rs @@ -56,7 +56,12 @@ pub const ARCH_WIDTH: &str = "64"; pub const ARCH_WIDTH: &str = "32"; // Platform rule handling -pub fn os_rule(rule: &OsRule, java_arch: &str) -> bool { +pub fn os_rule( + rule: &OsRule, + java_arch: &str, + // Minecraft updated over 1.18.2 (supports MacOS Natively) + minecraft_updated: bool, +) -> bool { let mut rule_match = true; if let Some(ref arch) = rule.arch { @@ -64,8 +69,14 @@ pub fn os_rule(rule: &OsRule, java_arch: &str) -> bool { } if let Some(name) = &rule.name { - rule_match &= - &Os::native() == name || &Os::native_arch(java_arch) == name; + if minecraft_updated + && (name != &Os::LinuxArm64 || name != &Os::LinuxArm32) + { + rule_match &= + &Os::native() == name || &Os::native_arch(java_arch) == name; + } else { + rule_match &= &Os::native_arch(java_arch) == name; + } } if let Some(version) = &rule.version { diff --git a/theseus_cli/Cargo.toml b/theseus_cli/Cargo.toml index 6815982d3..82f16579d 100644 --- a/theseus_cli/Cargo.toml +++ b/theseus_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "theseus_cli" -version = "0.5.4" +version = "0.6.0" authors = ["Jai A "] edition = "2018" diff --git a/theseus_gui/package.json b/theseus_gui/package.json index 41ebe09ae..fee36b404 100644 --- a/theseus_gui/package.json +++ b/theseus_gui/package.json @@ -1,7 +1,7 @@ { "name": "theseus_gui", "private": true, - "version": "0.5.4", + "version": "0.6.0", "type": "module", "scripts": { "dev": "vite", diff --git a/theseus_gui/src-tauri/Cargo.toml b/theseus_gui/src-tauri/Cargo.toml index 75db1eeff..2ec1e8303 100644 --- a/theseus_gui/src-tauri/Cargo.toml +++ b/theseus_gui/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "theseus_gui" -version = "0.5.4" +version = "0.6.0" description = "A Tauri App" authors = ["you"] license = "" diff --git a/theseus_gui/src-tauri/src/api/profile.rs b/theseus_gui/src-tauri/src/api/profile.rs index 9358a56f6..dd034f1fc 100644 --- a/theseus_gui/src-tauri/src/api/profile.rs +++ b/theseus_gui/src-tauri/src/api/profile.rs @@ -117,8 +117,8 @@ pub async fn profile_check_installed( /// Installs/Repairs a profile /// invoke('plugin:profile|profile_install') #[tauri::command] -pub async fn profile_install(path: ProfilePathId) -> Result<()> { - profile::install(&path).await?; +pub async fn profile_install(path: ProfilePathId, force: bool) -> Result<()> { + profile::install(&path, force).await?; Ok(()) } diff --git a/theseus_gui/src-tauri/tauri.conf.json b/theseus_gui/src-tauri/tauri.conf.json index c690b4e19..0e1f43881 100644 --- a/theseus_gui/src-tauri/tauri.conf.json +++ b/theseus_gui/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "Modrinth App", - "version": "0.5.4" + "version": "0.6.0" }, "tauri": { "allowlist": { diff --git a/theseus_gui/src/components/ui/ExportModal.vue b/theseus_gui/src/components/ui/ExportModal.vue index a9bd402db..4b8b9e5af 100644 --- a/theseus_gui/src/components/ui/ExportModal.vue +++ b/theseus_gui/src/components/ui/ExportModal.vue @@ -33,7 +33,7 @@ const themeStore = useTheming() const initFiles = async () => { const newFolders = new Map() - const sep = '/'; + const sep = '/' files.value = [] await get_pack_export_candidates(props.instance.path).then((filePaths) => filePaths diff --git a/theseus_gui/src/helpers/profile.js b/theseus_gui/src/helpers/profile.js index f42666430..1436a60e7 100644 --- a/theseus_gui/src/helpers/profile.js +++ b/theseus_gui/src/helpers/profile.js @@ -72,8 +72,8 @@ export async function check_installed(path, projectId) { } // Installs/Repairs a profile -export async function install(path) { - return await invoke('plugin:profile|profile_install', { path }) +export async function install(path, force) { + return await invoke('plugin:profile|profile_install', { path, force }) } // Updates all of a profile's projects diff --git a/theseus_gui/src/pages/instance/Options.vue b/theseus_gui/src/pages/instance/Options.vue index 8d048b650..dc7400b71 100644 --- a/theseus_gui/src/pages/instance/Options.vue +++ b/theseus_gui/src/pages/instance/Options.vue @@ -468,7 +468,7 @@ id="repair-profile" color="highlight" :disabled="installing || inProgress || repairing || offline" - @click="repairProfile" + @click="repairProfile(true)" > Repair @@ -755,9 +755,9 @@ async function duplicateProfile() { }) } -async function repairProfile() { +async function repairProfile(force) { repairing.value = true - await install(props.instance.path).catch(handleError) + await install(props.instance.path, force).catch(handleError) repairing.value = false mixpanel_track('InstanceRepair', { @@ -910,7 +910,7 @@ async function saveGvLoaderEdits() { editProfile.metadata.loader_version = selectableLoaderVersions.value[loaderVersionIndex.value] } await edit(props.instance.path, editProfile).catch(handleError) - await repairProfile() + await repairProfile(false) editing.value = false changeVersionsModal.value.hide()