aboutsummaryrefslogtreecommitdiff
path: root/haunt/api.scm
diff options
context:
space:
mode:
authorJakob L. Kreuze2022-11-20 13:29:29 -0500
committerJakob L. Kreuze2022-11-20 13:29:29 -0500
commit7092a1977d075001320470d81cc740d33409cc64 (patch)
treed61003453c681f8d732d73255e12b0916f3aa1ad /haunt/api.scm
parentebeeb7518241bea945b6c372fe07fb20abf020f3 (diff)
[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.)
Diffstat (limited to 'haunt/api.scm')
-rw-r--r--haunt/api.scm3
1 files changed, 2 insertions, 1 deletions
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)

© 2015 - 2026 Jakob L. Kreuze