Fixed 'View on ...' links for Invidious & Bibliogram

This commit is contained in:
SimonBrazell 2020-03-31 17:39:57 +11:00
parent 9a5a3779b4
commit c3e0094527
2 changed files with 9 additions and 7 deletions

View File

@ -173,13 +173,10 @@ function redirectYouTube(url, initiator, type) {
}
}
function redirectTwitter(url, initiator) {
function redirectTwitter(url) {
if (disableNitter) {
return null;
}
if (initiator && (initiator.origin === nitterInstance || twitterDomains.includes(initiator.host))) {
return null;
}
if (url.host.split('.')[0] === 'pbs') {
return `${nitterInstance}/pic/${encodeURIComponent(url.href)}`;
} else if (url.host.split('.')[0] === 'video') {
@ -288,7 +285,12 @@ function redirectGoogleMaps(url) {
browser.webRequest.onBeforeRequest.addListener(
details => {
const url = new URL(details.url);
let initiator = details.initiator && new URL(details.initiator);
let initiator;
if (details.initiator) {
initiator = new URL(details.initiator);
} else if (details.originUrl) {
initiator = new URL(details.originUrl);
}
let redirect;
if (youtubeDomains.includes(url.host)) {
redirect = {
@ -296,7 +298,7 @@ browser.webRequest.onBeforeRequest.addListener(
};
} else if (twitterDomains.includes(url.host)) {
redirect = {
redirectUrl: redirectTwitter(url, initiator)
redirectUrl: redirectTwitter(url)
};
} else if (url.host.match(instagramRegex)) {
redirect = {

View File

@ -1,7 +1,7 @@
{
"name": "Privacy Redirect",
"description": "Redirects Twitter, YouTube, Instagram & Google Maps requests to privacy friendly alternatives.",
"version": "1.1.18",
"version": "1.1.19",
"manifest_version": 2,
"background": {
"scripts": [