Skip to content

nx-freestance-handler, a redirector from the mainstream sites (Youtube, Twittter, Instagram, Reddit) to their privacy-supporting mirrors

License

Notifications You must be signed in to change notification settings

kssytsrk/nx-freestance-handler

Repository files navigation

nx-freestance-handler

nx-freestance-handler is a redirector from mainstream websites to their privacy-supporting mirrors for the Nyxt browser. The code was inspired by this issue.

It is currently able to redirect from Youtube to Invidious, from Reddit to Teddit, from Instagram to Bibliogram, from Medium to Scribe and from Twitter to Nitter.

Installation

Clone this repository to ~/common-lisp with:

$ git clone https://github.com/kssytsrk/nx-freestance-handler

Usage

To turn the handler on, add something like this to your Nyxt init.lisp file:

(defvar *my-request-resource-handlers* '())

(load-after-system :nx-freestance-handler
                   (nyxt-init-file "freestance.lisp"))

(define-configuration web-buffer
  ((request-resource-hook
    (reduce #'hooks:add-hook
            (mapcar #'make-handler-resource
		    *my-request-resource-handlers*)
            :initial-value %slot-default%))))

Then, create freestance.lisp file in ~/.config/nyxt with these contents:

;; to add all handlers/redirectors (youtube to invidious, reddit to teddit,
;; instagram to bibliogram, medium to scribe, twitter to nitter)
(setq *my-request-resource-handlers*
      (nconc *my-request-resource-handlers*
             nx-freestance-handler:*freestance-handlers*))

;; alternatively, you may add each separately
;; (push #'nx-freestance-handler:invidious-handler *my-request-resource-handlers*)
;; (push #'nx-freestance-handler:nitter-handler *my-request-resource-handlers*)
;; (push #'nx-freestance-handler:bibliogram-handler *my-request-resource-handlers*)
;; (push #'nx-freestance-handler:teddit-handler *my-request-resource-handlers*)
;; (push #'nx-freestance-handler:scribe-handler *my-request-resource-handlers*)

;; to set your preferred instance, either invoke SET-PREFERRED-[name of website]-INSTANCE
;; command in Nyxt (the effect lasts until you close Nyxt), or write something like this:
;; (setf nx-freestance-handler:*preferred-invidious-instance* "https://invidious.snopyta.org")

By default, for Invidious this handler redirects to the healthiest (i.e, with best uptime) instance available. For Teddit it redirects to the official teddit.net instance, for Scribe - to scribe.rip, for Nitter - to nitter.net and for Bibliogram - to bibliogram.art.

FYI, right now direct links to posts on Instagram are not redirected, as Bibliogram doesn't seem to support them (yet?).

Notes

All ideas, suggestions and bugreports are welcome in the "issues" section. Don't hesitate to open an issue if something's not working.

About

nx-freestance-handler, a redirector from the mainstream sites (Youtube, Twittter, Instagram, Reddit) to their privacy-supporting mirrors

Topics

Resources

License

Stars

Watchers

Forks