Improve peformance of search indexing, v2 fixes + new routes (#205)

* Refactor search to not spam the database with queries, new utility routes for V2

* Run prepare
This commit is contained in:
Geometrically authored and GitHub committed 2021-06-02 18:33:11 -07:00
1 parent 16db28060c
commit 157962e42a
18 files changed
+833 -763

No files matched your search

+5 -1
View File
@@ -30,7 +30,11 @@ impl super::Validator for FabricValidator {
&self,
archive: &mut ZipArchive<Cursor<&[u8]>>,
) -> Result<ValidationResult, ValidationError> {
archive.by_name("fabric.mod.json")?;
archive.by_name("fabric.mod.json").map_err(|_| {
ValidationError::InvalidInputError(
"No fabric.mod.json present for Fabric file.".to_string(),
)
})?;
if !archive
.file_names()
+6 -2
View File
@@ -30,7 +30,9 @@ impl super::Validator for ForgeValidator {
&self,
archive: &mut ZipArchive<Cursor<&[u8]>>,
) -> Result<ValidationResult, ValidationError> {
archive.by_name("META-INF/mods.toml")?;
archive.by_name("META-INF/mods.toml").map_err(|_| {
ValidationError::InvalidInputError("No mods.toml present for Forge file.".to_string())
})?;
if !archive.file_names().any(|name| name.ends_with(".class")) {
return Ok(ValidationResult::Warning(
@@ -71,7 +73,9 @@ impl super::Validator for LegacyForgeValidator {
&self,
archive: &mut ZipArchive<Cursor<&[u8]>>,
) -> Result<ValidationResult, ValidationError> {
archive.by_name("mcmod.info")?;
archive.by_name("mcmod.info").map_err(|_| {
ValidationError::InvalidInputError("No mcmod.info present for Forge file.".to_string())
})?;
if !archive.file_names().any(|name| name.ends_with(".class")) {
return Ok(ValidationResult::Warning(
+3 -1
View File
@@ -78,7 +78,9 @@ impl super::Validator for PackValidator {
&self,
archive: &mut ZipArchive<Cursor<&[u8]>>,
) -> Result<ValidationResult, ValidationError> {
let mut file = archive.by_name("index.json")?;
let mut file = archive.by_name("index.json").map_err(|_| {
ValidationError::InvalidInputError("Pack manifest is missing.".to_string())
})?;
let mut contents = String::new();
file.read_to_string(&mut contents)?;