From d99c0c41414aef88e3ba869ffcabc58c01cc01f7 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Tue, 8 Mar 2022 06:36:11 +0300 Subject: [PATCH] Added t.co for twitter --- src/assets/javascripts/helpers/twitter.js | 6 ++++-- src/pages/background/background.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/assets/javascripts/helpers/twitter.js b/src/assets/javascripts/helpers/twitter.js index 7f0a017..6826632 100644 --- a/src/assets/javascripts/helpers/twitter.js +++ b/src/assets/javascripts/helpers/twitter.js @@ -8,7 +8,8 @@ const targets = [ /^https?:\/\/mobile\.twitter\.com/, /^https?:\/\/pbs\.twimg\.com/, /^https?:\/\/video\.twimg\.com/, - /^https?:\/\/platform\.twitter\.com\/embed/ + /^https?:\/\/platform\.twitter\.com\/embed/, + /^https?:\/\/t\.co/ ]; let redirects = { @@ -151,7 +152,8 @@ function redirect(url, initiator) { else if (url.pathname.split("/").includes("tweets")) return `${randomInstance}${url.pathname.replace("/tweets", "")}${url.search}`; - + else if (url.host == 't.co') + return `${randomInstance}/t.co${url.pathname}`; else return `${randomInstance}${url.pathname}${url.search}`; } diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 2073abe..c494b78 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -113,7 +113,7 @@ browser.tabs.onUpdated.addListener( try { url = new URL(changeInfo.url); } catch (_) { return } if (youtubeHelper.isPipedorInvidious(url, 'main_frame', 'piped')) youtubeHelper.initPipedLocalStorage(tabId); - if (twitterHelper.isNitter(url, 'main_frame')) newUrl = twitterHelper.initNitterCookies(url); + if (twitterHelper.isNitter(url, 'main_frame')) twitterHelper.initNitterCookies(url); if (instagramHelper.isBibliogram(url)) instagramHelper.initBibliogramCookies(url); // if (changeInfo.url && youtubeHelper.isPipedorInvidious(url, 'main_frame', 'pipedMaterial')) youtubeHelper.initPipedMaterialLocalStorage(tabId); // if (changeInfo.url && youtubeHelper.isUrlPipedorInvidious(changeInfo.url, 'invidious')) youtubeHelper.initInvidiousCookies(tabId);