diff options
author | ManeraKai <manerakai@protonmail.com> | 2022-02-13 19:03:22 +0300 |
---|---|---|
committer | ManeraKai <manerakai@protonmail.com> | 2022-02-13 19:03:26 +0300 |
commit | edbb327ee6ac2451ffa16a9f0823d0e176ef6941 (patch) | |
tree | c771f6171c837e8aafe522857f17759ad5be75f7 /src/assets | |
parent | Fixed an infinite loop #34 (diff) | |
download | libredirect-edbb327ee6ac2451ffa16a9f0823d0e176ef6941.zip |
fixed a typo #28
Diffstat (limited to 'src/assets')
-rw-r--r-- | src/assets/javascripts/helpers/instagram.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/assets/javascripts/helpers/instagram.js b/src/assets/javascripts/helpers/instagram.js index 6d57cd59..890e0ef3 100644 --- a/src/assets/javascripts/helpers/instagram.js +++ b/src/assets/javascripts/helpers/instagram.js @@ -104,14 +104,22 @@ function redirect(url, initiator, type) { if (initiator && (instancesList.includes(initiator.origin) || targets.includes(initiator.host))) return null; + + // Do not redirect /accounts, /embeds.js, or anything other than main_frame if (type !== "main_frame" || url.pathname.match(bypassPaths)) return 'CANCEL'; - if (url.pathname === "/" || instagramReservedPaths.includes(url.pathname.split("/")[1])) + console.log("Hello", url.href) + + if (url.pathname === "/" || reservedPaths.includes(url.pathname.split("/")[1])) { + console.log("wewe") return `${randomInstance}${url.pathname}${url.search}`; - else - return `${randomInstance}/u${url.pathname}${url.search}`; // Likely a user profile, redirect to '/u/...' + } + else { + console.log("A user profile") + return `${randomInstance}/u${url.pathname}${url.search}`; + } // Likely a user profile, redirect to '/u/...' } function isInstagram(url) { |