From 4b8de0bcf0ca598804a9d462933d492232b4b314 Mon Sep 17 00:00:00 2001 From: Jakob L. Kreuze Date: Sun, 12 Feb 2023 14:50:42 -0500 Subject: Merge branch 'self-hosted-comments' It's been working well enough. I think it's time to get the initial version of this on `master'. --- dynamic/capabilities/comments.scm | 40 --------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 dynamic/capabilities/comments.scm (limited to 'dynamic/capabilities/comments.scm') diff --git a/dynamic/capabilities/comments.scm b/dynamic/capabilities/comments.scm deleted file mode 100644 index d7dc1fa..0000000 --- a/dynamic/capabilities/comments.scm +++ /dev/null @@ -1,40 +0,0 @@ -;;; 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)))) -- cgit v1.3