Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Store mod slugs #22

Merged
merged 1 commit into from
Mar 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/add.rs
Original file line number Diff line number Diff line change
@@ -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,
);
8 changes: 8 additions & 0 deletions src/config/structs.rs
Original file line number Diff line number Diff line change
@@ -108,11 +108,13 @@ impl Profile {
&mut self,
name: String,
identifier: ModIdentifier,
slug: String,
override_filters: bool,
filters: Vec<Filter>,
) {
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<String>,

/// 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,