mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 22:52:22 +00:00
@@ -1,7 +1,7 @@
|
|||||||
use crate::config::NextcloudLoginConfig;
|
use crate::config::NextcloudLoginConfig;
|
||||||
use axum::Router;
|
use axum::Router;
|
||||||
use axum::body::{Body, HttpBody};
|
use axum::body::{Body, HttpBody};
|
||||||
use axum::extract::Request;
|
use axum::extract::{DefaultBodyLimit, Request};
|
||||||
use axum::middleware::Next;
|
use axum::middleware::Next;
|
||||||
use axum::response::{Redirect, Response};
|
use axum::response::{Redirect, Response};
|
||||||
use axum::routing::{any, options};
|
use axum::routing::{any, options};
|
||||||
@@ -39,6 +39,7 @@ pub fn make_app<AS: AddressbookStore, CS: CalendarStore, S: SubscriptionStore>(
|
|||||||
nextcloud_login_config: NextcloudLoginConfig,
|
nextcloud_login_config: NextcloudLoginConfig,
|
||||||
dav_push_enabled: bool,
|
dav_push_enabled: bool,
|
||||||
session_cookie_samesite_strict: bool,
|
session_cookie_samesite_strict: bool,
|
||||||
|
payload_limit_mb: usize,
|
||||||
) -> Router<()> {
|
) -> Router<()> {
|
||||||
let birthday_store = Arc::new(ContactBirthdayStore::new(addr_store.clone()));
|
let birthday_store = Arc::new(ContactBirthdayStore::new(addr_store.clone()));
|
||||||
let combined_cal_store =
|
let combined_cal_store =
|
||||||
@@ -202,4 +203,5 @@ pub fn make_app<AS: AddressbookStore, CS: CalendarStore, S: SubscriptionStore>(
|
|||||||
response
|
response
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
.layer(DefaultBodyLimit::max(payload_limit_mb * 1000 * 1000))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ pub struct HttpConfig {
|
|||||||
pub host: String,
|
pub host: String,
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
pub session_cookie_samesite_strict: bool,
|
pub session_cookie_samesite_strict: bool,
|
||||||
|
pub payload_limit_mb: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for HttpConfig {
|
impl Default for HttpConfig {
|
||||||
@@ -16,6 +17,7 @@ impl Default for HttpConfig {
|
|||||||
host: "0.0.0.0".to_owned(),
|
host: "0.0.0.0".to_owned(),
|
||||||
port: 4000,
|
port: 4000,
|
||||||
session_cookie_samesite_strict: false,
|
session_cookie_samesite_strict: false,
|
||||||
|
payload_limit_mb: 4,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ async fn main() -> Result<()> {
|
|||||||
config.nextcloud_login.clone(),
|
config.nextcloud_login.clone(),
|
||||||
config.dav_push.enabled,
|
config.dav_push.enabled,
|
||||||
config.http.session_cookie_samesite_strict,
|
config.http.session_cookie_samesite_strict,
|
||||||
|
config.http.payload_limit_mb,
|
||||||
);
|
);
|
||||||
let app = ServiceExt::<Request>::into_make_service(
|
let app = ServiceExt::<Request>::into_make_service(
|
||||||
NormalizePathLayer::trim_trailing_slash().layer(app),
|
NormalizePathLayer::trim_trailing_slash().layer(app),
|
||||||
|
|||||||
Reference in New Issue
Block a user