summaryrefslogtreecommitdiff
path: root/jakob/dynamic
diff options
context:
space:
mode:
Diffstat (limited to 'jakob/dynamic')
-rw-r--r--jakob/dynamic/notify.scm4
-rw-r--r--jakob/dynamic/util.scm19
2 files changed, 15 insertions, 8 deletions
diff --git a/jakob/dynamic/notify.scm b/jakob/dynamic/notify.scm
index ff8763c..cdd2209 100644
--- a/jakob/dynamic/notify.scm
+++ b/jakob/dynamic/notify.scm
@@ -15,6 +15,7 @@
;;; <http://www.gnu.org/licenses/>.
(define-module (jakob dynamic notify)
+ #:use-module (jakob dynamic config)
#:use-module (json)
#:use-module (web client)
#:export (notify))
@@ -28,4 +29,5 @@
(format #f "https://~a/message?token=~a" gotify-base-url gotify-token))
(define body
(scm->json-string `((priority . ,priority) (title . ,title) (message . ,message))))
- (http-post url #:headers '((content-type . (application/json))) #:body body))
+ (unless (%debug-enabled)
+ (http-post url #:headers '((content-type . (application/json))) #:body body)))
diff --git a/jakob/dynamic/util.scm b/jakob/dynamic/util.scm
index e34ae91..f18c497 100644
--- a/jakob/dynamic/util.scm
+++ b/jakob/dynamic/util.scm
@@ -16,6 +16,7 @@
(define-module (jakob dynamic util)
#:use-module (ice-9 match)
+ #:use-module (jakob dynamic config)
#:use-module (rnrs bytevectors)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-19)
@@ -117,16 +118,20 @@ to express my God-given constitutional rights!"
(define (from-tor? request)
"Return whether or not REQUEST was sent by the Tor daemon"
- (let ((originating-ip (assoc-ref (request-headers request) 'x-forwarded-for)))
- (or (string=? "127.0.0.1" originating-ip)
- (string=? "::1" originating-ip))))
+ (if (%debug-enabled)
+ #f
+ (let ((originating-ip (assoc-ref (request-headers request) 'x-forwarded-for)))
+ (or (string=? "127.0.0.1" originating-ip)
+ (string=? "::1" originating-ip)))))
(define (from-i2p? request)
"Return whether or not REQUEST was sent by i2pd"
- (let ((originating-ip (assoc-ref (request-headers request) 'x-forwarded-for)))
- (and (or (string-prefix? "127." originating-ip)
- (string-suffix? ":1" originating-ip))
- (not (from-tor? request)))))
+ (if (%debug-enabled)
+ #f
+ (let ((originating-ip (assoc-ref (request-headers request) 'x-forwarded-for)))
+ (and (or (string-prefix? "127." originating-ip)
+ (string-suffix? ":1" originating-ip))
+ (not (from-tor? request))))))
(define (from-darknet? request)
"Return whether or not REQUEST was sent by a darknet tunnel"