Update validators again (#925)

* Update validators again

* fix tests + clippy
This commit is contained in:
Geometrically
2024-06-12 14:38:35 -07:00
committed by GitHub
parent beaaed6613
commit b8963d272a
11 changed files with 161 additions and 28 deletions

View File

@@ -1,5 +1,4 @@
use crate::validate::{SupportedGameVersions, ValidationError, ValidationResult};
use chrono::{DateTime, NaiveDateTime, Utc};
use crate::validate::{filter_out_packs, SupportedGameVersions, ValidationError, ValidationResult};
use std::io::Cursor;
use zip::ZipArchive;
@@ -7,7 +6,7 @@ pub struct FabricValidator;
impl super::Validator for FabricValidator {
fn get_file_extensions(&self) -> &[&str] {
&["jar", "zip"]
&["jar"]
}
fn get_supported_loaders(&self) -> &[&str] {
@@ -15,11 +14,7 @@ impl super::Validator for FabricValidator {
}
fn get_supported_game_versions(&self) -> SupportedGameVersions {
// Time since release of 18w49a, the first fabric version
SupportedGameVersions::PastDate(DateTime::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_opt(1543969469, 0).unwrap(),
Utc,
))
SupportedGameVersions::All
}
fn validate(
@@ -32,6 +27,8 @@ impl super::Validator for FabricValidator {
));
}
filter_out_packs(archive)?;
Ok(ValidationResult::Pass)
}
}