From cf1866af69f6bd8a86ad8569a333620cd5008145 Mon Sep 17 00:00:00 2001 From: Philipp Hofer Date: Sat, 9 Aug 2025 17:26:22 +0200 Subject: [PATCH] don't be too restrictive w/ blocking names --- bad/merged_output.txt | 18 ------------------ src/main.rs | 21 +++++---------------- 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/bad/merged_output.txt b/bad/merged_output.txt index 615d82a..b39f334 100644 --- a/bad/merged_output.txt +++ b/bad/merged_output.txt @@ -1,19 +1,3 @@ -🤩🍆💦 -​🖕​🤬​🖕​ -✊🍆 -✊🍆💦 -✊🍌 -✊🍌💦 -🍆🍑💦 -🍆👅💦 -🍆👋💦 -🍆💦 -🐓💍 -👉🌮 -👉👌 -👌👈 -👐🍅🍅 -🖕 @$$ 1m1j 1 man 1 jar @@ -528,7 +512,6 @@ chonkies chonky chonkys chraa -christ christ killer christ killers chug @@ -1571,7 +1554,6 @@ jerk-off jerkoff jerries jerry -jesus jesus christ jewboy jewed diff --git a/src/main.rs b/src/main.rs index 096bf6a..93de58d 100644 --- a/src/main.rs +++ b/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> = 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()