aboutsummaryrefslogtreecommitdiffstats
path: root/src/assets
diff options
context:
space:
mode:
Diffstat (limited to 'src/assets')
-rw-r--r--src/assets/javascripts/helpers/instagram.js54
-rw-r--r--src/assets/javascripts/helpers/youtube/youtube.js2
2 files changed, 20 insertions, 36 deletions
diff --git a/src/assets/javascripts/helpers/instagram.js b/src/assets/javascripts/helpers/instagram.js
index 82a899d9..cad49d22 100644
--- a/src/assets/javascripts/helpers/instagram.js
+++ b/src/assets/javascripts/helpers/instagram.js
@@ -4,8 +4,6 @@ import commonHelper from './common.js'
const targets = [
"instagram.com",
"www.instagram.com",
- "help.instagram.com",
- "about.instagram.com",
];
let redirects = {
"bibliogram": {
@@ -66,32 +64,22 @@ function setBibliogramTorCustomRedirects(val) {
}
const reservedPaths = [
- "about",
- "explore",
- "support",
- "press",
- "api",
- "privacy",
- "safety",
- "admin",
- "graphql",
- "accounts",
- "help",
- "terms",
- "contact",
- "blog",
- "igtv",
"u",
"p",
- "fragment",
- "imageproxy",
- "videoproxy",
- ".well-known",
- "tv",
- "reel",
+ "privacy",
];
-const bypassPaths = /\/(accounts\/|embeds?.js)/;
+const bypassPaths = [
+ /about/,
+ /explore/,
+ /support/,
+ /press/,
+ /api/,
+ /privacy/,
+ /safety/,
+ /admin/,
+ /\/(accounts\/|embeds?.js)/
+];
let disable;
const getDisable = () => disable;
@@ -108,19 +96,17 @@ function setProtocol(val) {
console.log("nitterProtocol: ", val)
}
-function isInstagram(url, initiator) {
- if (disable) return false;
+function redirect(url, type, initiator) {
+
+ if (disable) return;
if (
initiator &&
([...redirects.bibliogram.normal, ...bibliogramNormalCustomRedirects].includes(initiator.origin) || targets.includes(initiator.host))
- )
- return false; // Do not redirect Bibliogram view on Instagram links
- return targets.includes(url.host)
-}
+ ) return;
+
+ if (!targets.includes(url.host)) return;
-function redirect(url, type) {
- if (type !== "main_frame" || url.pathname.match(bypassPaths))
- return 'CANCEL'; // Do not redirect /accounts, /embeds.js, or anything other than main_frame
+ if (type !== "main_frame" || bypassPaths.some(rx => rx.test(url.pathname))) return;
let instancesList;
if (protocol == 'normal') instancesList = [...bibliogramNormalRedirectsChecks, ...bibliogramNormalCustomRedirects];
@@ -278,8 +264,6 @@ export default {
getBibliogramTorCustomRedirects,
setBibliogramTorCustomRedirects,
- isInstagram,
-
redirect,
init,
changeInstance,
diff --git a/src/assets/javascripts/helpers/youtube/youtube.js b/src/assets/javascripts/helpers/youtube/youtube.js
index e551255e..919cec17 100644
--- a/src/assets/javascripts/helpers/youtube/youtube.js
+++ b/src/assets/javascripts/helpers/youtube/youtube.js
@@ -481,10 +481,10 @@ function changeInstance(url) {
else if (protocol == 'tor') instancesList = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects];
}
else if (frontend == 'pipedMaterial') {
-
if (protocol == 'normal') instancesList = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects];
else if (protocol == 'tor') instancesList = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects];
}
+ else return null;
console.log("instancesList", instancesList);
let index = instancesList.indexOf(protocolHost);