@@ -263,6 +263,7 @@ read_zero_byte_vec = "warn"
|
||||
redundant_clone = "warn"
|
||||
redundant_feature_names = "warn"
|
||||
redundant_type_annotations = "warn"
|
||||
result_large_err = "allow"
|
||||
todo = "warn"
|
||||
too_many_arguments = "allow"
|
||||
uninlined_format_args = "warn"
|
||||
|
||||
@@ -144,7 +144,7 @@ pub async fn fetch(semaphore: Arc<Semaphore>) -> Result<FetchResult, Error> {
|
||||
.chain(existing_versions.into_iter())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
new_versions.sort_by(|a, b| b.release_time.cmp(&a.release_time));
|
||||
new_versions.sort_by_key(|b| std::cmp::Reverse(b.release_time));
|
||||
|
||||
// create and upload the new manifest
|
||||
let version_manifest_path = format!(
|
||||
|
||||
@@ -861,7 +861,7 @@ impl DBProject {
|
||||
} = loaders_ptypes_games.remove(&project_id).map(|x|x.1).unwrap_or_default();
|
||||
// Each version is a tuple of (DBVersionId, DateTime<Utc>)
|
||||
let mut versions = versions.remove(&project_id).map(|x| x.1).unwrap_or_default();
|
||||
versions.sort_by(|a, b| a.1.cmp(&b.1));
|
||||
versions.sort_by_key(|a| a.1);
|
||||
let mut gallery = mods_gallery.remove(&project_id).map(|x| x.1).unwrap_or_default();
|
||||
let urls = links.remove(&project_id).map(|x| x.1).unwrap_or_default();
|
||||
let version_fields = version_fields.remove(&project_id).map(|x| x.1).unwrap_or_default();
|
||||
@@ -925,7 +925,7 @@ impl DBProject {
|
||||
games,
|
||||
versions: versions.into_iter().map(|x| x.0).collect(),
|
||||
gallery_items: {
|
||||
gallery.sort_by(|a, b| a.ordering.cmp(&b.ordering));
|
||||
gallery.sort_by_key(|a| a.ordering);
|
||||
gallery
|
||||
},
|
||||
urls,
|
||||
|
||||
@@ -161,7 +161,7 @@ impl DBThread {
|
||||
)
|
||||
.ok()
|
||||
.unwrap_or_default();
|
||||
messages.sort_by(|a, b| a.created.cmp(&b.created));
|
||||
messages.sort_by_key(|a| a.created);
|
||||
messages
|
||||
},
|
||||
members: x.members.unwrap_or_default().into_iter().map(DBUserId).collect(),
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![recursion_limit = "256"]
|
||||
|
||||
use actix_web::dev::Service;
|
||||
use actix_web::middleware::from_fn;
|
||||
use actix_web::{App, HttpServer};
|
||||
|
||||
@@ -785,7 +785,7 @@ async fn get_tremendous_payout_methods(
|
||||
.into_iter()
|
||||
.map(|x| PayoutDecimal(x.min))
|
||||
.collect::<Vec<_>>();
|
||||
values.sort_by(|a, b| a.0.cmp(&b.0));
|
||||
values.sort_by_key(|a| a.0);
|
||||
|
||||
PayoutInterval::Fixed { values }
|
||||
} else if let Some(first) = product.skus.first() {
|
||||
|
||||
@@ -86,7 +86,7 @@ pub async fn forge_updates(
|
||||
)
|
||||
.await?;
|
||||
|
||||
versions.sort_by(|a, b| b.date_published.cmp(&a.date_published));
|
||||
versions.sort_by_key(|b| std::cmp::Reverse(b.date_published));
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct ForgeUpdates {
|
||||
|
||||
@@ -1359,10 +1359,10 @@ pub async fn dependency_list_internal(
|
||||
)
|
||||
.await?;
|
||||
|
||||
projects.sort_by(|a, b| b.published.cmp(&a.published));
|
||||
projects.sort_by_key(|b| std::cmp::Reverse(b.published));
|
||||
projects.dedup_by(|a, b| a.id == b.id);
|
||||
|
||||
versions.sort_by(|a, b| b.date_published.cmp(&a.date_published));
|
||||
versions.sort_by_key(|b| std::cmp::Reverse(b.date_published));
|
||||
versions.dedup_by(|a, b| a.id == b.id);
|
||||
|
||||
Ok(HttpResponse::Ok().json(DependencyInfo { projects, versions }))
|
||||
|
||||
@@ -119,7 +119,7 @@ pub async fn loader_list(
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
results.sort_by(|a, b| a.name.to_lowercase().cmp(&b.name.to_lowercase()));
|
||||
results.sort_by_key(|a| a.name.to_lowercase());
|
||||
|
||||
Ok(HttpResponse::Ok().json(results))
|
||||
}
|
||||
|
||||
@@ -799,7 +799,7 @@ pub async fn user_notifications(
|
||||
.map(Into::into)
|
||||
.collect();
|
||||
|
||||
notifications.sort_by(|a, b| b.created.cmp(&a.created));
|
||||
notifications.sort_by_key(|b| std::cmp::Reverse(b.created));
|
||||
Ok(HttpResponse::Ok().json(notifications))
|
||||
} else {
|
||||
Err(ApiError::NotFound)
|
||||
|
||||
@@ -41,10 +41,11 @@ pub enum Bucketing {
|
||||
BucketSize(u64),
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum TextMatchType {
|
||||
MaxScore,
|
||||
#[default]
|
||||
MaxWeight,
|
||||
SumScore,
|
||||
}
|
||||
@@ -59,12 +60,6 @@ impl TextMatchType {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for TextMatchType {
|
||||
fn default() -> Self {
|
||||
Self::MaxWeight
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Bucketing {
|
||||
fn default() -> Self {
|
||||
Self::Buckets(5)
|
||||
|
||||
@@ -547,8 +547,8 @@ async fn index_versions(
|
||||
}
|
||||
|
||||
let all_version_ids = versions
|
||||
.iter()
|
||||
.flat_map(|(_, version_ids)| version_ids.iter())
|
||||
.values()
|
||||
.flat_map(|version_ids| version_ids.iter())
|
||||
.map(|(version_id, _)| version_id.0)
|
||||
.collect::<Vec<i64>>();
|
||||
|
||||
|
||||
@@ -509,10 +509,10 @@ fn get_gv_range(
|
||||
mut all_game_versions: Vec<MinecraftGameVersion>,
|
||||
) -> Vec<String> {
|
||||
// both -> least to greatest
|
||||
game_versions.sort_by(|a, b| a.created.cmp(&b.created));
|
||||
game_versions.sort_by_key(|a| a.created);
|
||||
game_versions.dedup_by(|a, b| a.version == b.version);
|
||||
|
||||
all_game_versions.sort_by(|a, b| a.created.cmp(&b.created));
|
||||
all_game_versions.sort_by_key(|a| a.created);
|
||||
|
||||
let all_releases = all_game_versions
|
||||
.iter()
|
||||
|
||||
@@ -51,167 +51,6 @@ services:
|
||||
interval: 3s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
elasticsearch-certs:
|
||||
image: elasticsearch:9.3.0
|
||||
container_name: labrinth-elasticsearch-certs
|
||||
user: '0'
|
||||
networks:
|
||||
- elasticsearch-mesh
|
||||
restart: 'no'
|
||||
volumes:
|
||||
- elasticsearch-certs:/usr/share/elasticsearch/config/certs
|
||||
command: |
|
||||
bash -c '
|
||||
set -euo pipefail
|
||||
if [ ! -s config/certs/ca/ca.crt ] || [ ! -s config/certs/elasticsearch0/elasticsearch0.crt ] || [ ! -s config/certs/elasticsearch1/elasticsearch1.crt ] || [ ! -s config/certs/elasticsearch2/elasticsearch2.crt ]; then
|
||||
rm -rf config/certs/*
|
||||
printf "%s\n" \
|
||||
"instances:" \
|
||||
" - name: elasticsearch0" \
|
||||
" dns:" \
|
||||
" - elasticsearch0" \
|
||||
" - localhost" \
|
||||
" ip:" \
|
||||
" - 127.0.0.1" \
|
||||
" - name: elasticsearch1" \
|
||||
" dns:" \
|
||||
" - elasticsearch1" \
|
||||
" - localhost" \
|
||||
" ip:" \
|
||||
" - 127.0.0.1" \
|
||||
" - name: elasticsearch2" \
|
||||
" dns:" \
|
||||
" - elasticsearch2" \
|
||||
" - localhost" \
|
||||
" ip:" \
|
||||
" - 127.0.0.1" \
|
||||
> config/certs/instances.yml
|
||||
bin/elasticsearch-certutil ca --silent --pem --out config/certs/ca.zip
|
||||
unzip config/certs/ca.zip -d config/certs
|
||||
bin/elasticsearch-certutil cert --silent --pem --in config/certs/instances.yml --ca-cert config/certs/ca/ca.crt --ca-key config/certs/ca/ca.key --out config/certs/certs.zip
|
||||
unzip config/certs/certs.zip -d config/certs
|
||||
fi
|
||||
chown -R 1000:0 config/certs
|
||||
find config/certs -type d -exec chmod 750 {} \;
|
||||
find config/certs -type f -exec chmod 640 {} \;
|
||||
echo "Set up certificates"
|
||||
'
|
||||
elasticsearch0:
|
||||
image: elasticsearch:9.3.0
|
||||
container_name: labrinth-elasticsearch0
|
||||
networks:
|
||||
- elasticsearch-mesh
|
||||
restart: on-failure
|
||||
depends_on:
|
||||
elasticsearch-certs:
|
||||
condition: service_completed_successfully
|
||||
ports:
|
||||
- '127.0.0.1:9200:9200'
|
||||
volumes:
|
||||
- elasticsearch0-data:/usr/share/elasticsearch/data
|
||||
- elasticsearch-certs:/usr/share/elasticsearch/config/certs:ro
|
||||
environment:
|
||||
- logger.level=WARN
|
||||
- node.name=elasticsearch0
|
||||
- cluster.name=labrinth
|
||||
- cluster.initial_master_nodes=elasticsearch0,elasticsearch1,elasticsearch2
|
||||
- discovery.seed_hosts=elasticsearch1,elasticsearch2
|
||||
- bootstrap.memory_lock=false
|
||||
# auth
|
||||
- xpack.security.enabled=true
|
||||
- xpack.security.transport.ssl.enabled=true
|
||||
- xpack.security.transport.ssl.verification_mode=certificate
|
||||
- xpack.security.transport.ssl.key=certs/elasticsearch0/elasticsearch0.key
|
||||
- xpack.security.transport.ssl.certificate=certs/elasticsearch0/elasticsearch0.crt
|
||||
- xpack.security.transport.ssl.certificate_authorities=certs/ca/ca.crt
|
||||
- ELASTIC_USERNAME=elastic
|
||||
- ELASTIC_PASSWORD=elastic
|
||||
mem_limit: 1g
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
'curl -s -u elastic:elastic http://localhost:9200/_cluster/health | grep -qE "\"status\":\"(yellow|green)\""',
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
elasticsearch1:
|
||||
image: elasticsearch:9.3.0
|
||||
container_name: labrinth-elasticsearch1
|
||||
networks:
|
||||
- elasticsearch-mesh
|
||||
restart: on-failure
|
||||
depends_on:
|
||||
elasticsearch-certs:
|
||||
condition: service_completed_successfully
|
||||
volumes:
|
||||
- elasticsearch1-data:/usr/share/elasticsearch/data
|
||||
- elasticsearch-certs:/usr/share/elasticsearch/config/certs:ro
|
||||
environment:
|
||||
- logger.level=WARN
|
||||
- node.name=elasticsearch1
|
||||
- cluster.name=labrinth
|
||||
- cluster.initial_master_nodes=elasticsearch0,elasticsearch1,elasticsearch2
|
||||
- discovery.seed_hosts=elasticsearch0,elasticsearch2
|
||||
- bootstrap.memory_lock=false
|
||||
# auth
|
||||
- xpack.security.enabled=true
|
||||
- xpack.security.transport.ssl.enabled=true
|
||||
- xpack.security.transport.ssl.verification_mode=certificate
|
||||
- xpack.security.transport.ssl.key=certs/elasticsearch1/elasticsearch1.key
|
||||
- xpack.security.transport.ssl.certificate=certs/elasticsearch1/elasticsearch1.crt
|
||||
- xpack.security.transport.ssl.certificate_authorities=certs/ca/ca.crt
|
||||
- ELASTIC_USERNAME=elastic
|
||||
- ELASTIC_PASSWORD=elastic
|
||||
mem_limit: 1g
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
'curl -s -u elastic:elastic http://localhost:9200/_cluster/health | grep -qE "\"status\":\"(yellow|green)\""',
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
elasticsearch2:
|
||||
image: elasticsearch:9.3.0
|
||||
container_name: labrinth-elasticsearch2
|
||||
networks:
|
||||
- elasticsearch-mesh
|
||||
restart: on-failure
|
||||
depends_on:
|
||||
elasticsearch-certs:
|
||||
condition: service_completed_successfully
|
||||
volumes:
|
||||
- elasticsearch2-data:/usr/share/elasticsearch/data
|
||||
- elasticsearch-certs:/usr/share/elasticsearch/config/certs:ro
|
||||
environment:
|
||||
- logger.level=WARN
|
||||
- node.name=elasticsearch2
|
||||
- cluster.name=labrinth
|
||||
- cluster.initial_master_nodes=elasticsearch0,elasticsearch1,elasticsearch2
|
||||
- discovery.seed_hosts=elasticsearch0,elasticsearch1
|
||||
- bootstrap.memory_lock=false
|
||||
# auth
|
||||
- xpack.security.enabled=true
|
||||
- xpack.security.transport.ssl.enabled=true
|
||||
- xpack.security.transport.ssl.verification_mode=certificate
|
||||
- xpack.security.transport.ssl.key=certs/elasticsearch2/elasticsearch2.key
|
||||
- xpack.security.transport.ssl.certificate=certs/elasticsearch2/elasticsearch2.crt
|
||||
- xpack.security.transport.ssl.certificate_authorities=certs/ca/ca.crt
|
||||
- ELASTIC_USERNAME=elastic
|
||||
- ELASTIC_PASSWORD=elastic
|
||||
mem_limit: 1g
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
'curl -s -u elastic:elastic http://localhost:9200/_cluster/health | grep -qE "\"status\":\"(yellow|green)\""',
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
redis:
|
||||
image: redis:alpine
|
||||
container_name: labrinth-redis
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
[toolchain]
|
||||
channel = "1.90.0"
|
||||
channel = "1.95.0"
|
||||
profile = "default"
|
||||
|
||||
Reference in New Issue
Block a user