You've already forked AstralRinth
forked from didirus/AstralRinth
* 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
42 lines
1.0 KiB
Rust
42 lines
1.0 KiB
Rust
use crate::validate::{
|
|
SupportedGameVersions, ValidationError, ValidationResult, filter_out_packs,
|
|
};
|
|
use chrono::DateTime;
|
|
use std::io::Cursor;
|
|
use zip::ZipArchive;
|
|
|
|
pub struct QuiltValidator;
|
|
|
|
impl super::Validator for QuiltValidator {
|
|
fn get_file_extensions(&self) -> &[&str] {
|
|
&["jar", "zip"]
|
|
}
|
|
|
|
fn get_supported_loaders(&self) -> &[&str] {
|
|
&["quilt"]
|
|
}
|
|
|
|
fn get_supported_game_versions(&self) -> SupportedGameVersions {
|
|
SupportedGameVersions::PastDate(
|
|
DateTime::from_timestamp(1646070100, 0).unwrap(),
|
|
)
|
|
}
|
|
|
|
fn validate(
|
|
&self,
|
|
archive: &mut ZipArchive<Cursor<bytes::Bytes>>,
|
|
) -> Result<ValidationResult, ValidationError> {
|
|
if archive.by_name("quilt.mod.json").is_err()
|
|
&& archive.by_name("fabric.mod.json").is_err()
|
|
{
|
|
return Ok(ValidationResult::Warning(
|
|
"No quilt.mod.json present for Quilt file.",
|
|
));
|
|
}
|
|
|
|
filter_out_packs(archive)?;
|
|
|
|
Ok(ValidationResult::Pass)
|
|
}
|
|
}
|