chore: bump dependencies
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ic1fda520473e53d1a584a3dda63ffda86a6a6964
This commit is contained in:
parent
fa5befff3b
commit
4fc05e71e7
5 changed files with 362 additions and 94 deletions
|
|
@ -192,15 +192,29 @@ impl Project {
|
|||
return true;
|
||||
}
|
||||
|
||||
// Check if all providers have the same latest file name
|
||||
// (simplified check - in reality would compare semantic versions)
|
||||
let file_names: Vec<_> = versions_by_provider
|
||||
// Compare semantic versions extracted from file names
|
||||
let parse_version = |name: &str| {
|
||||
// Try to extract version from patterns like "mod-1.0.0.jar" or
|
||||
// "mod_v1.0.0"
|
||||
let version_str = name
|
||||
.rsplit_once('-')
|
||||
.and_then(|(_, v)| v.strip_suffix("jar"))
|
||||
.or_else(|| {
|
||||
name
|
||||
.rsplit_once('_')
|
||||
.and_then(|(_, v)| v.strip_suffix("jar"))
|
||||
})
|
||||
.unwrap_or(name);
|
||||
semver::Version::parse(version_str).ok()
|
||||
};
|
||||
|
||||
let versions: Vec<_> = versions_by_provider
|
||||
.values()
|
||||
.filter_map(|files| files.first().copied())
|
||||
.filter_map(|files| files.first().copied().and_then(parse_version))
|
||||
.collect();
|
||||
|
||||
// All file names should be the same for versions to match
|
||||
file_names.windows(2).all(|w| w[0] == w[1])
|
||||
// All versions should be the same
|
||||
versions.windows(2).all(|w| w[0] == w[1])
|
||||
}
|
||||
|
||||
/// Check if versions do NOT match across providers.
|
||||
|
|
|
|||
|
|
@ -12,7 +12,12 @@ use crate::{
|
|||
};
|
||||
|
||||
const CURSEFORGE_API_BASE: &str = "https://api.curseforge.com/v1";
|
||||
/// CurseForge game version type ID for loader versions (e.g., "fabric",
|
||||
/// "forge")
|
||||
const LOADER_VERSION_TYPE_ID: i32 = 68441;
|
||||
/// CurseForge relation type ID for "required dependency" (mod embeds or
|
||||
/// requires another mod)
|
||||
const DEPENDENCY_RELATION_TYPE_REQUIRED: u32 = 3;
|
||||
|
||||
pub struct CurseForgePlatform {
|
||||
client: Client,
|
||||
|
|
@ -194,7 +199,7 @@ impl CurseForgePlatform {
|
|||
required_dependencies: cf_file
|
||||
.dependencies
|
||||
.iter()
|
||||
.filter(|d| d.relation_type == 3)
|
||||
.filter(|d| d.relation_type == DEPENDENCY_RELATION_TYPE_REQUIRED)
|
||||
.map(|d| d.mod_id.to_string())
|
||||
.collect(),
|
||||
size: cf_file.file_length,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use rand::Rng;
|
||||
use rand::RngExt;
|
||||
|
||||
const CHARSET: &[u8] =
|
||||
b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue