Fix missing query strings in redirects

This commit is contained in:
SimonBrazell 2020-02-06 10:19:05 +11:00
parent ed3941ff72
commit d25072f6b5
2 changed files with 6 additions and 6 deletions

View File

@ -57,10 +57,10 @@ chrome.storage.onChanged.addListener(changes => {
function redirectBibliogram(url) { function redirectBibliogram(url) {
if (url.pathname === '/' || url.pathname.match(instagramPathsRegex)) { if (url.pathname === '/' || url.pathname.match(instagramPathsRegex)) {
return bibliogramInstance + url.pathname; return bibliogramInstance + url.pathname + url.search;
} else { } else {
// Redirect user profile requests to '/u/...' // Redirect user profile requests to '/u/...'
return `${bibliogramInstance}/u${url.pathname}`; return `${bibliogramInstance}/u${url.pathname}${url.search}`;
} }
} }
@ -71,13 +71,13 @@ chrome.webRequest.onBeforeRequest.addListener(
if (url.host.match(youtubeRegex)) { if (url.host.match(youtubeRegex)) {
if (!disableInvidious) { if (!disableInvidious) {
redirect = { redirect = {
redirectUrl: invidiousInstance + url.pathname redirectUrl: invidiousInstance + url.pathname + url.search
}; };
} }
} else if (url.host.match(twitterRegex)) { } else if (url.host.match(twitterRegex)) {
if (!disableNitter) { if (!disableNitter) {
redirect = { redirect = {
redirectUrl: nitterInstance + url.pathname redirectUrl: nitterInstance + url.pathname + url.search
}; };
} }
} else if (url.host.match(instagramRegex)) { } else if (url.host.match(instagramRegex)) {
@ -89,7 +89,7 @@ chrome.webRequest.onBeforeRequest.addListener(
} }
if (redirect) { if (redirect) {
console.log( console.log(
'Redirecting', `"${url.host}"`, '=>', `"${redirect.redirectUrl}"` 'Redirecting', `"${url.toString()}"`, '=>', `"${redirect.redirectUrl}"`
); );
console.log('Details', details); console.log('Details', details);
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "Privacy Redirect", "name": "Privacy Redirect",
"description": "Redirects Twitter, Youtube & Instagram requests to privacy friendly alternatives - Nitter, Invidious, & Bibliogram.", "description": "Redirects Twitter, Youtube & Instagram requests to privacy friendly alternatives - Nitter, Invidious, & Bibliogram.",
"version": "1.1.4", "version": "1.1.5",
"manifest_version": 2, "manifest_version": 2,
"background": { "background": {
"scripts": [ "scripts": [