From 52554a1dcd9101fff5bea67f883f2d1ebe57d8e4 Mon Sep 17 00:00:00 2001 From: Jakob L. Kreuze Date: Sat, 19 Nov 2022 12:26:21 -0500 Subject: [dynamic] Implement client-side of POW captcha --- haunt/jakob/dynamic/capabilities/comment-form.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'haunt/jakob/dynamic/capabilities/comment-form.scm') diff --git a/haunt/jakob/dynamic/capabilities/comment-form.scm b/haunt/jakob/dynamic/capabilities/comment-form.scm index 1754dfd..f1cbd9e 100644 --- a/haunt/jakob/dynamic/capabilities/comment-form.scm +++ b/haunt/jakob/dynamic/capabilities/comment-form.scm @@ -21,6 +21,7 @@ #:use-module (jakob dynamic captcha) #:use-module (jakob dynamic util) #:use-module (jakob theme) + #:use-module (jakob utils sxml) #:use-module (json) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) @@ -56,7 +57,12 @@ (img (@ (src ,(format #f "data:image/jpeg;charset=utf-8;base64,~a" (base64-encode captcha-image))))) (input (@ (type "text") (id "captcha") (name "captcha") (size 24))) - (input (@ (type "submit") (id "submit-form") (value "Submit"))))))))) + (button (@ (id "pow-trigger") (hidden #t)) + "Too hard? (Or unable to see the challenge?) Click here.") + (input (@ (type "text") (id "captcha-alt") (name "captcha-alt") (hidden #t))) + (input (@ (type "text") (id "captcha-alt-id") (name "captcha-alt-id") (hidden #t))) + (input (@ (type "submit") (id "submit-form") (value "Submit"))))) + ,(script "proof-of-work.js"))))) (define (get-comment-form request body) "API endpoint handler for querying for the comments on a particular post -- cgit v1.3