mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-12 02:25:41 +00:00
captcha stats
This commit is contained in:
@@ -22,7 +22,10 @@ use super::auth::Password;
|
||||
use crate::errors::*;
|
||||
use crate::Data;
|
||||
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.account.delete", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::post(
|
||||
path = "crate::V1_API_ROUTES.account.delete",
|
||||
wrap = "crate::CheckLogin"
|
||||
)]
|
||||
async fn delete_account(
|
||||
id: Identity,
|
||||
payload: web::Json<Password>,
|
||||
@@ -61,13 +64,13 @@ async fn delete_account(
|
||||
|
||||
pub fn services(cfg: &mut actix_web::web::ServiceConfig) {
|
||||
cfg.service(delete_account);
|
||||
// use crate::define_resource;
|
||||
// use crate::V1_API_ROUTES;
|
||||
//
|
||||
// define_resource!(
|
||||
// cfg,
|
||||
// V1_API_ROUTES.account.delete,
|
||||
// Methods::ProtectPost,
|
||||
// delete_account
|
||||
// );
|
||||
// use crate::define_resource;
|
||||
// use crate::V1_API_ROUTES;
|
||||
//
|
||||
// define_resource!(
|
||||
// cfg,
|
||||
// V1_API_ROUTES.account.delete,
|
||||
// Methods::ProtectPost,
|
||||
// delete_account
|
||||
// );
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ pub struct Email {
|
||||
pub email: String,
|
||||
}
|
||||
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.account.email_exists")]
|
||||
#[my_codegen::post(path = "crate::V1_API_ROUTES.account.email_exists")]
|
||||
pub async fn email_exists(
|
||||
payload: web::Json<AccountCheckPayload>,
|
||||
data: web::Data<Data>,
|
||||
@@ -53,7 +53,10 @@ pub async fn email_exists(
|
||||
}
|
||||
|
||||
/// update email
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.account.update_email", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::post(
|
||||
path = "crate::V1_API_ROUTES.account.update_email",
|
||||
wrap = "crate::CheckLogin"
|
||||
)]
|
||||
async fn set_email(
|
||||
id: Identity,
|
||||
payload: web::Json<Email>,
|
||||
@@ -88,20 +91,20 @@ async fn set_email(
|
||||
pub fn services(cfg: &mut actix_web::web::ServiceConfig) {
|
||||
cfg.service(email_exists);
|
||||
cfg.service(set_email);
|
||||
// use crate::define_resource;
|
||||
// use crate::V1_API_ROUTES;
|
||||
//
|
||||
// define_resource!(
|
||||
// cfg,
|
||||
// V1_API_ROUTES.account.email_exists,
|
||||
// Methods::Post,
|
||||
// email_exists
|
||||
// );
|
||||
//
|
||||
// define_resource!(
|
||||
// cfg,
|
||||
// V1_API_ROUTES.account.update_email,
|
||||
// Methods::Post,
|
||||
// set_email
|
||||
// );
|
||||
// use crate::define_resource;
|
||||
// use crate::V1_API_ROUTES;
|
||||
//
|
||||
// define_resource!(
|
||||
// cfg,
|
||||
// V1_API_ROUTES.account.email_exists,
|
||||
// Methods::Post,
|
||||
// email_exists
|
||||
// );
|
||||
//
|
||||
// define_resource!(
|
||||
// cfg,
|
||||
// V1_API_ROUTES.account.update_email,
|
||||
// Methods::Post,
|
||||
// set_email
|
||||
// );
|
||||
}
|
||||
|
||||
@@ -29,7 +29,10 @@ pub struct Secret {
|
||||
pub secret: String,
|
||||
}
|
||||
|
||||
#[my_codegen::get(path="crate::V1_API_ROUTES.account.get_secret", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::get(
|
||||
path = "crate::V1_API_ROUTES.account.get_secret",
|
||||
wrap = "crate::CheckLogin"
|
||||
)]
|
||||
async fn get_secret(
|
||||
id: Identity,
|
||||
data: web::Data<Data>,
|
||||
@@ -47,7 +50,10 @@ async fn get_secret(
|
||||
Ok(HttpResponse::Ok().json(secret))
|
||||
}
|
||||
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.account.update_secret", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::post(
|
||||
path = "crate::V1_API_ROUTES.account.update_secret",
|
||||
wrap = "crate::CheckLogin"
|
||||
)]
|
||||
async fn update_user_secret(
|
||||
id: Identity,
|
||||
data: web::Data<Data>,
|
||||
|
||||
@@ -20,7 +20,7 @@ use super::{AccountCheckPayload, AccountCheckResp};
|
||||
use crate::errors::*;
|
||||
use crate::Data;
|
||||
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.account.username_exists")]
|
||||
#[my_codegen::post(path = "crate::V1_API_ROUTES.account.username_exists")]
|
||||
async fn username_exists(
|
||||
payload: web::Json<AccountCheckPayload>,
|
||||
data: web::Data<Data>,
|
||||
|
||||
@@ -48,16 +48,15 @@ pub mod routes {
|
||||
}
|
||||
|
||||
pub fn services(cfg: &mut web::ServiceConfig) {
|
||||
|
||||
// protect_get!(cfg, V1_API_ROUTES.auth.logout, signout);
|
||||
// protect_get!(cfg, V1_API_ROUTES.auth.logout, signout);
|
||||
|
||||
cfg.service(signup);
|
||||
cfg.service(signin);
|
||||
cfg.service(signout);
|
||||
|
||||
// define_resource!(cfg, V1_API_ROUTES.auth.register, Methods::Post, signup);
|
||||
// define_resource!(cfg, V1_API_ROUTES.auth.logout, Methods::ProtectGet, signout);
|
||||
// define_resource!(cfg, V1_API_ROUTES.auth.login, Methods::Post, signin);
|
||||
// define_resource!(cfg, V1_API_ROUTES.auth.register, Methods::Post, signup);
|
||||
// define_resource!(cfg, V1_API_ROUTES.auth.logout, Methods::ProtectGet, signout);
|
||||
// define_resource!(cfg, V1_API_ROUTES.auth.login, Methods::Post, signin);
|
||||
//post!(cfg, V1_API_ROUTES.auth.login, signin);
|
||||
}
|
||||
|
||||
@@ -80,7 +79,7 @@ pub struct Password {
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.auth.register")]
|
||||
#[my_codegen::post(path = "crate::V1_API_ROUTES.auth.register")]
|
||||
async fn signup(
|
||||
payload: web::Json<Register>,
|
||||
data: web::Data<Data>,
|
||||
@@ -126,7 +125,8 @@ async fn signup(
|
||||
.execute(&data.db)
|
||||
.await;
|
||||
}
|
||||
if res.is_ok() { break;
|
||||
if res.is_ok() {
|
||||
break;
|
||||
} else {
|
||||
if let Err(sqlx::Error::Database(err)) = res {
|
||||
if err.code() == Some(Cow::from("23505")) {
|
||||
@@ -147,7 +147,7 @@ async fn signup(
|
||||
Ok(HttpResponse::Ok())
|
||||
}
|
||||
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.auth.login")]
|
||||
#[my_codegen::post(path = "crate::V1_API_ROUTES.auth.login")]
|
||||
async fn signin(
|
||||
id: Identity,
|
||||
payload: web::Json<Login>,
|
||||
@@ -179,7 +179,7 @@ async fn signin(
|
||||
}
|
||||
}
|
||||
|
||||
#[my_codegen::get(path="crate::V1_API_ROUTES.auth.logout", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::get(path = "crate::V1_API_ROUTES.auth.logout", wrap = "crate::CheckLogin")]
|
||||
async fn signout(id: Identity) -> impl Responder {
|
||||
if let Some(_) = id.identity() {
|
||||
id.forget();
|
||||
|
||||
@@ -44,7 +44,10 @@ pub struct UpdateDuration {
|
||||
pub duration: i32,
|
||||
}
|
||||
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.duration.update", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::post(
|
||||
path = "crate::V1_API_ROUTES.duration.update",
|
||||
wrap = "crate::CheckLogin"
|
||||
)]
|
||||
async fn update_duration(
|
||||
payload: web::Json<UpdateDuration>,
|
||||
data: web::Data<Data>,
|
||||
@@ -82,7 +85,10 @@ pub struct GetDuration {
|
||||
pub token: String,
|
||||
}
|
||||
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.duration.get", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::post(
|
||||
path = "crate::V1_API_ROUTES.duration.get",
|
||||
wrap = "crate::CheckLogin"
|
||||
)]
|
||||
async fn get_duration(
|
||||
payload: web::Json<MCaptchaDetails>,
|
||||
data: web::Data<Data>,
|
||||
@@ -105,21 +111,21 @@ async fn get_duration(
|
||||
pub fn services(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(get_duration);
|
||||
cfg.service(update_duration);
|
||||
// use crate::define_resource;
|
||||
// use crate::V1_API_ROUTES;
|
||||
//
|
||||
// define_resource!(
|
||||
// cfg,
|
||||
// V1_API_ROUTES.duration.get,
|
||||
// Methods::ProtectPost,
|
||||
// get_duration
|
||||
// );
|
||||
// define_resource!(
|
||||
// cfg,
|
||||
// V1_API_ROUTES.duration.update,
|
||||
// Methods::ProtectPost,
|
||||
// update_duration
|
||||
// );
|
||||
// use crate::define_resource;
|
||||
// use crate::V1_API_ROUTES;
|
||||
//
|
||||
// define_resource!(
|
||||
// cfg,
|
||||
// V1_API_ROUTES.duration.get,
|
||||
// Methods::ProtectPost,
|
||||
// get_duration
|
||||
// );
|
||||
// define_resource!(
|
||||
// cfg,
|
||||
// V1_API_ROUTES.duration.update,
|
||||
// Methods::ProtectPost,
|
||||
// update_duration
|
||||
// );
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -67,7 +67,7 @@ pub fn services(cfg: &mut web::ServiceConfig) {
|
||||
|
||||
// TODO redo mcaptcha table to include levels as json field
|
||||
// so that the whole thing can be added/udpaed in a single stroke
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.levels.add", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::post(path = "crate::V1_API_ROUTES.levels.add", wrap = "crate::CheckLogin")]
|
||||
async fn add_levels(
|
||||
payload: web::Json<AddLevels>,
|
||||
data: web::Data<Data>,
|
||||
@@ -120,7 +120,10 @@ pub struct UpdateLevels {
|
||||
pub key: String,
|
||||
}
|
||||
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.levels.update", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::post(
|
||||
path = "crate::V1_API_ROUTES.levels.update",
|
||||
wrap = "crate::CheckLogin"
|
||||
)]
|
||||
async fn update_levels(
|
||||
payload: web::Json<UpdateLevels>,
|
||||
data: web::Data<Data>,
|
||||
@@ -178,7 +181,10 @@ async fn update_levels(
|
||||
Ok(HttpResponse::Ok())
|
||||
}
|
||||
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.levels.delete", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::post(
|
||||
path = "crate::V1_API_ROUTES.levels.delete",
|
||||
wrap = "crate::CheckLogin"
|
||||
)]
|
||||
async fn delete_levels(
|
||||
payload: web::Json<UpdateLevels>,
|
||||
data: web::Data<Data>,
|
||||
@@ -205,7 +211,7 @@ async fn delete_levels(
|
||||
Ok(HttpResponse::Ok())
|
||||
}
|
||||
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.levels.get", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::post(path = "crate::V1_API_ROUTES.levels.get", wrap = "crate::CheckLogin")]
|
||||
async fn get_levels(
|
||||
payload: web::Json<MCaptchaDetails>,
|
||||
data: web::Data<Data>,
|
||||
|
||||
@@ -111,7 +111,10 @@ pub async fn add_mcaptcha_util(
|
||||
Ok(resp)
|
||||
}
|
||||
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.mcaptcha.update_key", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::post(
|
||||
path = "crate::V1_API_ROUTES.mcaptcha.update_key",
|
||||
wrap = "crate::CheckLogin"
|
||||
)]
|
||||
async fn update_token(
|
||||
payload: web::Json<MCaptchaDetails>,
|
||||
data: web::Data<Data>,
|
||||
@@ -162,7 +165,10 @@ async fn update_token_helper(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.mcaptcha.get_token", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::post(
|
||||
path = "crate::V1_API_ROUTES.mcaptcha.get_token",
|
||||
wrap = "crate::CheckLogin"
|
||||
)]
|
||||
async fn get_token(
|
||||
payload: web::Json<MCaptchaDetails>,
|
||||
data: web::Data<Data>,
|
||||
@@ -190,7 +196,10 @@ async fn get_token(
|
||||
Ok(HttpResponse::Ok().json(res))
|
||||
}
|
||||
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.mcaptcha.delete", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::post(
|
||||
path = "crate::V1_API_ROUTES.mcaptcha.delete",
|
||||
wrap = "crate::CheckLogin"
|
||||
)]
|
||||
async fn delete_mcaptcha(
|
||||
payload: web::Json<MCaptchaDetails>,
|
||||
data: web::Data<Data>,
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
pub mod duration;
|
||||
pub mod levels;
|
||||
pub mod mcaptcha;
|
||||
pub mod stats;
|
||||
|
||||
pub fn get_random(len: usize) -> String {
|
||||
use std::iter;
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use sqlx::PgPool;
|
||||
|
||||
/// record PoWConfig fetches
|
||||
#[inline]
|
||||
pub async fn record_fetch(key: &str, db: &PgPool) {
|
||||
let _ = sqlx::query!(
|
||||
"INSERT INTO mcaptcha_pow_fetched_stats
|
||||
(config_id) VALUES ((SELECT config_id FROM mcaptcha_config WHERE key = $1))",
|
||||
&key,
|
||||
)
|
||||
.execute(db)
|
||||
.await;
|
||||
}
|
||||
|
||||
/// record PoWConfig solves
|
||||
#[inline]
|
||||
pub async fn record_solve(key: &str, db: &PgPool) {
|
||||
let _ = sqlx::query!(
|
||||
"INSERT INTO mcaptcha_pow_solved_stats
|
||||
(config_id) VALUES ((SELECT config_id FROM mcaptcha_config WHERE key = $1))",
|
||||
&key,
|
||||
)
|
||||
.execute(db)
|
||||
.await;
|
||||
}
|
||||
|
||||
/// record PoWConfig confirms
|
||||
#[inline]
|
||||
pub async fn record_confirm(key: &str, db: &PgPool) {
|
||||
let _ = sqlx::query!(
|
||||
"INSERT INTO mcaptcha_pow_confirmed_stats
|
||||
(config_id) VALUES ((SELECT config_id FROM mcaptcha_config WHERE key = $1))",
|
||||
&key,
|
||||
)
|
||||
.execute(db)
|
||||
.await;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ pub mod routes {
|
||||
}
|
||||
|
||||
/// emmits build details of the bninary
|
||||
#[my_codegen::get(path="crate::V1_API_ROUTES.meta.build_details")]
|
||||
#[my_codegen::get(path = "crate::V1_API_ROUTES.meta.build_details")]
|
||||
async fn build_details() -> impl Responder {
|
||||
let build = BuildDetails {
|
||||
version: VERSION,
|
||||
@@ -61,7 +61,7 @@ pub struct Health {
|
||||
}
|
||||
|
||||
/// checks all components of the system
|
||||
#[my_codegen::get(path="crate::V1_API_ROUTES.meta.health")]
|
||||
#[my_codegen::get(path = "crate::V1_API_ROUTES.meta.health")]
|
||||
async fn health(data: web::Data<Data>) -> impl Responder {
|
||||
use sqlx::Connection;
|
||||
|
||||
|
||||
@@ -30,7 +30,10 @@ pub struct AddNotification {
|
||||
}
|
||||
|
||||
/// route handler that adds a notification message
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.notifications.add", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::post(
|
||||
path = "crate::V1_API_ROUTES.notifications.add",
|
||||
wrap = "crate::CheckLogin"
|
||||
)]
|
||||
pub async fn add_notification(
|
||||
payload: web::Json<AddNotification>,
|
||||
data: web::Data<Data>,
|
||||
|
||||
@@ -52,7 +52,10 @@ impl From<Notification> for NotificationResp {
|
||||
}
|
||||
}
|
||||
/// route handler that gets all unread notifications
|
||||
#[my_codegen::get(path="crate::V1_API_ROUTES.notifications.get", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::get(
|
||||
path = "crate::V1_API_ROUTES.notifications.get",
|
||||
wrap = "crate::CheckLogin"
|
||||
)]
|
||||
pub async fn get_notification(
|
||||
data: web::Data<Data>,
|
||||
id: Identity,
|
||||
|
||||
@@ -37,7 +37,10 @@ pub struct NotificationResp {
|
||||
}
|
||||
|
||||
/// route handler that marks a notification read
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.notifications.mark_read", wrap="crate::CheckLogin")]
|
||||
#[my_codegen::post(
|
||||
path = "crate::V1_API_ROUTES.notifications.mark_read",
|
||||
wrap = "crate::CheckLogin"
|
||||
)]
|
||||
pub async fn mark_read(
|
||||
data: web::Data<Data>,
|
||||
payload: web::Json<MarkReadReq>,
|
||||
@@ -68,7 +71,6 @@ mod tests {
|
||||
use crate::tests::*;
|
||||
use crate::*;
|
||||
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn notification_mark_read_works() {
|
||||
const NAME1: &str = "notifuser122";
|
||||
@@ -125,7 +127,6 @@ mod tests {
|
||||
assert_eq!(notification.message, MESSAGE);
|
||||
assert_eq!(notification.heading, HEADING);
|
||||
|
||||
|
||||
let mark_read_payload = MarkReadReq {
|
||||
id: notification.id.clone(),
|
||||
};
|
||||
@@ -138,7 +139,6 @@ mod tests {
|
||||
.await;
|
||||
assert_eq!(mark_read_resp.status(), StatusCode::OK);
|
||||
|
||||
|
||||
let get_notifications_resp = test::call_service(
|
||||
&mut app,
|
||||
test::TestRequest::get()
|
||||
@@ -151,6 +151,5 @@ mod tests {
|
||||
let mut notifications: Vec<NotificationResp> =
|
||||
test::read_body_json(get_notifications_resp).await;
|
||||
assert!(notifications.pop().is_none());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ use m_captcha::{
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::record_fetch;
|
||||
use super::GetDurationResp;
|
||||
use super::I32Levels;
|
||||
use crate::errors::*;
|
||||
use crate::stats::record::record_fetch;
|
||||
use crate::Data;
|
||||
use crate::V1_API_ROUTES;
|
||||
|
||||
@@ -43,7 +43,9 @@ pub struct GetConfigPayload {
|
||||
// API keys are mcaptcha actor names
|
||||
|
||||
/// get PoW configuration for an mcaptcha key
|
||||
#[my_codegen::post(path = "V1_API_ROUTES.pow.get_config.strip_prefix(V1_API_ROUTES.pow.scope).unwrap()")]
|
||||
#[my_codegen::post(
|
||||
path = "V1_API_ROUTES.pow.get_config.strip_prefix(V1_API_ROUTES.pow.scope).unwrap()"
|
||||
)]
|
||||
pub async fn get_config(
|
||||
payload: web::Json<GetConfigPayload>,
|
||||
data: web::Data<Data>,
|
||||
@@ -82,7 +84,6 @@ pub async fn get_config(
|
||||
Some(false) => Err(ServiceError::TokenNotFound),
|
||||
None => Err(ServiceError::TokenNotFound),
|
||||
}
|
||||
|
||||
}
|
||||
/// Call this when [MCaptcha][m_captcha::MCaptcha] is not in master.
|
||||
///
|
||||
|
||||
@@ -24,7 +24,6 @@ pub mod verify_token;
|
||||
|
||||
pub use super::mcaptcha::duration::GetDurationResp;
|
||||
pub use super::mcaptcha::levels::I32Levels;
|
||||
use crate::api::v1::mcaptcha::stats::*;
|
||||
|
||||
pub fn services(cfg: &mut web::ServiceConfig) {
|
||||
let cors = actix_cors::Cors::default()
|
||||
|
||||
@@ -20,8 +20,8 @@ use actix_web::{web, HttpResponse, Responder};
|
||||
use m_captcha::pow::Work;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::record_solve;
|
||||
use crate::errors::*;
|
||||
use crate::stats::record::record_solve;
|
||||
use crate::Data;
|
||||
use crate::V1_API_ROUTES;
|
||||
|
||||
@@ -36,7 +36,9 @@ pub struct ValidationToken {
|
||||
|
||||
/// route handler that verifies PoW and issues a solution token
|
||||
/// if verification is successful
|
||||
#[my_codegen::post(path = "V1_API_ROUTES.pow.verify_pow.strip_prefix(V1_API_ROUTES.pow.scope).unwrap()")]
|
||||
#[my_codegen::post(
|
||||
path = "V1_API_ROUTES.pow.verify_pow.strip_prefix(V1_API_ROUTES.pow.scope).unwrap()"
|
||||
)]
|
||||
pub async fn verify_pow(
|
||||
payload: web::Json<Work>,
|
||||
data: web::Data<Data>,
|
||||
|
||||
@@ -20,8 +20,8 @@ use actix_web::{web, HttpResponse, Responder};
|
||||
use m_captcha::cache::messages::VerifyCaptchaResult;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::record_confirm;
|
||||
use crate::errors::*;
|
||||
use crate::stats::record::record_confirm;
|
||||
use crate::Data;
|
||||
use crate::V1_API_ROUTES;
|
||||
|
||||
@@ -33,7 +33,9 @@ pub struct CaptchaValidateResp {
|
||||
// API keys are mcaptcha actor names
|
||||
|
||||
/// route hander that validates a PoW solution token
|
||||
#[my_codegen::post(path = "V1_API_ROUTES.pow.validate_captcha_token.strip_prefix(V1_API_ROUTES.pow.scope).unwrap()")]
|
||||
#[my_codegen::post(
|
||||
path = "V1_API_ROUTES.pow.validate_captcha_token.strip_prefix(V1_API_ROUTES.pow.scope).unwrap()"
|
||||
)]
|
||||
pub async fn validate_captcha_token(
|
||||
payload: web::Json<VerifyCaptchaResult>,
|
||||
data: web::Data<Data>,
|
||||
|
||||
Reference in New Issue
Block a user