inbox rate limiting + poster storage cleanup
This commit is contained in:
@@ -286,6 +286,9 @@ mod tests {
|
||||
async fn get_poster(&self, _: &PosterPath) -> Result<Vec<u8>, DomainError> {
|
||||
panic!()
|
||||
}
|
||||
async fn delete_poster(&self, _: &PosterPath) -> Result<(), DomainError> {
|
||||
panic!()
|
||||
}
|
||||
}
|
||||
#[async_trait::async_trait]
|
||||
impl AuthService for Panic {
|
||||
|
||||
@@ -8,6 +8,15 @@ use crate::{handlers, state::AppState};
|
||||
|
||||
pub fn build_router(state: AppState, ap_router: Router) -> Router {
|
||||
let rate_limit = state.app_ctx.config.rate_limit;
|
||||
|
||||
let ap_cfg = GovernorConfigBuilder::default()
|
||||
.with_extractor(PeerIp::default())
|
||||
.expect_connect_info()
|
||||
.quota_default(per_minute(rate_limit))
|
||||
.finish()
|
||||
.unwrap();
|
||||
let ap_router = ap_router.layer(GovernorLayer::new(ap_cfg));
|
||||
|
||||
Router::new()
|
||||
.merge(html_routes(rate_limit))
|
||||
.merge(api_routes(rate_limit))
|
||||
|
||||
@@ -66,6 +66,9 @@ impl PosterStorage for PanicStorage {
|
||||
async fn get_poster(&self, _: &PosterPath) -> Result<Vec<u8>, DomainError> {
|
||||
panic!()
|
||||
}
|
||||
async fn delete_poster(&self, _: &PosterPath) -> Result<(), DomainError> {
|
||||
panic!()
|
||||
}
|
||||
}
|
||||
|
||||
struct PanicHasher;
|
||||
|
||||
Reference in New Issue
Block a user