From 77ec7cd051ed54a4775f2db37751ed9cb2ddecee Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Sat, 26 Aug 2023 15:30:29 +1000 Subject: Adding firefox redirector extension --- firefox/extensions/Redirector | 1 + firefox/extensions/custom-redirector.patch | 433 +++++++++++++++++++++++++++++ 2 files changed, 434 insertions(+) create mode 160000 firefox/extensions/Redirector create mode 100644 firefox/extensions/custom-redirector.patch (limited to 'firefox/extensions') diff --git a/firefox/extensions/Redirector b/firefox/extensions/Redirector new file mode 160000 index 0000000..b48f2c4 --- /dev/null +++ b/firefox/extensions/Redirector @@ -0,0 +1 @@ +Subproject commit b48f2c46114e1e5e997b0e58e4402699686bd540 diff --git a/firefox/extensions/custom-redirector.patch b/firefox/extensions/custom-redirector.patch new file mode 100644 index 0000000..e0f438a --- /dev/null +++ b/firefox/extensions/custom-redirector.patch @@ -0,0 +1,433 @@ +From f1987aee558295c00a9593b96543dc966df4bd79 Mon Sep 17 00:00:00 2001 +From: Yuchen Pei +Date: Sat, 26 Aug 2023 15:22:09 +1000 +Subject: [PATCH] Add extension preferences to Redirector. + +A set of preloaded redirects. + +Caveat: still need to open the redirect tab before the redirection is +in effect. +--- + js/redirectorpage.js | 381 +++++++++++++++++++++++++++++++++++++++++-- + manifest.json | 4 +- + 2 files changed, 365 insertions(+), 20 deletions(-) + +diff --git a/js/redirectorpage.js b/js/redirectorpage.js +index 38e1331..d1219ec 100644 +--- a/js/redirectorpage.js ++++ b/js/redirectorpage.js +@@ -1,3 +1,362 @@ ++var DEFAULT_REDIRECTS = [ ++ { ++ "description": "youtube to invidious", ++ "exampleUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", ++ "exampleResult": "https://yewtu.be/watch?v=dQw4w9WgXcQ", ++ "error": null, ++ "includePattern": "https://www.youtube.com/(.*)", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://yewtu.be/$1", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "twitter to nitter", ++ "exampleUrl": "https://twitter.com/fsf/status/1376714994721689601", ++ "exampleResult": "https://nitter.net/fsf/status/1376714994721689601", ++ "error": null, ++ "includePattern": "https://twitter.com/(.*)", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://nitter.net/$1", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "reddit to teddit", ++ "exampleUrl": "https://www.reddit.com/r/webhosting/comments/izq39w/hiding_public_ip/", ++ "exampleResult": "https://teddit.net/r/webhosting/comments/izq39w/hiding_public_ip/", ++ "error": null, ++ "includePattern": "https://www.reddit.com/(.*)", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://teddit.net/$1", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": true, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "old reddit to teddit", ++ "exampleUrl": "https://old.reddit.com/r/webhosting/comments/izq39w/hiding_public_ip/", ++ "exampleResult": "https://teddit.net/r/webhosting/comments/izq39w/hiding_public_ip/", ++ "error": null, ++ "includePattern": "https://old.reddit.com/(.*)", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://teddit.net/$1", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": true, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "Google to ddg", ++ "exampleUrl": "https://www.google.com/search?q=example", ++ "exampleResult": "https://html.duckduckgo.com/html?q=example", ++ "error": null, ++ "includePattern": "https://www.google.com/search?q=*", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://html.duckduckgo.com/html?q=$1", ++ "patternType": "W", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "instagram to bibliogram", ++ "exampleUrl": "https://www.instagram.com/natgeo", ++ "exampleResult": "https://bibliogram.froth.zone/u/natgeo", ++ "error": null, ++ "includePattern": "https://www.instagram.com/(.*)", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://bibliogram.froth.zone/u/$1", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "ddg to ddg html", ++ "exampleUrl": "https://duckduckgo.com/?t=ffsb&q=xml", ++ "exampleResult": "https://html.duckduckgo.com/html?q=xml", ++ "error": null, ++ "includePattern": "https://duckduckgo.com/(.*)&q=(.*)", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://html.duckduckgo.com/html?q=$2", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "imgur to raw image", ++ "exampleUrl": "https://imgur.com/nWjVtF1", ++ "exampleResult": "https://i.imgur.com/nWjVtF1", ++ "error": null, ++ "includePattern": "https://imgur.com/*", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://i.imgur.com/$1", ++ "patternType": "W", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "php manual to english", ++ "exampleUrl": "https://www.php.net/manual/ru/function.debug-backtrace.php", ++ "exampleResult": "https://www.php.net/manual/en/function.debug-backtrace.php", ++ "error": null, ++ "includePattern": "https://www.php.net/manual/ru/*", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://www.php.net/manual/en/$1", ++ "patternType": "W", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "google sheets", ++ "exampleUrl": "https://docs.google.com/spreadsheets/d/1cKXeUVJ2W2y7FjwnqchNrJllnm11fBW0xWWTF97ewE8/edit?usp=drivesdk", ++ "exampleResult": "https://docs.google.com/spreadsheets/d/1cKXeUVJ2W2y7FjwnqchNrJllnm11fBW0xWWTF97ewE8/export?format=ods", ++ "error": null, ++ "includePattern": "https://docs.google.com/spreadsheets/(.*)/.*", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://docs.google.com/spreadsheets/$1/export?format=ods", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "google docs", ++ "exampleUrl": "https://docs.google.com/document/d/1P4bAdnp8JqZRH9EXz4MrQzrb2oCwnJM-myy_jCXLMLo/edit", ++ "exampleResult": "https://docs.google.com/document/d/1P4bAdnp8JqZRH9EXz4MrQzrb2oCwnJM-myy_jCXLMLo/export?format=odt", ++ "error": null, ++ "includePattern": "https://docs.google.com/document/(.*)/.*", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://docs.google.com/document/$1/export?format=odt", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "ghc (hackage) -> ghc-9.2.2 (download.haskell.org)", ++ "exampleUrl": "https://hackage.haskell.org/package/ghc/docs/GHC-Unit-State.html#v:lookupPackageName", ++ "exampleResult": "https://downloads.haskell.org/ghc/9.2.2/docs/html/libraries/ghc-9.2.2/GHC-Unit-State.html#v:lookupPackageName", ++ "error": null, ++ "includePattern": "https://hackage.haskell.org/package/ghc/docs/*", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://downloads.haskell.org/ghc/9.2.2/docs/html/libraries/ghc-9.2.2/$1", ++ "patternType": "W", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "remove ddg tracking", ++ "exampleUrl": "https://duckduckgo.com/l/?uddg=https%3A%2F%2Fsimplecheatsheet.com%2Forg%2Dmode%2Dtables%2F&rut=dfcd39afaca8d93796ddc81b894abc0c6bb471b47cb709e7331a91a0f88a9ec4", ++ "exampleResult": "https://simplecheatsheet.com/org-mode-tables/", ++ "error": null, ++ "includePattern": "https://duckduckgo.com/l/?uddg=*&rut=*", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "$1", ++ "patternType": "W", ++ "processMatches": "urlDecode", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "tiktok to proxitok", ++ "exampleUrl": "https://www.tiktok.com/@tiktok", ++ "exampleResult": "https://proxitok.pabloferreiro.es/@tiktok", ++ "error": null, ++ "includePattern": "(.*//.*)(tiktok.com)(.*)", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://proxitok.pabloferreiro.es$3", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "Imgur -> rimgo", ++ "exampleUrl": "https://imgur.com/a/H8M4rcp", ++ "exampleResult": "https://rimgo.projectsegfau.lt/a/H8M4rcp", ++ "error": null, ++ "includePattern": "^https?://i?.?imgur.com(/.*)?$", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://rimgo.projectsegfau.lt$1", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "medium.com -> scribe.rip", ++ "exampleUrl": "https://medium.com/@zw3rk/template-haskell-75c7b67f9718", ++ "exampleResult": "https://scribe.rip/@zw3rk/template-haskell-75c7b67f9718", ++ "error": null, ++ "includePattern": "https://medium.com/(.*)", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://scribe.rip/$1", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "Quora to Quetre", ++ "exampleUrl": "https://www.quora.com/Linux-Kernel-Why-are-we-using-two-variables-mm_users-and-mm_count-in-mm_struct?share=1", ++ "exampleResult": "https://quetre.esmailelbob.xyz/Linux-Kernel-Why-are-we-using-two-variables-mm_users-and-mm_count-in-mm_struct?share=1", ++ "error": null, ++ "includePattern": "https:\\/\\/.{2,}\\.quora\\.com\\/(.*)", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://quetre.esmailelbob.xyz/$1", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "IMDb to libremdb", ++ "exampleUrl": "https://www.imdb.com/title/tt0258463/?ref_=tt_sims_tt_t_4", ++ "exampleResult": "https://libremdb.nerdyfam.tech/title/tt0258463/?ref_=tt_sims_tt_t_4", ++ "error": null, ++ "includePattern": "https?:\\/\\/(www\\.)?imdb\\.com\\/(.*)", ++ "excludePattern": "https?://(www\\.)?imdb\\.com/chart/toptv", ++ "patternDesc": "", ++ "redirectUrl": "https://libremdb.nerdyfam.tech/$2", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "fandom to breezewiki", ++ "exampleUrl": "https://minecraft.fandom.com/wiki/Bricks", ++ "exampleResult": "https://breezewiki.com/minecraft/wiki/Bricks", ++ "error": null, ++ "includePattern": "https://*.fandom.com/wiki/*", ++ "excludePattern": "https://www.fandom.com/*", ++ "patternDesc": "", ++ "redirectUrl": "https://breezewiki.com/$1/wiki/$2", ++ "patternType": "W", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "goodreads to biblioreads", ++ "exampleUrl": "https://www.goodreads.com/book/show/5907.The_Hobbit", ++ "exampleResult": "https://biblioreads.ml/book/show/5907.The_Hobbit", ++ "error": null, ++ "includePattern": "^(?:https?://)www\\.goodreads\\.com/(book|work|author|series|quotes)(.*)", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://biblioreads.ml/$1$2", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": true, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ }, ++ { ++ "description": "reddit to old reddit", ++ "exampleUrl": "https://www.reddit.com/r/torrents/comments/g5yffq/qbittorrent_vs_transmission_how_are_you_guys_even/", ++ "exampleResult": "https://old.reddit.com/r/torrents/comments/g5yffq/qbittorrent_vs_transmission_how_are_you_guys_even/", ++ "error": null, ++ "includePattern": "https://(www)?.reddit.com/(.*)", ++ "excludePattern": "", ++ "patternDesc": "", ++ "redirectUrl": "https://old.reddit.com/$2", ++ "patternType": "R", ++ "processMatches": "noProcessing", ++ "disabled": false, ++ "grouped": false, ++ "appliesTo": [ ++ "main_frame" ++ ] ++ } ++]; + var REDIRECTS = []; // The global redirects list... + var options = { + isSyncEnabled : false +@@ -280,24 +639,10 @@ function pageLoad() { + + if (response.redirects.length === 0) { + //Add example redirect for first time users... +- REDIRECTS.push(new Redirect( +- { +- "description": "Example redirect, try going to http://example.com/anywordhere", +- "exampleUrl": "http://example.com/some-word-that-matches-wildcard", +- "exampleResult": "https://google.com/search?q=some-word-that-matches-wildcard", +- "error": null, +- "includePattern": "http://example.com/*", +- "excludePattern": "", +- "patternDesc": "Any word after example.com leads to google search for that word.", +- "redirectUrl": "https://google.com/search?q=$1", +- "patternType": "W", +- "processMatches": "noProcessing", +- "disabled": false, +- "appliesTo": [ +- "main_frame" +- ] +- } +- )); ++ for (var i=0; i < DEFAULT_REDIRECTS.length; i++) { ++ REDIRECTS.push(new Redirect(DEFAULT_REDIRECTS[i])); ++ } ++ saveChanges(); + } + renderRedirects(); + }); +diff --git a/manifest.json b/manifest.json +index 19b88bb..835d676 100644 +--- a/manifest.json ++++ b/manifest.json +@@ -2,7 +2,7 @@ + "manifest_version": 2, + "name": "Redirector", + "description": "Automatically redirect content based on user-defined rules.", +- "version": "3.5.4", ++ "version": "3.5.4-custom", + "icons": { + "16": "images/icon-light-theme-16.png", + "19": "images/icon-light-theme-19.png", +@@ -89,4 +89,4 @@ + } + ] + } +-} +\ No newline at end of file ++} +-- +2.41.0 + -- cgit v1.2.3