Major improvement, security handling, file handling +fixes

This commit is contained in:
unknown
2026-05-23 00:13:56 +02:00
parent 2129081599
commit a7b44af91a
25 changed files with 925 additions and 116 deletions

View File

@@ -16,12 +16,18 @@ pub struct Config {
pub frontend: FrontendConfig,
#[serde(default = "default_db_path")]
pub database_path: String,
#[serde(default = "default_uname_changes_path")]
pub uname_changes_path: String,
}
fn default_db_path() -> String {
"data/db.sqlite".to_string()
}
fn default_uname_changes_path() -> String {
"data/uname_changes.json".to_string()
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ContentConfig {
pub keep_content: bool,
@@ -60,6 +66,12 @@ pub struct TelegramConfig {
pub struct GroupsConfig {
pub admin_group_ids: Vec<i64>,
pub review_group_ids: Vec<i64>,
#[serde(default = "default_global_ban")]
pub global_ban: bool,
}
fn default_global_ban() -> bool {
false
}
#[derive(Debug, Clone, Deserialize, Serialize)]
@@ -197,6 +209,9 @@ impl Config {
));
}
// global_ban is always present (bool with default), no further validation needed
let _ = self.groups.global_ban;
match &self.crypto.aes_master_key_source {
KeySource::File { path } if path.as_os_str().is_empty() => {
return Err(cgcx_core::CgcxError::Config(