From df41dbfba5bcb6fc728a404c0d23e87295c1e6cc Mon Sep 17 00:00:00 2001 From: Ilesh Thiada Date: Sat, 3 Sep 2022 12:11:08 +0000 Subject: [PATCH] Update dependencies --- Cargo.toml | 25 +++++++++++++------------ src/add.rs | 34 ++++++++++++---------------------- src/config/structs.rs | 2 +- 3 files changed, 26 insertions(+), 35 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index adec56a..5383b34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libium" -version = "1.19.2" +version = "1.19.3" edition = "2021" authors = [ "Ilesh Thiada (theRookieCoder) ", @@ -29,22 +29,23 @@ reqwest = { version = "~0.11.11", default-features = false, features = [ "rustls-tls", "json", ] } -octocrab = { version = "~0.16.0", default-features = false, features = [ +octocrab = { version = "~0.17.0", default-features = false, features = [ "rustls", ] } -tokio = { version = "~1.20.0", default-features = false, features = ["fs"] } -rfd = { version = "~0.9.1", default-features = false, optional = true } -serde = { version = "~1.0.139", features = ["derive"] } -clap = { version = "~3.2.12", features = ["derive"] } +tokio = { version = "~1.21.0", default-features = false, features = ["fs"] } +rfd = { version = "~0.10.0", default-features = false, optional = true } +serde = { version = "~1.0.144", features = ["derive"] } +clap = { version = "~3.2.20", features = ["derive"] } url = { version = "~2.2.2", features = ["serde"] } lazy_static = "~1.4.0" -urlencoding = "~2.1.0" -serde_json = "~1.0.82" -dialoguer = "~0.10.1" -thiserror = "~1.0.31" -ferinth = "~2.5.1" +urlencoding = "~2.1.2" +serde_json = "~1.0.85" +dialoguer = "~0.10.2" +thiserror = "~1.0.33" +ferinth = "~2.6.1" +# Bound to an older version because of octocrab bytes = "~1.1.0" -furse = "~1.5.1" +furse = "~1.5.3" home = "~0.5.3" size = "~0.4.0" zip = "~0.6.2" diff --git a/src/add.rs b/src/add.rs index 4267777..1f35db1 100644 --- a/src/add.rs +++ b/src/add.rs @@ -2,18 +2,6 @@ use crate::{ config::structs::{ModIdentifier, Profile}, upgrade::mod_downloadable, }; -use ferinth::{ - structures::{ - project_structs::{Project, ProjectType}, - version_structs::Version, - }, - Ferinth, -}; -use furse::{structures::file_structs::File, Furse}; -use octocrab::{ - models::{repos::Asset, Repository}, - repos::RepoHandler, -}; use reqwest::StatusCode; use std::sync::Arc; @@ -86,11 +74,11 @@ impl From for Error { /// /// Returns the repository and the latest compatible asset pub async fn github( - repo_handler: &RepoHandler<'_>, + repo_handler: &octocrab::repos::RepoHandler<'_>, profile: &Profile, should_check_game_version: Option, should_check_mod_loader: Option, -) -> Result<(Repository, Asset)> { +) -> Result<(octocrab::models::Repository, octocrab::models::repos::Asset)> { let repo = repo_handler.get().await?; let repo_name = ( repo.owner.as_ref().unwrap().login.clone(), @@ -138,12 +126,15 @@ pub async fn github( /// /// Returns the project and the latest compatible version pub async fn modrinth( - modrinth: Arc, + modrinth: Arc, project_id: &str, profile: &Profile, should_check_game_version: Option, should_check_mod_loader: Option, -) -> Result<(Project, Version)> { +) -> Result<( + ferinth::structures::project_structs::Project, + ferinth::structures::version_structs::Version, +)> { let project = modrinth.get_project(project_id).await?; // Check if project has already been added if profile.mods.iter().any(|mod_| { @@ -151,7 +142,7 @@ pub async fn modrinth( || ModIdentifier::ModrinthProject(project.id.clone()) == mod_.identifier }) { Err(Error::AlreadyAdded) - } else if project.project_type != ProjectType::Mod { + } else if project.project_type != ferinth::structures::project_structs::ProjectType::Mod { Err(Error::NotAMod) } else { let version = mod_downloadable::get_latest_compatible_version( @@ -171,13 +162,12 @@ pub async fn modrinth( /// /// Returns the mod and the latest compatible file pub async fn curseforge( - curseforge: Arc, - project_id: i32, + curseforge: Arc, + project: &furse::structures::mod_structs::Mod, profile: &Profile, should_check_game_version: Option, should_check_mod_loader: Option, -) -> Result<(furse::structures::mod_structs::Mod, File)> { - let project = curseforge.get_mod(project_id).await?; +) -> Result { // Check if project has already been added if profile.mods.iter().any(|mod_| { mod_.name == project.name || ModIdentifier::CurseForgeProject(project.id) == mod_.identifier @@ -210,7 +200,7 @@ pub async fn curseforge( ) .ok_or(Error::Incompatible)? .0; - Ok((project, file)) + Ok(file) } else { Err(Error::NotAMod) } diff --git a/src/config/structs.rs b/src/config/structs.rs index ac01ad4..d37b3c2 100644 --- a/src/config/structs.rs +++ b/src/config/structs.rs @@ -73,7 +73,7 @@ pub enum ModLoader { Fabric, Forge, } -#[derive(thiserror::Error, Debug, PartialEq)] +#[derive(thiserror::Error, Debug, PartialEq, Eq)] #[error("The given string is not a mod loader")] pub struct ModLoaderParseError {} impl TryFrom<&String> for ModLoader {