pleroma groups!!!!!! try it ->
https://piggo.space/hob
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.3 KiB
61 lines
2.3 KiB
use crate::store::DEFAULT_LOCALE_NAME;
|
|
use crate::tr::TranslationTable;
|
|
use std::collections::HashMap;
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(default, deny_unknown_fields)]
|
|
pub struct CommonConfig {
|
|
pub groups_dir: String,
|
|
pub locales_dir: String,
|
|
pub validate_locales: bool,
|
|
/// Max number of missed notifs to process after connect
|
|
pub max_catchup_notifs: usize,
|
|
/// Max number of missed statuses to process after connect
|
|
pub max_catchup_statuses: usize,
|
|
/// Delay between fetched pages when catching up
|
|
pub delay_fetch_page_s: f64,
|
|
/// Delay after sending a status, making a follow or some other action.
|
|
/// Set if there are Throttled errors and you need to slow the service down.
|
|
pub delay_after_post_s: f64,
|
|
/// Delay before trying to re-connect after the server closed the socket
|
|
pub delay_reopen_closed_s: f64,
|
|
/// Delay before trying to re-connect after an error
|
|
pub delay_reopen_error_s: f64,
|
|
/// Timeout for a notification/timeline socket to be considered alive.
|
|
/// If nothing arrives in this interval, reopen it. Some servers have a buggy socket
|
|
/// implementation where it stays open but no longer works.
|
|
pub socket_alive_timeout_s: f64,
|
|
/// Time after which a socket is always closed, even if seemingly alive.
|
|
/// This is a work-around for servers that stop sending notifs after a while.
|
|
pub socket_retire_time_s: f64,
|
|
#[serde(skip)]
|
|
pub tr: HashMap<String, TranslationTable>,
|
|
}
|
|
|
|
impl Default for CommonConfig {
|
|
fn default() -> Self {
|
|
Self {
|
|
groups_dir: "groups".to_string(),
|
|
locales_dir: "locales".to_string(),
|
|
validate_locales: true,
|
|
max_catchup_notifs: 30,
|
|
max_catchup_statuses: 50,
|
|
delay_fetch_page_s: 0.25,
|
|
delay_after_post_s: 0.0,
|
|
delay_reopen_closed_s: 0.5,
|
|
delay_reopen_error_s: 5.0,
|
|
socket_alive_timeout_s: 30.0,
|
|
socket_retire_time_s: 120.0,
|
|
tr: Default::default(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl CommonConfig {
|
|
pub fn tr(&self, lang: &str) -> &TranslationTable {
|
|
match self.tr.get(lang) {
|
|
Some(tr) => tr,
|
|
None => self.tr.get(DEFAULT_LOCALE_NAME).expect("default locale is not loaded"),
|
|
}
|
|
}
|
|
}
|
|
|