summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--haunt/jakob/dynamic/capabilities/comments.scm1
-rw-r--r--haunt/jakob/dynamic/rate-limiter.scm5
-rw-r--r--haunt/jakob/utils/comments.scm10
3 files changed, 14 insertions, 2 deletions
diff --git a/haunt/jakob/dynamic/capabilities/comments.scm b/haunt/jakob/dynamic/capabilities/comments.scm
index ee4172c..1346ee4 100644
--- a/haunt/jakob/dynamic/capabilities/comments.scm
+++ b/haunt/jakob/dynamic/capabilities/comments.scm
@@ -33,6 +33,7 @@
put-comment
put-reaction
+ json->internal-comment
internal-comment?
internal-comment-id
internal-comment-name
diff --git a/haunt/jakob/dynamic/rate-limiter.scm b/haunt/jakob/dynamic/rate-limiter.scm
index d6ef28c..fb251a1 100644
--- a/haunt/jakob/dynamic/rate-limiter.scm
+++ b/haunt/jakob/dynamic/rate-limiter.scm
@@ -35,7 +35,10 @@
(define active-rate-limits (make-hash-table))
-(define (rate-limit-for-endpoint name) 32)
+(define (rate-limit-for-endpoint name)
+ (case name
+ ((get-comments) 1024)
+ (else 32)))
(define (increment-key! hash-table key)
(let ((new-value (if (hash-ref hash-table key)
diff --git a/haunt/jakob/utils/comments.scm b/haunt/jakob/utils/comments.scm
index e228a6d..8678a3a 100644
--- a/haunt/jakob/utils/comments.scm
+++ b/haunt/jakob/utils/comments.scm
@@ -213,7 +213,15 @@
(define (fetch-comments slug)
"Blocking call to webmention.io to retrieve a vector of all Webmentions for `slug'"
- (get-comments-by-slug slug))
+ (let ((url (format #f "https://jakob.space/api/comments?p=~a" slug)))
+ (receive (response-status response-body)
+ (http-request url)
+ (chain response-body
+ (bytevector->string _ "UTF-8")
+ (json-string->scm _)
+ (vector->list _)
+ (map scm->json-string _)
+ (map (lambda (x) (call-with-input-string x json->internal-comment)) _)))))
(define (fetch-webmentions slug)
"Blocking call to webmention.io to retrieve a vector of all Webmentions for `slug'"