aboutsummaryrefslogtreecommitdiff
path: root/haunt/api.scm
diff options
context:
space:
mode:
Diffstat (limited to 'haunt/api.scm')
-rw-r--r--haunt/api.scm10
1 files changed, 4 insertions, 6 deletions
diff --git a/haunt/api.scm b/haunt/api.scm
index 354e1b6..1e71064 100644
--- a/haunt/api.scm
+++ b/haunt/api.scm
@@ -25,6 +25,7 @@
(jakob dynamic errors)
(jakob dynamic logging)
(jakob dynamic rate-limiter)
+ (jakob dynamic util)
(json)
(rnrs conditions)
(rnrs exceptions)
@@ -54,12 +55,9 @@
(define (clearnet-only handler)
(lambda (request body)
- (let ((originating-ip (assoc-ref (request-headers request) 'x-forwarded-for)))
- (if (and (or (string-prefix? "127." originating-ip)
- (string-suffix? ":1" originating-ip))
- (not (%debug-enabled)))
- (panic "This API is only available on the clearnet." #:code 403)
- (handler request body)))))
+ (if (and (from-darknet? request) (not (%debug-enabled)))
+ (panic "This API is only available on the clearnet." #:code 403)
+ (handler request body))))
(define (handle-api-request request body endpoint)
"Route handler for the API server."

© 2015 - 2026 Jakob L. Kreuze