diff --git a/.config/next/init.lisp b/.config/next/init.lisp index 95592c9d..acd66145 100644 --- a/.config/next/init.lisp +++ b/.config/next/init.lisp @@ -60,29 +60,33 @@ Videos are downloaded with `+youtube-dl-command+'." (uiop:launch-program (list +youtube-dl-command+ url "-o" "/tmp/videos/%(title)s.%(ext)s")))) url) -(defun old-reddit-handler (url) - (let* ((uri (quri:uri url))) - (if (search "reddit.com" (quri:uri-host uri)) - (progn - (setf (quri:uri-host uri) "old.reddit.com") - (let ((new-url (quri:render-uri uri))) - (log:info "Switching to old Reddit: ~a" new-url) - new-url)) - url))) +(defun old-reddit-handler (request-data) + (let* ((url (url request-data)) + (uri (quri:uri url))) + (setf (url request-data) + (if (search "reddit.com" (quri:uri-host uri)) + (progn + (setf (quri:uri-host uri) "old.reddit.com") + (let ((new-url (quri:render-uri uri))) + (log:info "Switching to old Reddit: ~a" new-url) + new-url)) + url))) + request-data) (defvar *my-unproxied-domains* '("jit.si" "steampowered.com")) -(defun auto-proxy-handler (url) - (let* ((uri (quri:uri url)) +(defun auto-proxy-handler (request-data) + (let* ((url (url request-data)) + (uri (quri:uri url)) (domain (and uri (quri:uri-domain uri)))) ;; TODO: Turn on/off proxy, not mode. (when domain (next/proxy-mode:proxy-mode :activate (not (member-string domain *my-unproxied-domains*))))) - url) + request-data) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -104,12 +108,14 @@ Videos are downloaded with `+youtube-dl-command+'." '(my-mode vi-normal-mode ;; my-blocker-mode blocker-mode - proxy-mode) + ;; proxy-mode + ) %slot-default)) - (load-hook (hooks:make-hook-string->string - :handlers (list #'old-reddit-handler - #'auto-proxy-handler) - :combination #'hooks:combine-composed-hook)))) + ;; (request-resource-hook + ;; (reduce #'hooks:add-hook + ;; (mapcar #'make-handler-resource (list #'old-reddit-handler #'auto-proxy-handler)) + ;; :initial-value %slot-default)) + )) (defmacro with-maybe-gpg-file ((stream filespec) &body body) "Evaluate BODY with STREAM bound to FILESPEC.