add: ability to ban strings/characters through server config
This commit is contained in:
parent
701ea79c9a
commit
c9983b8dcb
3 changed files with 48 additions and 0 deletions
|
@ -211,6 +211,20 @@ impl Default for ManualsConfig {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
|
||||
pub enum StringBan {
|
||||
/// An exact string.
|
||||
String(String),
|
||||
/// A unicode codepoint.
|
||||
Unicode(u32),
|
||||
}
|
||||
|
||||
impl Default for StringBan {
|
||||
fn default() -> Self {
|
||||
Self::String(String::new())
|
||||
}
|
||||
}
|
||||
|
||||
/// Configuration file
|
||||
#[derive(Clone, Serialize, Deserialize, Debug)]
|
||||
pub struct Config {
|
||||
|
@ -277,6 +291,9 @@ pub struct Config {
|
|||
/// The relative paths to manuals.
|
||||
#[serde(default)]
|
||||
pub manuals: ManualsConfig,
|
||||
/// A list of banned content in posts.
|
||||
#[serde(default)]
|
||||
pub banned_data: Vec<StringBan>,
|
||||
}
|
||||
|
||||
fn default_name() -> String {
|
||||
|
@ -353,6 +370,10 @@ fn default_manuals() -> ManualsConfig {
|
|||
ManualsConfig::default()
|
||||
}
|
||||
|
||||
fn default_banned_data() -> Vec<StringBan> {
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
|
@ -374,6 +395,7 @@ impl Default for Config {
|
|||
html_footer_path: String::new(),
|
||||
stripe: None,
|
||||
manuals: default_manuals(),
|
||||
banned_data: default_banned_data(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue