From 56e1feda693a09e03d7b362d3c84c7c9ab27711c Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 31 May 2024 16:54:17 +0300 Subject: nyxt: Add invidious & redlib handler --- .config/nyxt/config.lisp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to '.config/nyxt') diff --git a/.config/nyxt/config.lisp b/.config/nyxt/config.lisp index 4367e12..4b9f4f2 100644 --- a/.config/nyxt/config.lisp +++ b/.config/nyxt/config.lisp @@ -51,3 +51,33 @@ Upstream Nyxt doesn't have it because it may break some websites.") (preferred-user-agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Safari/605.1.15" :doc "Mimic Chrome on MacOS."))) + +(defun redlib-handler (request-data) + (let ((url (url request-data))) + (setf (url request-data) + (if (search "reddit.com" (quri.uri:uri-host url)) + (progn + (setf (quri.uri:uri-host url) "redlib.pussthecat.org") + (log:info "Switching to old Reddit: ~s" + (render-url url)) + url) + url))) + request-data) + +(defun invidious-handler (request-data) + (let ((url (url request-data))) + (setf (url request-data) + (if (search "youtube.com" (quri.uri:uri-host url)) + (progn + (setf (quri.uri:uri-host url) "yewtu.be") + (log:info "Switching to invidious: ~s" + (render-url url)) + url) + url))) + request-data) + +(define-configuration web-buffer + ((request-resource-hook + (progn + (serapeum:add-hook %slot-default% 'redlib-handler) + (serapeum:add-hook %slot-default% 'invidious-handler))))) -- cgit v1.2.3