diff --git a/src/add.rs b/src/add.rs index 24d1603..20b89d0 100644 --- a/src/add.rs +++ b/src/add.rs @@ -351,6 +351,7 @@ pub async fn github( profile.push_mod( id.1.as_ref().trim().to_string(), ModIdentifier::GitHubRepository(id.0.to_string(), id.1.to_string()), + id.1.as_ref().trim().to_string(), override_profile, filters, ); @@ -424,6 +425,7 @@ pub async fn modrinth( profile.push_mod( project.title.trim().to_owned(), ModIdentifier::ModrinthProject(project.id.clone()), + project.slug.to_owned(), override_profile, filters, ); @@ -503,6 +505,7 @@ pub async fn curseforge( profile.push_mod( project.name.trim().to_string(), ModIdentifier::CurseForgeProject(project.id), + project.slug.clone(), override_profile, filters, ); diff --git a/src/config/structs.rs b/src/config/structs.rs index 544aaec..760cbac 100644 --- a/src/config/structs.rs +++ b/src/config/structs.rs @@ -108,11 +108,13 @@ impl Profile { &mut self, name: String, identifier: ModIdentifier, + slug: String, override_filters: bool, filters: Vec, ) { self.mods.push(Mod { name, + slug: Some(slug), identifier, filters, override_filters, @@ -127,6 +129,11 @@ pub struct Mod { pub name: String, pub identifier: ModIdentifier, + // Is an `Option` for backwards compatibility reasons, + // since the slug field didn't exist in older ferium versions + #[serde(skip_serializing_if = "Option::is_none")] + pub slug: Option, + /// Custom filters that apply only for this mod #[serde(skip_serializing_if = "Vec::is_empty")] #[serde(default)] @@ -153,6 +160,7 @@ impl Mod { ) -> Self { Self { name, + slug: None, identifier, filters, override_filters,