Nyxt: Add magnet handler.

master
Pierre Neidhardt 2020-07-02 12:24:18 +02:00
parent c2ffb68e4a
commit f8ed532b29
1 changed files with 12 additions and 1 deletions

View File

@ -71,6 +71,16 @@ Videos are downloaded with `+youtube-dl-command+'."
uri)))
request-data)
(defun magnet-handler (request-data)
(let ((uri (url request-data)))
(if (string= (quri:uri-scheme uri) "magnet")
(progn
(echo "Opened magnet link in Transmission.")
;; (uiop:run-program (list "transmission-remote" "--add" (object-string uri)))
(uiop:launch-program (list "transmission-remote" "--add" (object-string uri)))
(values request-data :stop))
request-data)))
(defvar *my-unproxied-domains*
'("jit.si"
"steampowered.com"))
@ -111,7 +121,8 @@ Videos are downloaded with `+youtube-dl-command+'."
(request-resource-hook
(reduce #'hooks:add-hook
(mapcar #'make-handler-resource (list
#'auto-proxy-handler
;; #'auto-proxy-handler
#'magnet-handler
#'old-reddit-handler))
:initial-value %slot-default))))