Skip to content

Commit eed35ae

Browse files
authored
Store mod slugs (#22)
1 parent e043a6e commit eed35ae

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/add.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ pub async fn github(
351351
profile.push_mod(
352352
id.1.as_ref().trim().to_string(),
353353
ModIdentifier::GitHubRepository(id.0.to_string(), id.1.to_string()),
354+
id.1.as_ref().trim().to_string(),
354355
override_profile,
355356
filters,
356357
);
@@ -424,6 +425,7 @@ pub async fn modrinth(
424425
profile.push_mod(
425426
project.title.trim().to_owned(),
426427
ModIdentifier::ModrinthProject(project.id.clone()),
428+
project.slug.to_owned(),
427429
override_profile,
428430
filters,
429431
);
@@ -503,6 +505,7 @@ pub async fn curseforge(
503505
profile.push_mod(
504506
project.name.trim().to_string(),
505507
ModIdentifier::CurseForgeProject(project.id),
508+
project.slug.clone(),
506509
override_profile,
507510
filters,
508511
);

src/config/structs.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,13 @@ impl Profile {
108108
&mut self,
109109
name: String,
110110
identifier: ModIdentifier,
111+
slug: String,
111112
override_filters: bool,
112113
filters: Vec<Filter>,
113114
) {
114115
self.mods.push(Mod {
115116
name,
117+
slug: Some(slug),
116118
identifier,
117119
filters,
118120
override_filters,
@@ -127,6 +129,11 @@ pub struct Mod {
127129
pub name: String,
128130
pub identifier: ModIdentifier,
129131

132+
// Is an `Option` for backwards compatibility reasons,
133+
// since the slug field didn't exist in older ferium versions
134+
#[serde(skip_serializing_if = "Option::is_none")]
135+
pub slug: Option<String>,
136+
130137
/// Custom filters that apply only for this mod
131138
#[serde(skip_serializing_if = "Vec::is_empty")]
132139
#[serde(default)]
@@ -153,6 +160,7 @@ impl Mod {
153160
) -> Self {
154161
Self {
155162
name,
163+
slug: None,
156164
identifier,
157165
filters,
158166
override_filters,

0 commit comments

Comments
 (0)