|
|
@@ -1,5 +1,6 @@
|
|
|
use actix_web::{HttpResponse, web, post};
|
|
|
use serde::Serialize;
|
|
|
+use serde_json::json;
|
|
|
use sqlx::{PgPool, types::Uuid};
|
|
|
use crate::{
|
|
|
app_error::AppError
|
|
|
@@ -19,5 +20,21 @@ pub async fn route(
|
|
|
db: web::Data<PgPool>,
|
|
|
body: web::Json<Body>
|
|
|
) -> Result<HttpResponse, AppError> {
|
|
|
-
|
|
|
+ let email = body.email.to_lowercase();
|
|
|
+ if is_bot(&body.url, &body.time) {
|
|
|
+ return Ok(HttpResponse::Ok().json(json!("success": true))));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+fn is_bot(url: &Option<String>, time: &Option<String>) -> bool {
|
|
|
+ match url {
|
|
|
+ Some(u) => {
|
|
|
+ if url != "https://" {return true}
|
|
|
+ },
|
|
|
+ None => {return true}
|
|
|
+ }
|
|
|
+
|
|
|
+ match time {
|
|
|
+ Some(t) => match DateTime::
|
|
|
+ }
|
|
|
}
|