diff --git a/server/src/rate_limit/mod.rs b/server/src/rate_limit/mod.rs index 4bccca890..5a3ae9266 100644 --- a/server/src/rate_limit/mod.rs +++ b/server/src/rate_limit/mod.rs @@ -45,6 +45,10 @@ impl RateLimit { self.kind(RateLimitType::Register) } + pub fn image(&self) -> RateLimited { + self.kind(RateLimitType::Image) + } + fn kind(&self, type_: RateLimitType) -> RateLimited { RateLimited { rate_limiter: self.rate_limiter.clone(), diff --git a/server/src/routes/images.rs b/server/src/routes/images.rs index aeb600041..8c94535a2 100644 --- a/server/src/routes/images.rs +++ b/server/src/routes/images.rs @@ -17,7 +17,7 @@ pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) { .data(client) .service( web::resource("/pictrs/image") - .wrap(rate_limit.message()) + .wrap(rate_limit.image()) .route(web::post().to(upload)), ) .service(web::resource("/pictrs/image/{filename}").route(web::get().to(full_res)))