You've already forked AstralRinth
forked from didirus/AstralRinth
Performance improvements (#114)
* Performance improvements * run fmt * optimize creation modal * remove print, fix mod loader editing * Fix library update * update extract loading bar * Update theseus_gui/src-tauri/src/api/metadata.rs Co-authored-by: triphora <emma@modrinth.com> * fix cli --------- Co-authored-by: triphora <emma@modrinth.com>
This commit is contained in:
@@ -48,7 +48,7 @@ pub async fn jre_get_optimal_jre_key(profile: Profile) -> Result<String> {
|
||||
// The key can be used in the hashmap contained by JavaGlobals in Settings (if it exists)
|
||||
#[tauri::command]
|
||||
pub async fn jre_get_optimal_jre_key_by_path(path: &Path) -> Result<String> {
|
||||
let profile = profile::get(path).await?.ok_or_else(|| {
|
||||
let profile = profile::get(path, Some(true)).await?.ok_or_else(|| {
|
||||
TheseusSerializableError::NoProfileFound(path.display().to_string())
|
||||
})?;
|
||||
Ok(jre::get_optimal_jre_key(&profile).await?)
|
||||
|
||||
@@ -19,3 +19,9 @@ pub async fn metadata_get_fabric_versions() -> Result<Manifest> {
|
||||
pub async fn metadata_get_forge_versions() -> Result<Manifest> {
|
||||
Ok(theseus::metadata::get_forge_versions().await?)
|
||||
}
|
||||
|
||||
/// Gets the quilt versions from daedalus
|
||||
#[tauri::command]
|
||||
pub async fn metadata_get_quilt_versions() -> Result<Manifest> {
|
||||
Ok(theseus::metadata::get_quilt_versions().await?)
|
||||
}
|
||||
|
||||
@@ -16,8 +16,11 @@ pub async fn profile_remove(path: &Path) -> Result<()> {
|
||||
// Get a profile by path
|
||||
// invoke('profile_add_path',path)
|
||||
#[tauri::command]
|
||||
pub async fn profile_get(path: &Path) -> Result<Option<Profile>> {
|
||||
let res = profile::get(path).await?;
|
||||
pub async fn profile_get(
|
||||
path: &Path,
|
||||
clear_projects: Option<bool>,
|
||||
) -> Result<Option<Profile>> {
|
||||
let res = profile::get(path, clear_projects).await?;
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
@@ -25,11 +28,32 @@ pub async fn profile_get(path: &Path) -> Result<Option<Profile>> {
|
||||
// invoke('profile_list')
|
||||
#[tauri::command]
|
||||
pub async fn profile_list(
|
||||
clear_projects: Option<bool>,
|
||||
) -> Result<std::collections::HashMap<PathBuf, Profile>> {
|
||||
let res = profile::list().await?;
|
||||
let res = profile::list(clear_projects).await?;
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn profile_check_installed(
|
||||
path: &Path,
|
||||
project_id: String,
|
||||
) -> Result<bool> {
|
||||
let profile = profile_get(path, None).await?;
|
||||
if let Some(profile) = profile {
|
||||
Ok(profile.projects.into_iter().any(|(_, project)| {
|
||||
if let ProjectMetadata::Modrinth { project, .. } = &project.metadata
|
||||
{
|
||||
project.id == project_id
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}))
|
||||
} else {
|
||||
Ok(false)
|
||||
}
|
||||
}
|
||||
|
||||
/// Syncs a profile's in memory state with the state on the disk
|
||||
/// // invoke('profile_sync')
|
||||
#[tauri::command]
|
||||
|
||||
Reference in New Issue
Block a user