Sign extension, add scripts, handle consent page
This commit is contained in:
parent
251ab898f7
commit
4cb96f526f
|
@ -1 +1 @@
|
||||||
*.xpi
|
/web-ext-artifacts
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
# This file was created by https://github.com/mozilla/web-ext
|
||||||
|
# Your auto-generated extension ID for addons.mozilla.org is:
|
||||||
|
tubeproxy@netflux.io
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
read -p "Enter Mozilla API secret: " secret
|
||||||
|
web-ext sign --ignore-files bin/ --api-key=user:16805942:907 --api-secret="$secret"
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
web-ext run --verbose
|
5
build.sh
5
build.sh
|
@ -1,5 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
zip out.zip hook.js manifest.json
|
|
||||||
mv out.zip out.xpi
|
|
10
hook.js
10
hook.js
|
@ -1,8 +1,14 @@
|
||||||
// Based on: https://github.com/metiis/invidious-redirect/blob/master/makehook.js
|
// Based on: https://github.com/metiis/invidious-redirect/blob/master/makehook.js
|
||||||
|
|
||||||
|
function checkRedirect() {
|
||||||
const dest = "tube.netflux.io";
|
const dest = "tube.netflux.io";
|
||||||
let href = window.location.href;
|
let href = window.location.href;
|
||||||
|
|
||||||
|
// do not redirect Youtube consent page
|
||||||
|
if (href.includes("consent.youtube.com")) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (href.includes("m.youtube.com")) {
|
if (href.includes("m.youtube.com")) {
|
||||||
href = href.replace("m.youtube.com", dest);
|
href = href.replace("m.youtube.com", dest);
|
||||||
} else if (href.includes("www.youtube.com")) {
|
} else if (href.includes("www.youtube.com")) {
|
||||||
|
@ -22,3 +28,7 @@ if (href.includes("/results?search_query")) {
|
||||||
if(confirm("Redirect to " + href + "?")) {
|
if(confirm("Redirect to " + href + "?")) {
|
||||||
window.location.href = href;
|
window.location.href = href;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
checkRedirect()
|
||||||
|
|
Loading…
Reference in New Issue