diff --git a/qutebrowser/.config/qutebrowser/redirects.py b/qutebrowser/.config/qutebrowser/redirects.py index 8323b9d..55c8a14 100644 --- a/qutebrowser/.config/qutebrowser/redirects.py +++ b/qutebrowser/.config/qutebrowser/redirects.py @@ -2,6 +2,17 @@ import random import re from qutebrowser.api import interceptor from qutebrowser.extensions.interceptors import RedirectException +from qutebrowser.utils import message + +def fixScribePath(url): + """ Fix external medium blog to scribe translation. + Some paths from medium will go through a 'global identity' + path which messes up the actual url path we want to go + to and puts it in queries. This puts it back on the path. + """ + new_path = f"{url.path()}{url.query()}" + url.setQuery("") + url.setPath(re.sub(r"m/global-identity-2redirectUrl=", "", new_path)) redirects = { "youtube": { @@ -132,13 +143,11 @@ redirects = { "rimgo.bcow.xyz", "rimgo.pussthecat.org", "rimgo.totaldarkness.net", - "rimgo.bus-hit.me", "rimgo.esmailelbob.xyz", "imgur.artemislena.eu", "rimgo.vern.cc", "rim.odyssey346.dev", "rimgo.privacytools.io", - "i.habedieeh.re", "rimgo.hostux.net", "ri.zzls.xyz", "rimgo.marcopisco.com", @@ -157,6 +166,7 @@ redirects = { "scribe.privacydev.net", "sc.vern.cc", ], + "postprocess": fixScribePath }, "google": { "source": ["google.com"], @@ -172,7 +182,6 @@ redirects = { "wiki.slipfox.xyz", "wikiless.esmailelbob.xyz", "wikiless.funami.tech", - "wikiless.northboot.xyz", "wikiless.org", "wikiless.tiekoetter.com", ], @@ -204,10 +213,12 @@ def rewrite(request: interceptor.Request): if matched: target = service["target"][random.randint(0, len(service["target"]) - 1)] if target is not None and url.setHost(target) is not False: + if "postprocess" in service: + service["postprocess"](url) try: request.redirect(url) - except RedirectException: - pass + except RedirectException as e: + message.error(str(e)) break