fix readme

This commit is contained in:
Filipe Medeiros 2024-09-13 11:08:38 +02:00
parent 918c0ab3f1
commit 209597e6e0
Signed by: filipe
GPG key ID: 9533BD5467CC1E78
2 changed files with 7 additions and 4 deletions

View file

@ -2,6 +2,6 @@
This is a _very_ simple extension for Vivaldi (or other Chromium-based browsers, although I would appreciate not using it with Chrome) that allows you to escape certain websites by redirecting them to better alternatives. This is a _very_ simple extension for Vivaldi (or other Chromium-based browsers, although I would appreciate not using it with Chrome) that allows you to escape certain websites by redirecting them to better alternatives.
For now, it redirects Youtube to a [Invidious](https://invidious.io) instance (currently [yewtu.be/](https://yewtu.be/)) and Twitter (X…) to a [Nitter](https://github.com/zedeus/nitter) instance (currently [xcancel.com](https://xcancel.com)). For now, it redirects Youtube to a [Invidious](https://invidious.io) instance (currently [https://invidious.nerdvpn.de](https://invidious.nerdvpn.de)) and Twitter (X…) to a [Nitter](https://github.com/zedeus/nitter) instance (currently [xcancel.com](https://xcancel.com)).
If you want to add any other redirects, you should be able to just copy-paste and do that. If you have any questions, just open an issue or email me. If you want to add any other redirects, you should be able to just copy-paste and do that. If you have any questions, just open an issue or email me.

View file

@ -1,3 +1,6 @@
const youtubeAlternative = 'https://invidious.nerdvpn.de'
const twitterAlternative = 'https://xcancel.com'
chrome.webNavigation.onBeforeNavigate.addListener(({ url, tabId, frameType }) => { chrome.webNavigation.onBeforeNavigate.addListener(({ url, tabId, frameType }) => {
if (frameType === 'sub_frame') return if (frameType === 'sub_frame') return
@ -6,12 +9,12 @@ chrome.webNavigation.onBeforeNavigate.addListener(({ url, tabId, frameType }) =>
const videoId = match[4] ?? match[6] const videoId = match[4] ?? match[6]
chrome.tabs.update( chrome.tabs.update(
tabId, tabId,
{ url: `https://yewtu.be/watch?v=${videoId}` } { url: `${youtubeAlternative}/watch?v=${videoId}` }
) )
} else { } else {
chrome.tabs.update( chrome.tabs.update(
tabId, tabId,
{ url: `https://yewtu.be` } { url: `https://invidious.nerdvpn.de` }
) )
} }
}, { }, {
@ -28,7 +31,7 @@ chrome.webNavigation.onBeforeNavigate.addListener(({ url, tabId, frameType }) =>
const path = match[1] const path = match[1]
chrome.tabs.update( chrome.tabs.update(
tabId, tabId,
{ url: `https://xcancel.com/${path}` } { url: `${twitterAlternative}/${path}` }
) )
}, { }, {
url: [ url: [