From 7092a1977d075001320470d81cc740d33409cc64 Mon Sep 17 00:00:00 2001 From: Jakob L. Kreuze Date: Sun, 20 Nov 2022 13:29:29 -0500 Subject: [dynamic] Initial dynamically-loaded comment form To curb constraints surrounding where and when dynamic content can appear, the comment form _embedded into the page for a blog post_ is dynamically loaded by some JavaScript code. This is the initial implementation of that. There are a few parts of this implementation that need to be improved: - Make it clear that the captcha is the only part that's being loaded by XHR. i.e., display the form with a "loading..." placeholder where the captcha image should be. - Have this triggered by the user, so the API doesn't get flooded with requests that aren't going to be completed. (The ratio of readers to commenters is likely to be very high.) --- haunt/api.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'haunt/api.scm') diff --git a/haunt/api.scm b/haunt/api.scm index 0103400..1d275f8 100644 --- a/haunt/api.scm +++ b/haunt/api.scm @@ -41,7 +41,8 @@ (log-append! 'info (format #f "~a ~a (~a) (~a)" method endpoint args originating-ip))) ((match (cons (request-method request) endpoint) (('GET "comment-form" _) get-comment-form) - ('(GET "challenge") make-pow-challenge!) + ('(GET "challenge" "proof-of-work") make-pow-challenge!) + ('(GET "challenge" "captcha") make-captcha-challenge!) ;; ('(GET "comments") get-comments) (('POST "comment") put-comment) (('GET "gallery") get-gallery) -- cgit v1.3