From 31c642fc90490471ea6903b148b201f0557d8da0 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Fri, 8 Apr 2022 03:18:05 +0300 Subject: [PATCH] Fixed wiki redirect bug #173. i2p to wikiless list. Fixed imgur redirect #175 #166 --- src/assets/javascripts/helpers/imgur.js | 10 +++++++++- src/assets/javascripts/helpers/wikipedia.js | 2 +- src/instances/get_instances.py | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/assets/javascripts/helpers/imgur.js b/src/assets/javascripts/helpers/imgur.js index 7227bab..cf67947 100644 --- a/src/assets/javascripts/helpers/imgur.js +++ b/src/assets/javascripts/helpers/imgur.js @@ -107,7 +107,15 @@ function redirect(url, type) { // https://imgur.com/gallery/cTRwaJU // https://i.imgur.com/CFSQArP.jpeg - if (type != "main_frame" && type != "sub_frame" && type != "xmlhttprequest" && type != "other") return null; + if (![ + "main_frame", + "sub_frame", + "xmlhttprequest", + "other", + "image", + "media", + ].includes(type)) return null; + if (url.pathname.includes("delete/")) return null; let instancesList; diff --git a/src/assets/javascripts/helpers/wikipedia.js b/src/assets/javascripts/helpers/wikipedia.js index 5570045..af7b0e5 100644 --- a/src/assets/javascripts/helpers/wikipedia.js +++ b/src/assets/javascripts/helpers/wikipedia.js @@ -2,7 +2,7 @@ window.browser = window.browser || window.chrome; import commonHelper from './common.js' -const targets = /^https?:\/{2}(.*\.|)wikipedia\.org/ +const targets = /^https?:\/{2}([a-z]{1,}\.|)wikipedia\.org/ let redirects = { "wikiless": { diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 6e839c4..5f54fcf 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -108,9 +108,12 @@ rJson = json.loads(r.text) wikilessList = {} wikilessList['normal'] = [] wikilessList['tor'] = [] +wikilessList['i2p'] = [] for item in rJson: if item.endswith('.onion'): wikilessList['tor'].append('http://' + item) + elif item.endswith('.i2p'): + wikilessList['i2p'].append('http://' + item) else: wikilessList['normal'].append('https://' + item) mightyList['wikiless'] = wikilessList