yuurei/src/defaults.rs

48 lines
1.5 KiB

use crate::mnemonic::MnemonicSaltKind;
/// Default anonymous name
pub const ANON_NAME: &'static str = "名無し";
/// Max length of `name` and `email` feilds in posts.
pub const POST_ID_MAX_LEN: usize = 32;
4 years ago
/// The salt to use for tripcode hashes
pub const TRIPCODE_SALT: khash::salt::Salt = khash::salt::Salt::internal();
/// The tripcode algorithm to use
pub const TRIPCODE_ALGO: khash::ctx::Algorithm = khash::ctx::Algorithm::Sha256Truncated;
4 years ago
/// What timezone to represent data in.
pub type Timezone = chrono::offset::Utc;
/// Default post expiry duration (120 days)
///
/// # Notes
/// This is specified as a std `Duration`, the chrono `Duration` calculated from the post's offset must be converted into this type to be used for anything.
/// This conversion can fail.
/// If it does fail, then the post should just be treated as expired.
pub const POST_EXPIRE: tokio::time::Duration = tokio::time::Duration::from_secs(
60 // Minute
* 60 // Hour
* 24 // Day
* 120
);
/// Max size of encrypted body
pub const POST_BODY_MAX_SIZE: usize = (1024 * 1024) * 20; // 20MB
/// What encoded PEM formats are recognised
pub const RECOGNISABLE_PEM_ENCODES: &'static [&'static str] = &[
"PUBLIC KEY",
"RSA PUBLIC KEY",
];
/// Size of the menmonic salt
pub const MNEMONIC_SALT_SIZE: usize = 16;
/// Mnemonic salt to use
pub const MNEMONIC_SALT: MnemonicSaltKind = MnemonicSaltKind::Random;
/// Max state image read size
///
/// Set to `0` for unlimited.
pub const MAX_IMAGE_READ_SIZE: usize = (1024 * 1024 * 1024) * 3; // 3GB