* Update some Labrinth dependencies * Update some Labrinth dependencies * Update some Labrinth dependencies * Update zip in Labrinth * Update itertools in Labrinth * Update validator in labrinth * Update thiserror in labrinth * Update rust_decimal, redis, and deadpool-redis in labrinth * Update totp-rs and spdx in labrinth * Update maxminddb and tar in labrinth * Update sentry and sentry-actix in labrinth * Update image in labrinth * Update lettre in labrinth * Update derive-new and rust_iso3166 in labrinth * Update async-stripe and json-patch in labrinth * Update clap and iana-time-zone in labrinth * Update labrinth to Rust 2024 * Cargo fmt * Just do a full cargo update * Update daedelus to Rust 2024 * Update daedelus_client to Rust 2024 * Set the formatting edition to 2024 * Fix formatting IntelliJ messed up my formatting
37 lines
918 B
Rust
37 lines
918 B
Rust
use crate::validate::{
|
|
SupportedGameVersions, ValidationError, ValidationResult, filter_out_packs,
|
|
};
|
|
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)
|
|
}
|
|
}
|