1
0
Fork 0

[oni-browse] Redirect any ‘*.medium.com’ URL to scribe.rip

This commit is contained in:
Tom Willemse 2022-04-01 18:44:23 -07:00
parent ed3149f690
commit d6897a634a

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2022.0228.012441
;; Version: 2022.0311.230935
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@ -34,6 +34,7 @@
"Check the url given to browse-url and redirect to a free alternative if available.
ARGS is the list of arguments that was passed to browse-url
before this filter."
(save-match-data
(cond
((string-prefix-p "https://blog.bitsrc.io" (car args))
(cons (string-replace "https://blog.bitsrc.io" "https://scribe.rip/bitsrc" (car args))
@ -44,23 +45,14 @@ before this filter."
((string-prefix-p "https://twitter.com" (car args))
(cons (string-replace "https://twitter.com" "https://nitter.net" (car args))
(cdr args)))
((string-prefix-p "https://kevingosse.medium.com" (car args))
(cons (string-replace "https://kevingosse.medium.com" "https://scribe.rip/kevingosse" (car args))
(cdr args)))
((string-prefix-p "https://medium.marqeta.com" (car args))
(cons (string-replace "https://medium.marqeta.com" "https://scribe.rip/marqeta" (car args))
(cdr args)))
((string-prefix-p "https://kevlinhenney.medium.com" (car args))
(cons (string-replace "https://kevlinhenney.medium.com" "https://scribe.rip" (car args))
(cdr args)))
((string-prefix-p "https://upekabee.medium.com" (car args))
(cons (string-replace "https://upekabee.medium.com" "https://scribe.rip" (car args))
(cdr args)))
((string-prefix-p "https://itnext.io" (car args))
(cons (string-replace "https://itnext.io" "https://scribe.rip" (car args))
(cdr args)))
((string-prefix-p "https://medium.com" (car args))
(cons (string-replace "https://medium.com" "https://scribe.rip" (car args))
((string-match (rx "https://" (optional (one-or-more (not ".")) ".") "medium.com") (car args))
(cons (replace-match "https://scribe.rip" nil nil (car args))
(cdr args)))
((string-prefix-p "https://www.youtube.com" (car args))
(cons (string-replace "https://www.youtube.com" "https://yewtu.be" (car args))
@ -74,7 +66,7 @@ before this filter."
((string-prefix-p "https://www.instagram.com" (car args))
(cons (string-replace "https://www.instagram.com" "https://bibliogram.1d4.us/u" (car args))
(cdr args)))
(t args)))
(t args))))
(setq browse-url-browser-function
(if (eql system-type 'windows-nt)