don't be too restrictive w/ blocking names
This commit is contained in:
21
src/main.rs
21
src/main.rs
@@ -1,8 +1,8 @@
|
||||
use crate::model::client::Client;
|
||||
use axum::{Router, http::HeaderMap, routing::get};
|
||||
use axum_extra::extract::{CookieJar, cookie::Cookie};
|
||||
use axum::{http::HeaderMap, routing::get, Router};
|
||||
use axum_extra::extract::{cookie::Cookie, CookieJar};
|
||||
use axum_messages::MessagesManagerLayer;
|
||||
use sqlx::{SqlitePool, pool::PoolOptions, sqlite::SqliteConnectOptions};
|
||||
use sqlx::{pool::PoolOptions, sqlite::SqliteConnectOptions, SqlitePool};
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
fmt::Display,
|
||||
@@ -87,23 +87,12 @@ static BAD_WORDS: LazyLock<HashSet<String>> = LazyLock::new(|| {
|
||||
BAD_WORDS_FILE
|
||||
.lines()
|
||||
.map(|line| line.trim())
|
||||
.filter(|line| !line.is_empty() && !line.starts_with('#')) // Skip empty lines and comments
|
||||
.map(|word| {
|
||||
word.to_lowercase()
|
||||
.chars()
|
||||
.filter(|c| c.is_alphabetic())
|
||||
.collect()
|
||||
})
|
||||
.filter(|word: &String| !word.is_empty())
|
||||
.map(|word| word.to_lowercase())
|
||||
.collect()
|
||||
});
|
||||
|
||||
fn contains_bad_word(text: &str) -> bool {
|
||||
let cleaned_text: String = text
|
||||
.to_lowercase()
|
||||
.chars()
|
||||
.filter(|c| c.is_alphabetic())
|
||||
.collect();
|
||||
let cleaned_text: String = text.to_lowercase();
|
||||
|
||||
BAD_WORDS
|
||||
.iter()
|
||||
|
Reference in New Issue
Block a user