;;; Copyright © 2019 - 2022 Jakob L. Kreuze ;;; ;;; This program is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as ;;; published by the Free Software Foundation; either version 3 of the ;;; License, or (at your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;; General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this program. If not, see ;;; . (define challenges (make-hash-table)) (define conn (connect-to-postgres-paramstring "dbname=jakob_comments")) (define (get-comments request body) (values '((content-type . (application/json))) (scm->json-string '((title . "whoa buddy") (author . "Jakob Kreuze") (date . "2022-03-27") (text . "bad take, bad take!"))))) (define (put-comment request body) (display (decode-form body)) (newline) (values '((content-type . (text/plain))) "Hello hacker!")) (define (make-challenge request body) (let-values (((uuid value image) (new-captcha))) (hash-set! challenges uuid value) (hash-for-each (lambda (x y) (display x) (newline)) challenges) (values `((content-type . (application/base64)) (access-control-allow-origin . "*") (x-captcha-id . ,uuid)) (base64-encode image))))