You've already forked AstralRinth
forked from didirus/AstralRinth
Inherit dependencies from workspace manifest, and optimize some out (#3655)
* chore: inherit dependencies from workspace, optimize some deps out * Update bitflags from 2.9.0 to 2.9.1 * Fix temp directory leak in check_java_at_filepath * Fix build * Fix lint * chore(app-lib): refactor overkill `futures` executor usage to Tokio MPSC * chore: fix Clippy lint * tweak: optimize out dependency on OpenSSL source build Contrary to what I expected before, this was caused due to the Tauri updater plugin using a different TLS stack than everything else. * chore(labrinth): drop now unused dependency * Update zip because 2.6.1 got yanked * Downgrade weezl to 0.1.8 * Mention that p256 is also a blocker for rand 0.9 * chore: sidestep GitHub review requirements * chore: sidestep GitHub review requirements (2) * chore: sidestep GitHub review requirements (3) --------- Co-authored-by: Josiah Glosson <soujournme@gmail.com>
This commit is contained in:
committed by
GitHub
parent
37cc81a36d
commit
f19643095e
@@ -50,7 +50,7 @@ fn require_profiling_activated(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn jemalloc_mmeory_stats(
|
||||
pub fn jemalloc_memory_stats(
|
||||
registry: &Registry,
|
||||
) -> Result<(), prometheus::Error> {
|
||||
let allocated_mem = IntGauge::new(
|
||||
|
||||
@@ -13,7 +13,7 @@ use crate::util::captcha::check_hcaptcha;
|
||||
use crate::util::env::parse_strings_from_var;
|
||||
use crate::util::ext::get_image_ext;
|
||||
use crate::util::img::upload_image_optimized;
|
||||
use crate::util::validate::{RE_URL_SAFE, validation_errors_to_string};
|
||||
use crate::util::validate::validation_errors_to_string;
|
||||
use actix_web::web::{Data, Query, ServiceConfig, scope};
|
||||
use actix_web::{HttpRequest, HttpResponse, delete, get, patch, post, web};
|
||||
use argon2::password_hash::SaltString;
|
||||
@@ -1318,7 +1318,7 @@ pub async fn sign_up_sendy(email: &str) -> Result<(), AuthenticationError> {
|
||||
|
||||
#[derive(Deserialize, Validate)]
|
||||
pub struct NewAccount {
|
||||
#[validate(length(min = 1, max = 39), regex(path = *RE_URL_SAFE))]
|
||||
#[validate(length(min = 1, max = 39), regex(path = *crate::util::validate::RE_URL_SAFE))]
|
||||
pub username: String,
|
||||
#[validate(length(min = 8, max = 256))]
|
||||
pub password: String,
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::{auth::get_user_from_headers, database};
|
||||
use actix_web::{HttpRequest, HttpResponse, get, route, web};
|
||||
use sqlx::PgPool;
|
||||
use std::collections::HashSet;
|
||||
use yaserde_derive::YaSerialize;
|
||||
use yaserde::YaSerialize;
|
||||
|
||||
pub fn config(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(maven_metadata);
|
||||
|
||||
@@ -9,8 +9,6 @@ use crate::models::v2::user::LegacyUser;
|
||||
use crate::queue::session::AuthQueue;
|
||||
use crate::routes::{ApiError, v2_reroute, v3};
|
||||
use actix_web::{HttpRequest, HttpResponse, delete, get, patch, web};
|
||||
use lazy_static::lazy_static;
|
||||
use regex::Regex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::PgPool;
|
||||
use std::sync::Arc;
|
||||
@@ -135,20 +133,16 @@ pub async fn projects_list(
|
||||
}
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref RE_URL_SAFE: Regex = Regex::new(r"^[a-zA-Z0-9_-]*$").unwrap();
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Validate)]
|
||||
pub struct EditUser {
|
||||
#[validate(length(min = 1, max = 39), regex(path = *RE_URL_SAFE))]
|
||||
#[validate(length(min = 1, max = 39), regex(path = *crate::util::validate::RE_URL_SAFE))]
|
||||
pub username: Option<String>,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
with = "::serde_with::rust::double_option"
|
||||
)]
|
||||
#[validate(length(min = 1, max = 64), regex(path = *RE_URL_SAFE))]
|
||||
#[validate(length(min = 1, max = 64), regex(path = *crate::util::validate::RE_URL_SAFE))]
|
||||
pub name: Option<Option<String>>,
|
||||
#[serde(
|
||||
default,
|
||||
|
||||
@@ -906,11 +906,11 @@ pub async fn edit_project_categories(
|
||||
categories: &Vec<String>,
|
||||
perms: &ProjectPermissions,
|
||||
project_id: db_ids::ProjectId,
|
||||
additional: bool,
|
||||
is_additional: bool,
|
||||
transaction: &mut sqlx::Transaction<'_, sqlx::Postgres>,
|
||||
) -> Result<(), ApiError> {
|
||||
if !perms.contains(ProjectPermissions::EDIT_DETAILS) {
|
||||
let additional_str = if additional { "additional " } else { "" };
|
||||
let additional_str = if is_additional { "additional " } else { "" };
|
||||
return Err(ApiError::CustomAuthentication(format!(
|
||||
"You do not have the permissions to edit the {additional_str}categories of this project!"
|
||||
)));
|
||||
@@ -928,7 +928,11 @@ pub async fn edit_project_categories(
|
||||
|
||||
let mcategories = category_ids
|
||||
.values()
|
||||
.map(|x| ModCategory::new(project_id, *x, additional))
|
||||
.map(|&category_id| ModCategory {
|
||||
project_id,
|
||||
category_id,
|
||||
is_additional,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
mod_categories.extend(mcategories);
|
||||
}
|
||||
@@ -1081,7 +1085,6 @@ pub async fn dependency_list(
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(derive_new::new)]
|
||||
pub struct CategoryChanges<'a> {
|
||||
pub categories: &'a Option<Vec<String>>,
|
||||
pub add_categories: &'a Option<Vec<String>>,
|
||||
@@ -1241,11 +1244,11 @@ pub async fn projects_edit(
|
||||
&categories,
|
||||
&project.categories,
|
||||
project.inner.id as db_ids::ProjectId,
|
||||
CategoryChanges::new(
|
||||
&bulk_edit_project.categories,
|
||||
&bulk_edit_project.add_categories,
|
||||
&bulk_edit_project.remove_categories,
|
||||
),
|
||||
CategoryChanges {
|
||||
categories: &bulk_edit_project.categories,
|
||||
add_categories: &bulk_edit_project.add_categories,
|
||||
remove_categories: &bulk_edit_project.remove_categories,
|
||||
},
|
||||
3,
|
||||
false,
|
||||
&mut transaction,
|
||||
@@ -1256,11 +1259,12 @@ pub async fn projects_edit(
|
||||
&categories,
|
||||
&project.additional_categories,
|
||||
project.inner.id as db_ids::ProjectId,
|
||||
CategoryChanges::new(
|
||||
&bulk_edit_project.additional_categories,
|
||||
&bulk_edit_project.add_additional_categories,
|
||||
&bulk_edit_project.remove_additional_categories,
|
||||
),
|
||||
CategoryChanges {
|
||||
categories: &bulk_edit_project.additional_categories,
|
||||
add_categories: &bulk_edit_project.add_additional_categories,
|
||||
remove_categories: &bulk_edit_project
|
||||
.remove_additional_categories,
|
||||
},
|
||||
256,
|
||||
true,
|
||||
&mut transaction,
|
||||
@@ -1383,11 +1387,11 @@ pub async fn bulk_edit_project_categories(
|
||||
))
|
||||
})?
|
||||
.id;
|
||||
mod_categories.push(ModCategory::new(
|
||||
mod_categories.push(ModCategory {
|
||||
project_id,
|
||||
category_id,
|
||||
is_additional,
|
||||
));
|
||||
});
|
||||
}
|
||||
ModCategory::insert_many(mod_categories, &mut *transaction).await?;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use actix_web::{HttpRequest, HttpResponse, web};
|
||||
use lazy_static::lazy_static;
|
||||
use regex::Regex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::PgPool;
|
||||
use validator::Validate;
|
||||
@@ -358,13 +356,9 @@ pub async fn orgs_list(
|
||||
}
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref RE_URL_SAFE: Regex = Regex::new(r"^[a-zA-Z0-9_-]*$").unwrap();
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Validate)]
|
||||
pub struct EditUser {
|
||||
#[validate(length(min = 1, max = 39), regex(path = *RE_URL_SAFE))]
|
||||
#[validate(length(min = 1, max = 39), regex(path = *crate::util::validate::RE_URL_SAFE))]
|
||||
pub username: Option<String>,
|
||||
#[serde(
|
||||
default,
|
||||
|
||||
@@ -287,10 +287,10 @@ pub async fn version_edit_helper(
|
||||
ApiError::Validation(validation_errors_to_string(err, None))
|
||||
})?;
|
||||
|
||||
let version_id = info.0;
|
||||
let id = version_id.into();
|
||||
let version_id = info.0.into();
|
||||
|
||||
let result = database::models::Version::get(id, &**pool, &redis).await?;
|
||||
let result =
|
||||
database::models::Version::get(version_id, &**pool, &redis).await?;
|
||||
|
||||
if let Some(version_item) = result {
|
||||
let team_member =
|
||||
@@ -345,7 +345,7 @@ pub async fn version_edit_helper(
|
||||
WHERE (id = $2)
|
||||
",
|
||||
name.trim(),
|
||||
id as database::models::ids::VersionId,
|
||||
version_id as database::models::ids::VersionId,
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
@@ -359,7 +359,7 @@ pub async fn version_edit_helper(
|
||||
WHERE (id = $2)
|
||||
",
|
||||
number,
|
||||
id as database::models::ids::VersionId,
|
||||
version_id as database::models::ids::VersionId,
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
@@ -373,7 +373,7 @@ pub async fn version_edit_helper(
|
||||
WHERE (id = $2)
|
||||
",
|
||||
version_type.as_str(),
|
||||
id as database::models::ids::VersionId,
|
||||
version_id as database::models::ids::VersionId,
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
@@ -384,7 +384,7 @@ pub async fn version_edit_helper(
|
||||
"
|
||||
DELETE FROM dependencies WHERE dependent_id = $1
|
||||
",
|
||||
id as database::models::ids::VersionId,
|
||||
version_id as database::models::ids::VersionId,
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
@@ -448,7 +448,7 @@ pub async fn version_edit_helper(
|
||||
WHERE version_id = $1
|
||||
AND field_id = ANY($2)
|
||||
",
|
||||
id as database::models::ids::VersionId,
|
||||
version_id as database::models::ids::VersionId,
|
||||
&loader_field_ids
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
@@ -476,7 +476,7 @@ pub async fn version_edit_helper(
|
||||
.remove(&loader_field.id)
|
||||
.unwrap_or_default();
|
||||
let vf: VersionField = VersionField::check_parse(
|
||||
version_id.into(),
|
||||
version_id,
|
||||
loader_field.clone(),
|
||||
vf_value.clone(),
|
||||
enum_variants,
|
||||
@@ -493,7 +493,7 @@ pub async fn version_edit_helper(
|
||||
"
|
||||
DELETE FROM loaders_versions WHERE version_id = $1
|
||||
",
|
||||
id as database::models::ids::VersionId,
|
||||
version_id as database::models::ids::VersionId,
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
@@ -513,7 +513,10 @@ pub async fn version_edit_helper(
|
||||
.to_string(),
|
||||
)
|
||||
})?;
|
||||
loader_versions.push(LoaderVersion::new(loader_id, id));
|
||||
loader_versions.push(LoaderVersion {
|
||||
loader_id,
|
||||
version_id,
|
||||
});
|
||||
}
|
||||
LoaderVersion::insert_many(loader_versions, &mut transaction)
|
||||
.await?;
|
||||
@@ -535,7 +538,7 @@ pub async fn version_edit_helper(
|
||||
WHERE (id = $2)
|
||||
",
|
||||
featured,
|
||||
id as database::models::ids::VersionId,
|
||||
version_id as database::models::ids::VersionId,
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
@@ -549,7 +552,7 @@ pub async fn version_edit_helper(
|
||||
WHERE (id = $2)
|
||||
",
|
||||
body,
|
||||
id as database::models::ids::VersionId,
|
||||
version_id as database::models::ids::VersionId,
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
@@ -569,7 +572,7 @@ pub async fn version_edit_helper(
|
||||
WHERE (id = $2)
|
||||
",
|
||||
*downloads as i32,
|
||||
id as database::models::ids::VersionId,
|
||||
version_id as database::models::ids::VersionId,
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
@@ -604,7 +607,7 @@ pub async fn version_edit_helper(
|
||||
WHERE (id = $2)
|
||||
",
|
||||
status.as_str(),
|
||||
id as database::models::ids::VersionId,
|
||||
version_id as database::models::ids::VersionId,
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
@@ -652,7 +655,7 @@ pub async fn version_edit_helper(
|
||||
WHERE (id = $2)
|
||||
",
|
||||
ordering.to_owned() as Option<i32>,
|
||||
id as database::models::ids::VersionId,
|
||||
version_id as database::models::ids::VersionId,
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user