Tento commit je obsažen v:
sneedmaster 2024-03-04 08:00:04 +00:00
rodič 6071c257b9
revize 7c01c70b4d

Zobrazit soubor

@ -322,13 +322,15 @@ pub async fn check_spam(
return Err(NekrochanError::FloodError); return Err(NekrochanError::FloodError);
} }
let last_thread: i64 = ctx.cache().get(format!("last_thread:{ip}")).await?; let last_thread: Option<i64> = ctx.cache().get(format!("last_thread:{ip}")).await?;
let since_last_thread = Utc::now().timestamp_micros() - last_thread; if let Some(last_thread) = last_thread {
let since_last_thread = Duration::microseconds(since_last_thread); let since_last_thread = Utc::now().timestamp_micros() - last_thread;
let since_last_thread = Duration::microseconds(since_last_thread);
if since_last_thread.num_seconds() < board.config.thread_cooldown { if since_last_thread.num_seconds() < board.config.thread_cooldown {
return Err(NekrochanError::FloodError); return Err(NekrochanError::FloodError);
}
} }
Ok(()) Ok(())