mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-13 02:55:39 +00:00
feat: migrate record_stats to use db_*
This commit is contained in:
@@ -24,7 +24,7 @@ use libmcaptcha::{
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::errors::*;
|
||||
use crate::stats::record::record_fetch;
|
||||
//use crate::stats::record::record_fetch;
|
||||
use crate::AppData;
|
||||
use crate::V1_API_ROUTES;
|
||||
|
||||
@@ -49,7 +49,7 @@ pub async fn get_config(
|
||||
|
||||
match data.captcha.get_pow(payload.key.clone()).await {
|
||||
Ok(Some(config)) => {
|
||||
record_fetch(&payload.key, &data.db).await;
|
||||
data.stats.record_fetch(&data, &payload.key).await;
|
||||
Ok(HttpResponse::Ok().json(config))
|
||||
}
|
||||
Ok(None) => {
|
||||
@@ -61,7 +61,7 @@ pub async fn get_config(
|
||||
.expect("mcaptcha should be initialized and ready to go");
|
||||
// background it. would require data::Data to be static
|
||||
// to satidfy lifetime
|
||||
record_fetch(&payload.key, &data.db).await;
|
||||
data.stats.record_fetch(&data, &payload.key).await;
|
||||
Ok(HttpResponse::Ok().json(config))
|
||||
}
|
||||
Err(e) => Err(e.into()),
|
||||
|
||||
Reference in New Issue
Block a user