Initial commit

This commit is contained in:
FireMasterK 2021-07-20 22:29:54 +05:30
commit cdeb18a1c0
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD
8 changed files with 719 additions and 0 deletions

18
js/background.js Normal file
View file

@ -0,0 +1,18 @@
window.browser = window.browser || window.chrome;
browser.webRequest.onBeforeRequest.addListener(
(details) => {
const url = new URL(details.url);
if (url.hostname.endsWith("youtu.be") && url.pathname.length > 1) {
return { redirectUrl: "https://piped.kavin.rocks/watch?v=" + url.pathname.substr(1) };
}
if (url.hostname.endsWith("youtube.com") || url.hostname.endsWith("youtube-nocookie.com")) {
url.hostname = "piped.kavin.rocks";
return { redirectUrl: url.href };
}
},
{
urls: ["<all_urls>"],
},
["blocking"],
);