@ -1,4 +1,7 @@
use utils::{error::{Error, Result}, is_human};
use utils::{
error::{Error, Result},
is_human,
};
use actix_web::{get, http::header, App, HttpRequest, HttpResponse, HttpServer, Responder};
use clap::Parser;
@ -11,7 +11,9 @@ pub type Result<T> = std::result::Result<T, Error>;
pub enum Error {
Reqwest(reqwest::Error),
#[cfg(feature = "nothuman")]
NotHuman { target: String },
NotHuman {
target: String,
},
}
impl Display for Error {
@ -45,4 +47,3 @@ impl ResponseError for Error {
})
@ -12,10 +12,6 @@ pub fn is_human(request: &HttpRequest) -> bool {
.headers()
.get(header::USER_AGENT)
.and_then(|header| header.to_str().ok())
.map(|ua| {
HUMANS
.iter()
.any(|&human| ua.contains(human))
.map(|ua| HUMANS.iter().any(|&human| ua.contains(human)))
.unwrap_or(false)