diff --git a/Cargo.lock b/Cargo.lock index 11d719e..75fc36e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -240,9 +240,9 @@ dependencies = [ [[package]] name = "axum" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de45108900e1f9b9242f7f2e254aa3e2c029c921c258fe9e6b4217eeebd54288" +checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5" dependencies = [ "axum-core", "axum-macros", @@ -679,9 +679,9 @@ dependencies = [ [[package]] name = "comrak" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f690706b5db081dccea6206d7f6d594bb9895599abea9d1a0539f13888781ae8" +checksum = "d5c834ca54c5a20588b358f34d1533b4b498ddb5fd979cec6b22d0e8867a2449" dependencies = [ "bon", "caseless", @@ -871,20 +871,6 @@ dependencies = [ "syn 2.0.100", ] -[[package]] -name = "dashmap" -version = "6.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" -dependencies = [ - "cfg-if", - "crossbeam-utils", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", -] - [[package]] name = "data-encoding" version = "2.7.0" @@ -1108,16 +1094,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "forwarded-header-value" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835f84f38484cc86f110a805655697908257fb9a7af005234060891557198e9" -dependencies = [ - "nonempty", - "thiserror 1.0.69", -] - [[package]] name = "futf" version = "0.1.5" @@ -1188,12 +1164,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" -[[package]] -name = "futures-timer" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" - [[package]] name = "futures-util" version = "0.3.31" @@ -1263,11 +1233,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" dependencies = [ "cfg-if", - "js-sys", "libc", "r-efi", "wasi 0.14.2+wasi-0.2.4", - "wasm-bindgen", ] [[package]] @@ -1310,29 +1278,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "governor" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be93b4ec2e4710b04d9264c0c7350cdd62a8c20e5e4ac732552ebb8f0debe8eb" -dependencies = [ - "cfg-if", - "dashmap", - "futures-sink", - "futures-timer", - "futures-util", - "getrandom 0.3.2", - "no-std-compat", - "nonzero_ext", - "parking_lot", - "portable-atomic", - "quanta", - "rand 0.9.1", - "smallvec", - "spinning_top", - "web-time", -] - [[package]] name = "h2" version = "0.3.26" @@ -1381,12 +1326,6 @@ dependencies = [ "crunchy", ] -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - [[package]] name = "hashbrown" version = "0.15.2" @@ -1402,7 +1341,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" dependencies = [ - "hashbrown 0.15.2", + "hashbrown", ] [[package]] @@ -1889,7 +1828,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ "equivalent", - "hashbrown 0.15.2", + "hashbrown", ] [[package]] @@ -2228,12 +2167,6 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" -[[package]] -name = "no-std-compat" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" - [[package]] name = "nom" version = "7.1.3" @@ -2244,18 +2177,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "nonempty" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9e591e719385e6ebaeb5ce5d3887f7d5676fceca6411d1925ccc95745f3d6f7" - -[[package]] -name = "nonzero_ext" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" - [[package]] name = "noop_proc_macro" version = "0.3.0" @@ -2571,26 +2492,6 @@ dependencies = [ "siphasher", ] -[[package]] -name = "pin-project" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", -] - [[package]] name = "pin-project-lite" version = "0.2.16" @@ -2635,12 +2536,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "portable-atomic" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" - [[package]] name = "postgres-protocol" version = "0.6.8" @@ -2755,21 +2650,6 @@ dependencies = [ "qrcodegen", ] -[[package]] -name = "quanta" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bd1fe6824cea6538803de3ff1bc0cf3949024db3d43c9643024bfb33a807c0e" -dependencies = [ - "crossbeam-utils", - "libc", - "once_cell", - "raw-cpuid", - "wasi 0.11.0+wasi-snapshot-preview1", - "web-sys", - "winapi", -] - [[package]] name = "quick-error" version = "2.0.1" @@ -2950,15 +2830,6 @@ dependencies = [ "rgb", ] -[[package]] -name = "raw-cpuid" -version = "11.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6df7ab838ed27997ba19a4664507e6f82b41fe6e20be42929332156e5e85146" -dependencies = [ - "bitflags 2.9.0", -] - [[package]] name = "rayon" version = "1.10.0" @@ -3397,9 +3268,9 @@ checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" [[package]] name = "sha2" -version = "0.10.8" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", "cpufeatures", @@ -3518,15 +3389,6 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -[[package]] -name = "spinning_top" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300" -dependencies = [ - "lock_api", -] - [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -3768,7 +3630,6 @@ dependencies = [ "tetratto-shared", "tokio", "tower-http", - "tower_governor", "tracing", "tracing-subscriber", ] @@ -3940,9 +3801,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.44.2" +version = "1.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" +checksum = "2513ca694ef9ede0fb23fe71a4ee4107cb102b9dc1930f6d0fd77aae068ae165" dependencies = [ "backtrace", "bytes", @@ -4113,9 +3974,9 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "403fa3b783d4b626a8ad51d766ab03cb6d2dbfc46b1c5d4448395e6628dc9697" +checksum = "a1cfca9ae570b2a6efc764a88e914c29b3dfaa1fafe5f495812ae97ec9bc4d53" dependencies = [ "bitflags 2.9.0", "bytes", @@ -4148,22 +4009,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" -[[package]] -name = "tower_governor" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84e6672c7510df74859726427edea641674dad1aeeb30057b87335b1ba23b843" -dependencies = [ - "axum", - "forwarded-header-value", - "governor", - "http 1.3.1", - "pin-project", - "thiserror 2.0.12", - "tower", - "tracing", -] - [[package]] name = "tracing" version = "0.1.41" @@ -4604,16 +4449,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "web-time" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "web_atoms" version = "0.1.0" diff --git a/crates/app/Cargo.toml b/crates/app/Cargo.toml index 492741f..67ff1a5 100644 --- a/crates/app/Cargo.toml +++ b/crates/app/Cargo.toml @@ -15,9 +15,9 @@ serde = { version = "1.0.219", features = ["derive"] } tera = "1.20.0" tracing = "0.1.41" tracing-subscriber = { version = "0.3.19", features = ["env-filter"] } -tower-http = { version = "0.6.2", features = ["trace", "fs", "catch-panic"] } -axum = { version = "0.8.3", features = ["macros", "ws"] } -tokio = { version = "1.44.2", features = ["macros", "rt-multi-thread"] } +tower-http = { version = "0.6.3", features = ["trace", "fs", "catch-panic"] } +axum = { version = "0.8.4", features = ["macros", "ws"] } +tokio = { version = "1.45.0", features = ["macros", "rt-multi-thread"] } axum-extra = { version = "0.10.1", features = ["cookie", "multipart"] } ammonia = "4.1.0" tetratto-shared = { path = "../shared" } @@ -39,7 +39,6 @@ redis = { version = "0.30.0", features = [ "aio", "tokio-comp", ], optional = true } -tower_governor = "0.7.0" async-stripe = { version = "0.41.0", features = [ "events", "checkout", diff --git a/crates/app/src/main.rs b/crates/app/src/main.rs index 5bb19c3..7a242a5 100644 --- a/crates/app/src/main.rs +++ b/crates/app/src/main.rs @@ -15,10 +15,9 @@ use tower_http::{ trace::{self, TraceLayer}, catch_panic::CatchPanicLayer, }; -use tower_governor::{GovernorLayer, governor::GovernorConfigBuilder}; use tracing::{Level, info}; -use std::{collections::HashMap, env::var, net::SocketAddr, process::exit, sync::Arc, time::Duration}; +use std::{collections::HashMap, env::var, net::SocketAddr, process::exit, sync::Arc}; use tokio::sync::RwLock; pub(crate) type State = Arc>; @@ -56,26 +55,6 @@ async fn main() { init_dirs(&config).await; let html_path = write_assets(&config).await; - // governor - let governor_config = Arc::new( - GovernorConfigBuilder::default() - .per_millisecond(64) - .burst_size(128) - .finish() - .unwrap(), - ); - - let governor_limiter = governor_config.limiter().clone(); - let governor_interval = Duration::from_secs(60); - - std::thread::spawn(move || { - loop { - std::thread::sleep(governor_interval); - tracing::info!("rate limiting storage size: {}", governor_limiter.len()); - governor_limiter.retain_recent(); - } - }); - // ... let database = DataManager::new(config.clone()).await.unwrap(); database.init().await.unwrap(); @@ -108,10 +87,7 @@ async fn main() { .make_span_with(trace::DefaultMakeSpan::new().level(Level::INFO)) .on_response(trace::DefaultOnResponse::new().level(Level::INFO)), ) - .layer(CatchPanicLayer::new()) - .layer(GovernorLayer { - config: governor_config, - }); + .layer(CatchPanicLayer::new()); let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", config.port)) .await diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index 23e28a6..22fc7b0 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -9,10 +9,10 @@ license.workspace = true [dependencies] ammonia = "4.1.0" chrono = "0.4.41" -comrak = "0.38.0" +comrak = "0.39.0" hex_fmt = "0.3.0" rand = "0.9.1" serde = "1.0.219" -sha2 = "0.10.8" +sha2 = "0.10.9" snowflaked = "1.0.3" uuid = { version = "1.16.0", features = ["v4"] } diff --git a/example/tetratto.toml b/example/tetratto.toml index f446e39..837924b 100644 --- a/example/tetratto.toml +++ b/example/tetratto.toml @@ -33,7 +33,7 @@ icons = "icons" [database] name = "tetratto" url = "localhost:5432" -user = "hkau" +user = "user" password = "postgres" [policies]