diff options
Diffstat (limited to 'src-tauri/src/core')
| -rw-r--r-- | src-tauri/src/core/fabric.rs | 11 | ||||
| -rw-r--r-- | src-tauri/src/core/forge.rs | 13 | ||||
| -rw-r--r-- | src-tauri/src/core/manifest.rs | 6 | ||||
| -rw-r--r-- | src-tauri/src/core/maven.rs | 15 |
4 files changed, 31 insertions, 14 deletions
diff --git a/src-tauri/src/core/fabric.rs b/src-tauri/src/core/fabric.rs index 8fc960f..fd38f41 100644 --- a/src-tauri/src/core/fabric.rs +++ b/src-tauri/src/core/fabric.rs @@ -89,7 +89,8 @@ pub struct InstalledFabricVersion { /// /// # Returns /// A list of game versions that have Fabric intermediary mappings available. -pub async fn fetch_supported_game_versions() -> Result<Vec<FabricGameVersion>, Box<dyn Error + Send + Sync>> { +pub async fn fetch_supported_game_versions( +) -> Result<Vec<FabricGameVersion>, Box<dyn Error + Send + Sync>> { let url = format!("{}/versions/game", FABRIC_META_URL); let resp = reqwest::get(&url) .await? @@ -102,7 +103,8 @@ pub async fn fetch_supported_game_versions() -> Result<Vec<FabricGameVersion>, B /// /// # Returns /// A list of all Fabric loader versions, ordered by build number (newest first). -pub async fn fetch_loader_versions() -> Result<Vec<FabricLoaderVersion>, Box<dyn Error + Send + Sync>> { +pub async fn fetch_loader_versions( +) -> Result<Vec<FabricLoaderVersion>, Box<dyn Error + Send + Sync>> { let url = format!("{}/versions/loader", FABRIC_META_URL); let resp = reqwest::get(&url) .await? @@ -145,7 +147,10 @@ pub async fn fetch_version_profile( "{}/versions/loader/{}/{}/profile/json", FABRIC_META_URL, game_version, loader_version ); - let resp = reqwest::get(&url).await?.json::<serde_json::Value>().await?; + let resp = reqwest::get(&url) + .await? + .json::<serde_json::Value>() + .await?; Ok(resp) } diff --git a/src-tauri/src/core/forge.rs b/src-tauri/src/core/forge.rs index 7b951ff..0f17bcc 100644 --- a/src-tauri/src/core/forge.rs +++ b/src-tauri/src/core/forge.rs @@ -48,7 +48,7 @@ pub struct InstalledForgeVersion { /// A list of Minecraft version strings that have Forge available. pub async fn fetch_supported_game_versions() -> Result<Vec<String>, Box<dyn Error + Send + Sync>> { let promos = fetch_promotions().await?; - + let mut versions: Vec<String> = promos .promos .keys() @@ -62,12 +62,12 @@ pub async fn fetch_supported_game_versions() -> Result<Vec<String>, Box<dyn Erro } }) .collect(); - + // Deduplicate and sort versions.sort(); versions.dedup(); versions.reverse(); // Newest first - + Ok(versions) } @@ -159,7 +159,7 @@ pub async fn install_forge( forge_version: &str, ) -> Result<InstalledForgeVersion, Box<dyn Error + Send + Sync>> { let version_id = generate_version_id(game_version, forge_version); - + // Create basic version JSON structure // Note: This is a simplified version. Full Forge installation requires // downloading the installer and running processors. @@ -206,7 +206,10 @@ fn create_forge_version_json( vec![ create_library_entry(&forge_maven_coord, Some(FORGE_MAVEN_URL)), create_library_entry( - &format!("net.minecraftforge:forge:{}-{}:universal", game_version, forge_version), + &format!( + "net.minecraftforge:forge:{}-{}:universal", + game_version, forge_version + ), Some(FORGE_MAVEN_URL), ), ], diff --git a/src-tauri/src/core/manifest.rs b/src-tauri/src/core/manifest.rs index 2fea811..bae87c9 100644 --- a/src-tauri/src/core/manifest.rs +++ b/src-tauri/src/core/manifest.rs @@ -74,7 +74,7 @@ pub async fn fetch_vanilla_version( ) -> Result<GameVersion, Box<dyn Error + Send + Sync>> { // First, get the manifest to find the version URL let manifest = fetch_version_manifest().await?; - + let version_entry = manifest .versions .iter() @@ -86,7 +86,7 @@ pub async fn fetch_vanilla_version( .await? .json::<GameVersion>() .await?; - + Ok(resp) } @@ -121,7 +121,7 @@ pub async fn load_version( Ok(v) => v, Err(_) => fetch_vanilla_version(&parent_id).await?, }; - + // Merge child into parent version = crate::core::version_merge::merge_versions(version, parent); } diff --git a/src-tauri/src/core/maven.rs b/src-tauri/src/core/maven.rs index a930e05..8c89768 100644 --- a/src-tauri/src/core/maven.rs +++ b/src-tauri/src/core/maven.rs @@ -101,7 +101,10 @@ impl MavenCoordinate { } }; - format!("{}/{}/{}/{}", group_path, self.artifact, self.version, filename) + format!( + "{}/{}/{}/{}", + group_path, self.artifact, self.version, filename + ) } /// Get the local file path for storing this artifact. @@ -142,7 +145,11 @@ impl MavenCoordinate { /// /// # Returns /// The resolved download URL -pub fn resolve_library_url(name: &str, explicit_url: Option<&str>, maven_url: Option<&str>) -> Option<String> { +pub fn resolve_library_url( + name: &str, + explicit_url: Option<&str>, + maven_url: Option<&str>, +) -> Option<String> { // If there's an explicit URL, use it if let Some(url) = explicit_url { return Some(url.to_string()); @@ -156,7 +163,9 @@ pub fn resolve_library_url(name: &str, explicit_url: Option<&str>, maven_url: Op // Guess the repository based on group if coord.group.starts_with("net.fabricmc") { FABRIC_MAVEN - } else if coord.group.starts_with("net.minecraftforge") || coord.group.starts_with("cpw.mods") { + } else if coord.group.starts_with("net.minecraftforge") + || coord.group.starts_with("cpw.mods") + { FORGE_MAVEN } else { MOJANG_LIBRARIES |