add: audit log, reports

add: theme preference setting
This commit is contained in:
trisua 2025-04-02 11:39:51 -04:00
parent b2df2739a7
commit d3d0c41334
38 changed files with 925 additions and 169 deletions
crates/core/src/model

View file

@ -25,6 +25,19 @@ pub struct User {
pub following_count: usize,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum ThemePreference {
Auto,
Dark,
Light,
}
impl Default for ThemePreference {
fn default() -> Self {
Self::Auto
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct UserSettings {
#[serde(default)]
@ -35,6 +48,8 @@ pub struct UserSettings {
pub private_profile: bool,
#[serde(default)]
pub private_communities: bool,
#[serde(default)]
pub theme_preference: ThemePreference,
}
impl Default for UserSettings {
@ -44,6 +59,7 @@ impl Default for UserSettings {
biography: String::new(),
private_profile: false,
private_communities: false,
theme_preference: ThemePreference::default(),
}
}
}
@ -88,6 +104,15 @@ impl User {
}
}
/// Banned user profile.
pub fn banned() -> Self {
Self {
username: "<banned>".to_string(),
id: 0,
..Default::default()
}
}
/// Create a new token
///
/// # Returns