mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 18:15:39 +00:00
feat: advance siteey create now allows setting publication status
This commit is contained in:
@@ -31,6 +31,7 @@ pub struct CreateCaptcha {
|
||||
pub levels: Vec<Level>,
|
||||
pub duration: u32,
|
||||
pub description: String,
|
||||
pub publish_benchmarks: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
@@ -52,6 +53,11 @@ pub async fn create(
|
||||
) -> ServiceResult<impl Responder> {
|
||||
let username = id.identity().unwrap();
|
||||
let mcaptcha_config = runner::create(&payload, &data, &username).await?;
|
||||
if payload.publish_benchmarks {
|
||||
data.db
|
||||
.analytics_create_psuedo_id_if_not_exists(&mcaptcha_config.key)
|
||||
.await?;
|
||||
}
|
||||
Ok(HttpResponse::Ok().json(mcaptcha_config))
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ pub async fn level_routes_work(data: ArcData) {
|
||||
levels: levels.clone(),
|
||||
description: add_level.description,
|
||||
duration: add_level.duration,
|
||||
publish_benchmarks: true,
|
||||
};
|
||||
|
||||
let add_token_resp = test::call_service(
|
||||
|
||||
@@ -250,6 +250,7 @@ pub mod tests {
|
||||
levels: levels.into(),
|
||||
duration: 30,
|
||||
description: "dummy".into(),
|
||||
publish_benchmarks: true,
|
||||
};
|
||||
|
||||
// 1. add level
|
||||
|
||||
@@ -262,5 +262,6 @@ pub fn get_level_data() -> CreateCaptcha {
|
||||
levels,
|
||||
duration: 30,
|
||||
description: "dummy".into(),
|
||||
publish_benchmarks: false,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user