diff --git a/src/api_data/server_config.rs b/src/api_data/server_config.rs index 80bfe87..7bbb8b9 100644 --- a/src/api_data/server_config.rs +++ b/src/api_data/server_config.rs @@ -3,7 +3,7 @@ //! @author Pierre Hubert use serde::Serialize; -use crate::constants::{ALLOWED_CONVERSATION_FILES_TYPES, conservation_policy, CONVERSATION_FILES_MAX_SIZE, MAX_CONVERSATION_MESSAGE_LENGTH, MIN_CONVERSATION_MESSAGE_LENGTH, MIN_SUPPORTED_MOBILE_VERSION, password_policy}; +use crate::constants::{ALLOWED_CONVERSATION_FILES_TYPES, conservation_policy, CONVERSATION_FILES_MAX_SIZE, CONVERSATION_WRITING_EVENT_INTERVAL, CONVERSATION_WRITING_EVENT_LIFETIME, MAX_CONVERSATION_MESSAGE_LENGTH, MIN_CONVERSATION_MESSAGE_LENGTH, MIN_SUPPORTED_MOBILE_VERSION, password_policy}; use crate::data::config::conf; #[derive(Serialize)] @@ -37,10 +37,13 @@ pub struct ServerConfig { android_direct_download_url: String, password_policy: PasswordPolicy, data_conservation_policy: DataConservationPolicy, + min_conversation_message_len: usize, max_conversation_message_len: usize, allowed_conversation_files_type: [&'static str; 17], conversation_files_max_size: usize, + conversation_writing_event_interval: u64, + conversation_writing_event_lifetime: u64, } impl ServerConfig { @@ -56,6 +59,8 @@ impl ServerConfig { max_conversation_message_len: MAX_CONVERSATION_MESSAGE_LENGTH, allowed_conversation_files_type: ALLOWED_CONVERSATION_FILES_TYPES, conversation_files_max_size: CONVERSATION_FILES_MAX_SIZE, + conversation_writing_event_interval: CONVERSATION_WRITING_EVENT_INTERVAL, + conversation_writing_event_lifetime: CONVERSATION_WRITING_EVENT_LIFETIME, password_policy: PasswordPolicy { allow_email_in_password: password_policy::ALLOW_EMAIL_IN_PASSWORD, diff --git a/src/constants.rs b/src/constants.rs index c4848de..b6d29a4 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -191,4 +191,10 @@ pub const ALLOWED_CONVERSATION_FILES_TYPES: [&str; 17] = [ ]; /// File maximum size in conversations (10 Mb) -pub const CONVERSATION_FILES_MAX_SIZE: usize = 10 * 1024 * 1024; \ No newline at end of file +pub const CONVERSATION_FILES_MAX_SIZE: usize = 10 * 1024 * 1024; + +/// Minimum interval before notifying again that someone is writing +pub const CONVERSATION_WRITING_EVENT_INTERVAL: u64 = 1; + +/// Lifetime of conversation writing event +pub const CONVERSATION_WRITING_EVENT_LIFETIME: u64 = 3; \ No newline at end of file