You've already forked AstralRinth
forked from didirus/AstralRinth
move to monorepo dir
This commit is contained in:
34
apps/labrinth/src/validate/liteloader.rs
Normal file
34
apps/labrinth/src/validate/liteloader.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
use crate::validate::{filter_out_packs, SupportedGameVersions, ValidationError, ValidationResult};
|
||||
use std::io::Cursor;
|
||||
use zip::ZipArchive;
|
||||
|
||||
pub struct LiteLoaderValidator;
|
||||
|
||||
impl super::Validator for LiteLoaderValidator {
|
||||
fn get_file_extensions(&self) -> &[&str] {
|
||||
&["litemod", "jar"]
|
||||
}
|
||||
|
||||
fn get_supported_loaders(&self) -> &[&str] {
|
||||
&["liteloader"]
|
||||
}
|
||||
|
||||
fn get_supported_game_versions(&self) -> SupportedGameVersions {
|
||||
SupportedGameVersions::All
|
||||
}
|
||||
|
||||
fn validate(
|
||||
&self,
|
||||
archive: &mut ZipArchive<Cursor<bytes::Bytes>>,
|
||||
) -> Result<ValidationResult, ValidationError> {
|
||||
if archive.by_name("litemod.json").is_err() {
|
||||
return Ok(ValidationResult::Warning(
|
||||
"No litemod.json present for LiteLoader file.",
|
||||
));
|
||||
}
|
||||
|
||||
filter_out_packs(archive)?;
|
||||
|
||||
Ok(ValidationResult::Pass)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user