mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-11-23 22:15:46 +00:00
feat: see publication status in sitekey view page
This commit is contained in:
parent
468752f691
commit
2ca49cffe4
@ -36,6 +36,7 @@ struct IndexPage {
|
|||||||
key: String,
|
key: String,
|
||||||
levels: Vec<Level>,
|
levels: Vec<Level>,
|
||||||
stats: CaptchaStats,
|
stats: CaptchaStats,
|
||||||
|
publish_benchmarks: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IndexPage {
|
impl IndexPage {
|
||||||
@ -44,6 +45,7 @@ impl IndexPage {
|
|||||||
config: Captcha,
|
config: Captcha,
|
||||||
levels: Vec<Level>,
|
levels: Vec<Level>,
|
||||||
key: String,
|
key: String,
|
||||||
|
publish_benchmarks: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
IndexPage {
|
IndexPage {
|
||||||
duration: config.duration as u32,
|
duration: config.duration as u32,
|
||||||
@ -51,6 +53,7 @@ impl IndexPage {
|
|||||||
levels,
|
levels,
|
||||||
key,
|
key,
|
||||||
stats,
|
stats,
|
||||||
|
publish_benchmarks,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,8 +73,9 @@ pub async fn view_sitekey(
|
|||||||
let config = data.db.get_captcha_config(&username, &key).await?;
|
let config = data.db.get_captcha_config(&username, &key).await?;
|
||||||
let levels = data.db.get_captcha_levels(Some(&username), &key).await?;
|
let levels = data.db.get_captcha_levels(Some(&username), &key).await?;
|
||||||
let stats = data.stats.fetch(&data, &username, &key).await?;
|
let stats = data.stats.fetch(&data, &username, &key).await?;
|
||||||
|
let publish_benchmarks = data.db.analytics_captcha_is_published(&key).await?;
|
||||||
|
|
||||||
let body = IndexPage::new(stats, config, levels, key)
|
let body = IndexPage::new(stats, config, levels, key, publish_benchmarks)
|
||||||
.render_once()
|
.render_once()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
Ok(HttpResponse::Ok()
|
Ok(HttpResponse::Ok()
|
||||||
|
|||||||
@ -19,7 +19,6 @@
|
|||||||
<label class="sitekey-form__level-label" for="difficulty<.= num .>">
|
<label class="sitekey-form__level-label" for="difficulty<.= num .>">
|
||||||
Difficulty
|
Difficulty
|
||||||
<input
|
<input
|
||||||
readonly="readonly"
|
|
||||||
type="number"
|
type="number"
|
||||||
id="difficulty<.= num .>"
|
id="difficulty<.= num .>"
|
||||||
class="sitekey-form__level-input"
|
class="sitekey-form__level-input"
|
||||||
|
|||||||
@ -23,6 +23,23 @@
|
|||||||
<. for (count, level) in levels.iter().enumerate() { .>
|
<. for (count, level) in levels.iter().enumerate() { .>
|
||||||
<. include!("./existing-level.html"); .>
|
<. include!("./existing-level.html"); .>
|
||||||
<. } .>
|
<. } .>
|
||||||
|
|
||||||
|
<label class="sitekey-form__label" for="publish_benchmarks">
|
||||||
|
Anonymously publish CAPTCHA performance statistics to help other webmasters
|
||||||
|
<input
|
||||||
|
class="sitekey-form__input"
|
||||||
|
type="checkbox"
|
||||||
|
id="publish_benchmarks"
|
||||||
|
readonly="readonly"
|
||||||
|
name="publish_benchmarks"
|
||||||
|
<. if publish_benchmarks { .>
|
||||||
|
checked
|
||||||
|
<. }.>
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<./* synchronise with "./__form-bottom.html" Lines below should break form */.>
|
<./* synchronise with "./__form-bottom.html" Lines below should break form */.>
|
||||||
</form>
|
</form>
|
||||||
<. include!("./stats.html"); .>
|
<. include!("./stats.html"); .>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user