[oni-browse] Redirect any ‘*.medium.com’ URL to scribe.rip
This commit is contained in:
parent
ed3149f690
commit
d6897a634a
1 changed files with 34 additions and 42 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2022.0228.012441
|
;; Version: 2022.0311.230935
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; 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
|
;; 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.
|
"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’
|
ARGS is the list of arguments that was passed to ‘browse-url’
|
||||||
before this filter."
|
before this filter."
|
||||||
|
(save-match-data
|
||||||
(cond
|
(cond
|
||||||
((string-prefix-p "https://blog.bitsrc.io" (car args))
|
((string-prefix-p "https://blog.bitsrc.io" (car args))
|
||||||
(cons (string-replace "https://blog.bitsrc.io" "https://scribe.rip/bitsrc" (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))
|
((string-prefix-p "https://twitter.com" (car args))
|
||||||
(cons (string-replace "https://twitter.com" "https://nitter.net" (car args))
|
(cons (string-replace "https://twitter.com" "https://nitter.net" (car args))
|
||||||
(cdr 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))
|
((string-prefix-p "https://medium.marqeta.com" (car args))
|
||||||
(cons (string-replace "https://medium.marqeta.com" "https://scribe.rip/marqeta" (car args))
|
(cons (string-replace "https://medium.marqeta.com" "https://scribe.rip/marqeta" (car args))
|
||||||
(cdr 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))
|
((string-prefix-p "https://itnext.io" (car args))
|
||||||
(cons (string-replace "https://itnext.io" "https://scribe.rip" (car args))
|
(cons (string-replace "https://itnext.io" "https://scribe.rip" (car args))
|
||||||
(cdr args)))
|
(cdr args)))
|
||||||
((string-prefix-p "https://medium.com" (car args))
|
((string-match (rx "https://" (optional (one-or-more (not ".")) ".") "medium.com") (car args))
|
||||||
(cons (string-replace "https://medium.com" "https://scribe.rip" (car args))
|
(cons (replace-match "https://scribe.rip" nil nil (car args))
|
||||||
(cdr args)))
|
(cdr args)))
|
||||||
((string-prefix-p "https://www.youtube.com" (car args))
|
((string-prefix-p "https://www.youtube.com" (car args))
|
||||||
(cons (string-replace "https://www.youtube.com" "https://yewtu.be" (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))
|
((string-prefix-p "https://www.instagram.com" (car args))
|
||||||
(cons (string-replace "https://www.instagram.com" "https://bibliogram.1d4.us/u" (car args))
|
(cons (string-replace "https://www.instagram.com" "https://bibliogram.1d4.us/u" (car args))
|
||||||
(cdr args)))
|
(cdr args)))
|
||||||
(t args)))
|
(t args))))
|
||||||
|
|
||||||
(setq browse-url-browser-function
|
(setq browse-url-browser-function
|
||||||
(if (eql system-type 'windows-nt)
|
(if (eql system-type 'windows-nt)
|
||||||
|
|
Loading…
Reference in a new issue