Skip to content

Commit

Permalink
Sentry + ratelimit
Browse files Browse the repository at this point in the history
  • Loading branch information
Geometrically committed Jan 17, 2024
1 parent 496da14 commit 0b473c1
Show file tree
Hide file tree
Showing 67 changed files with 615 additions and 405 deletions.
97 changes: 57 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 5 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,19 @@ name = "labrinth"
path = "src/main.rs"

[dependencies]
# actix = "0.13.1"
# actix-web = "4.4.1"
# actix-rt = "2.9.0"
# actix-multipart = "0.6.1"
# actix-cors = "0.7.0"
# actix-ws = "0.2.5"
# actix-files = "0.6.5"
# actix-web-prom = "0.7.0"
axum = { version = "0.7.4", features = ["json", "form", "multipart", "query", "ws", "macros"] }
axum-prometheus = "0.5.0"

# middleware + utils
sentry = { version = "0.32.1", features = ["tracing", "tower"] }
sentry = { version = "0.32.1", features = ["tracing", "tower", "tower-http"] }
sentry-tower = "0.32.1"
tower-http = { version = "0.5.0", features = ["cors", "sensitive-headers", "fs", "compression-zstd", "compression-gzip", "compression-deflate", "compression-br"] }
tower-http = { version = "0.5.0", features = ["trace", "cors", "sensitive-headers", "fs", "compression-zstd", "compression-gzip", "compression-deflate", "compression-br"] }
tower = "0.4.13"
governor = "0.6.0"

# tracing
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

tokio = { version = "1.35.1", features = ["sync"] }
tokio-stream = "0.1.14"
Expand Down Expand Up @@ -81,8 +74,6 @@ censor = "0.3.0"
spdx = { version = "0.10.3", features = ["text"] }

dotenvy = "0.15.7"
log = "0.4.20"
env_logger = "0.10.1"
thiserror = "1.0.56"

sqlx = { version = "0.7.3", features = [
Expand Down
2 changes: 1 addition & 1 deletion src/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ pub mod oauth;
pub mod templates;
pub mod validate;

use crate::util::extract::Json;
use axum::http::StatusCode;
use axum::response::{IntoResponse, Response};
use crate::util::extract::Json;
pub use checks::{
filter_enlisted_projects_ids, filter_enlisted_version_ids, filter_visible_collections,
filter_visible_project_ids, filter_visible_projects,
Expand Down
2 changes: 1 addition & 1 deletion src/auth/oauth/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use super::ValidatedRedirectUri;
use crate::auth::AuthenticationError;
use crate::models::error::ApiError;
use crate::models::ids::DecodingError;
use crate::util::extract::Json;
use axum::http::header::LOCATION;
use axum::http::StatusCode;
use axum::response::{IntoResponse, Response};
use crate::util::extract::Json;

#[derive(thiserror::Error, Debug)]
#[error("{}", .error_type)]
Expand Down
2 changes: 1 addition & 1 deletion src/auth/oauth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ use crate::database::redis::RedisPool;
use crate::models::ids::OAuthClientId;
use crate::models::pats::Scopes;
use crate::queue::session::AuthQueue;
use crate::util::extract::{ConnectInfo, Extension, Form, Json, Query};
use axum::http::header::{CACHE_CONTROL, LOCATION, PRAGMA};
use axum::http::HeaderMap;
use axum::response::IntoResponse;
use axum::routing::{get, post};
use axum::Router;
use crate::util::extract::{Json, Form, Query, Extension, ConnectInfo};
use chrono::Duration;
use rand::distributions::Alphanumeric;
use rand::{Rng, SeedableRng};
Expand Down
2 changes: 1 addition & 1 deletion src/database/postgres_database.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use log::info;
use sqlx::migrate::MigrateDatabase;
use sqlx::postgres::{PgPool, PgPoolOptions};
use sqlx::{Connection, PgConnection, Postgres};
use std::time::Duration;
use tracing::info;

pub async fn connect() -> Result<PgPool, sqlx::Error> {
info!("Initializing database connection");
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use axum::{Extension, Router};
use std::sync::Arc;

use database::redis::RedisPool;
use log::{info, warn};
use queue::{
analytics::AnalyticsQueue, payouts::PayoutsQueue, session::AuthQueue, socket::ActiveSockets,
};
use sqlx::Postgres;
use tracing::{info, warn};

extern crate clickhouse as clickhouse_crate;
use clickhouse_crate::Client;
Expand Down
Loading

0 comments on commit 0b473c1

Please sign in to comment.