Compare commits

5 Commits
v1.0 ... main

Author SHA1 Message Date
16e8b24fe4 fix(github): url is truncated 2025-12-01 11:41:40 +01:00
ecb68ee78b fix(github): GH OAuth2 is broken 2025-11-30 20:48:03 +01:00
fa27167f5c feat: take care of reddit 2025-11-28 12:28:36 +01:00
1d5377ad6d feat: take care of github 2025-11-28 12:00:46 +01:00
78d23a978d feat: add timecode if there 2025-09-29 10:48:19 +02:00
4 changed files with 33 additions and 7 deletions

View File

@@ -7,7 +7,7 @@ This is a Firefox Addon that redirect youtube URL to the embed version to have a
* click on "Load Temporary Add-on…"
* select "manifest.json" file
## to have it in private navication
## to have it in private navigation
* go to "about:addons"
* select the extension

View File

@@ -1,5 +1,6 @@
browser.webRequest.onBeforeRequest.addListener(
function(details) {
//console.log(details);
const url = new URL(details.url);
if (url.hostname === "www.youtube.com" || url.hostname === "youtube.com") {
// Extract the video ID from the URL params
@@ -8,14 +9,39 @@ browser.webRequest.onBeforeRequest.addListener(
// Rewrite to the embedded URL format, picking timecode if available
const timecode = url.searchParams.get("t");
return {
redirectUrl: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0` + (timecode ? "&start=" + timecode : "");
redirectUrl: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0` + (timecode ? "&start=" + timecode : "")
};
}
} else if (url.hostname === "github.com") {
const GOTHUB = "gothub.lunar.icu";
if (details.originUrl === undefined) { // entered in the address bar
return
}
origin = new URL(details.originUrl).hostname;
if (origin === GOTHUB || origin === "github.com") { // click within gothub or github page
return
}
// click from everywhere else
path = url.pathname.split("/");
org = path[1];
if (org === "login") { // OAuth2 path
return
}
return {
redirectUrl: `https://${GOTHUB}${url.pathname}`
};
} else if (url.hostname === "www.reddit.com") {
url.hostname = "old.reddit.com"
return {
redirectUrl: url.toString()
};
}
},
{ urls: [
"*://www.youtube.com/*",
"*://youtube.com/*"
"*://youtube.com/*",
"*://github.com/*",
"*://www.reddit.com/*",
]},
["blocking"]
);
);

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@@ -1,8 +1,8 @@
{
"manifest_version": 2,
"name": "YouTube force embed",
"version": "1.0",
"description": "Rewrites YouTube URLs to embedded format.",
"name": "Desenshitifier",
"version": "1.2",
"description": "Rewrites YouTube URLs to embedded format.\nOpen Github links with Gothub\nredirect reddit, www to old",
"permissions": [
"webRequest",
"webRequestBlocking",