summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimonBrazell <simon@brazell.com.au>2021-04-16 13:02:18 +1000
committerSimonBrazell <simon@brazell.com.au>2021-04-16 13:02:18 +1000
commitf714c666d9498710a7afff49e7653eb7c3e97d56 (patch)
treeeff7efdbf2d8a0de6949a7ac1f07db6b09723f0c /src
parent01e986fce32443b3621a7fbac0a3f4da7c85daa0 (diff)
downloadprivacy-redirect-f714c666d9498710a7afff49e7653eb7c3e97d56.tar.gz
privacy-redirect-f714c666d9498710a7afff49e7653eb7c3e97d56.tar.bz2
privacy-redirect-f714c666d9498710a7afff49e7653eb7c3e97d56.zip
Fixes #135 - Handle Twitter usernames with "tweets" in them.
Diffstat (limited to 'src')
-rw-r--r--src/pages/background/background.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 6217903..ce004db 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -290,7 +290,7 @@ function redirectTwitter(url, initiator) {
if (disableNitter || isException(url, initiator)) {
return null;
}
- if (url.pathname.includes("/home")) {
+ if (url.pathname.split("/").includes("home")) {
return null;
}
if (
@@ -313,7 +313,7 @@ function redirectTwitter(url, initiator) {
return `${
nitterInstance || commonHelper.getRandomInstance(nitterRandomPool)
}/gif/${encodeURIComponent(url.href)}`;
- } else if (url.pathname.includes("tweets")) {
+ } else if (url.pathname.split("/").includes("tweets")) {
return `${
nitterInstance || commonHelper.getRandomInstance(nitterRandomPool)
}${url.pathname.replace("/tweets", "")}${url.search}`;
@@ -379,7 +379,7 @@ function redirectGoogleMaps(url, initiator) {
layers[url.searchParams.get("layer")] || layers["none"]
}`;
// Handle Google Maps Embed API
- if (url.pathname.includes("/embed")) {
+ if (url.pathname.split("/").includes("embed")) {
let query = "";
if (url.searchParams.has("q")) {
query = url.searchParams.get("q");
@@ -400,7 +400,7 @@ function redirectGoogleMaps(url, initiator) {
});
redirect = `${osmInstance}/export/embed.html?bbox=${bbox}&layer=mapnik&marker=${marker}`;
// Handle Google Maps Directions
- } else if (url.pathname.includes("/dir")) {
+ } else if (url.pathname.split("/").includes("dir")) {
const travelMode =
travelModes[url.searchParams.get("travelmode")] || travelModes["driving"];
let origin;