Added BiblioReads https://github.com/libredirect/libredirect/issues/524
This commit is contained in:
parent
856cc4f7af
commit
46a3ea1619
|
@ -21,10 +21,10 @@ A web extension that redirects YouTube, Twitter, TikTok... requests to alternati
|
|||
- Youtube Music <span>→</span> [Beatbump](https://github.com/snuffyDev/Beatbump), [Hyperpipe](https://codeberg.org/Hyperpipe/Hyperpipe)
|
||||
- Twitter <span>→</span> [Nitter](https://github.com/zedeus/nitter)
|
||||
- TikTok <span>→</span> [ProxiTok](https://github.com/pablouser1/ProxiTok)
|
||||
- Reddit <span>→</span> [Libreddit](https://github.com/spikecodes/libreddit#instances), [Teddit](https://codeberg.org/teddit/teddit#instances)
|
||||
- Reddit <span>→</span> [Libreddit](https://github.com/spikecodes/libreddit), [Teddit](https://codeberg.org/teddit/teddit)
|
||||
- Imgur <span>→</span> [Rimgo](https://codeberg.org/video-prize-ranch/rimgo)
|
||||
- Reuters <span>→</span> [Neuters](https://github.com/HookedBehemoth/neuters)
|
||||
- Medium <span>→</span> [Scribe](https://sr.ht/~edwardloveall/Scribe/)
|
||||
- Medium <span>→</span> [Scribe](https://sr.ht/~edwardloveall/Scribe/), [LibMedium](https://github.com/realaravinth/libmedium)
|
||||
- Quora <span>→</span> [Quetre](https://github.com/zyachel/quetre)
|
||||
- IMDb <span>→</span> [libremdb](https://github.com/zyachel/libremdb)
|
||||
- LBRY/Odysee <span>→</span> [Librarian](https://codeberg.org/librarian/librarian), [LBRY Desktop](https://lbry.com/get)
|
||||
|
@ -32,6 +32,9 @@ A web extension that redirects YouTube, Twitter, TikTok... requests to alternati
|
|||
- Translate <span>→</span> [SimplyTranslate](https://git.sr.ht/~metalune/simplytranslate_web), [LingvaTranslate](https://github.com/TheDavidDelta/lingva-translate), [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate)
|
||||
- Google Maps <span>→</span> [OpenStreetMap](https://www.openstreetmap.org/), [FacilMap](https://github.com/FacilMap/facilmap)
|
||||
- Send Files <span>→</span> [Send](https://gitlab.com/timvisee/send)
|
||||
- Genius <span>→</span> [Dumb](https://github.com/rramiachraf/dumb)
|
||||
- StackOverflow <span>→</span> [AnonymousOverflow](https://github.com/httpjamesm/AnonymousOverflow)
|
||||
- Goodreads <span>→</span> [BiblioReads](https://github.com/nesaku/BiblioReads)
|
||||
|
||||
**Note**: The Extension will be using random instances by default. You can modify this and add custom instances too.
|
||||
|
||||
|
|
|
@ -89,31 +89,37 @@ function redirect(url, type, initiator, forceRedirection) {
|
|||
}
|
||||
return [zoom, lon, lat]
|
||||
}
|
||||
|
||||
|
||||
if (!frontend) return
|
||||
|
||||
switch (frontend) {
|
||||
// This is where all instance-specific code must be ran to convert the service url to one that can be understood by the frontend.
|
||||
case "beatbump":
|
||||
case "beatbump": {
|
||||
return `${randomInstance}${url.pathname}${url.search}`
|
||||
.replace("/watch?v=", "/listen?id=")
|
||||
.replace("/channel/", "/artist/")
|
||||
.replace("/playlist?list=", "/playlist/VL")
|
||||
.replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/") + "?filter=all")
|
||||
case "hyperpipe":
|
||||
}
|
||||
case "hyperpipe": {
|
||||
return `${randomInstance}${url.pathname}${url.search}`.replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/"))
|
||||
case "lbryDesktop":
|
||||
}
|
||||
case "lbryDesktop": {
|
||||
return url.href.replace(/^https?:\/{2}odysee\.com\//, "lbry://").replace(/:(?=[a-zA-Z0-9])/g, "#")
|
||||
}
|
||||
case "searx":
|
||||
case "searxng":
|
||||
return `${randomInstance}/${url.search}`
|
||||
case "whoogle":
|
||||
case "whoogle": {
|
||||
return `${randomInstance}/search${url.search}`
|
||||
case "librex":
|
||||
}
|
||||
case "librex": {
|
||||
return `${randomInstance}/search.php${url.search}`
|
||||
case "send":
|
||||
}
|
||||
case "send": {
|
||||
return randomInstance
|
||||
case "nitter":
|
||||
}
|
||||
case "nitter": {
|
||||
let search = new URLSearchParams(url.search)
|
||||
|
||||
search.delete("ref_src")
|
||||
|
@ -135,17 +141,22 @@ function redirect(url, type, initiator, forceRedirection) {
|
|||
if (url.pathname.split("/").includes("tweets")) return `${randomInstance}${url.pathname.replace("/tweets", "")}${search}`
|
||||
if (url.host == "t.co") return `${randomInstance}/t.co${url.pathname}`
|
||||
return `${randomInstance}${url.pathname}${search}#m`
|
||||
case "yattee":
|
||||
}
|
||||
case "yattee": {
|
||||
return url.href.replace(/^https?:\/{2}/, "yattee://")
|
||||
case "freetube":
|
||||
}
|
||||
case "freetube": {
|
||||
return `freetube://https://youtu.be${url.pathname}${url.search}`.replace(/watch\?v=/, "")
|
||||
case "simplyTranslate":
|
||||
}
|
||||
case "simplyTranslate": {
|
||||
return `${randomInstance}/${url.search}`
|
||||
case "libreTranslate":
|
||||
}
|
||||
case "libreTranslate": {
|
||||
return `${randomInstance}/${url.search}`
|
||||
.replace(/(?<=\/?)sl/, "source")
|
||||
.replace(/(?<=&)tl/, "target")
|
||||
.replace(/(?<=&)text/, "q")
|
||||
}
|
||||
case "osm": {
|
||||
if (initiator && initiator.host === "earth.google.com") return
|
||||
const travelModes = {
|
||||
|
@ -338,7 +349,7 @@ function redirect(url, type, initiator, forceRedirection) {
|
|||
if (query) return `${randomInstance}/${mapCentre}/Mpnk/${query}`
|
||||
}
|
||||
}
|
||||
case "lingva":
|
||||
case "lingva": {
|
||||
let params_arr = url.search.split("&")
|
||||
params_arr[0] = params_arr[0].substring(1)
|
||||
let params = {}
|
||||
|
@ -350,7 +361,8 @@ function redirect(url, type, initiator, forceRedirection) {
|
|||
return `${randomInstance}/${params.sl}/${params.tl}/${params.text}`
|
||||
}
|
||||
return randomInstance
|
||||
case "breezeWiki":
|
||||
}
|
||||
case "breezeWiki": {
|
||||
let wiki, urlpath = ""
|
||||
if (url.hostname.match(/^[a-zA-Z0-9-]+\.(?:fandom|wikia)\.com/)) {
|
||||
wiki = url.hostname.match(/^[a-zA-Z0-9-]+(?=\.(?:fandom|wikia)\.com)/)
|
||||
|
@ -367,10 +379,12 @@ function redirect(url, type, initiator, forceRedirection) {
|
|||
}
|
||||
if (url.href.search(/Special:Search\?query/) > -1) return `${randomInstance}${wiki}${urlpath}${url.search}`.replace(/Special:Search\?query/, "search?q").replace(/\/wiki/, "")
|
||||
else return `${randomInstance}${wiki}${urlpath}${url.search}`
|
||||
case "rimgo":
|
||||
}
|
||||
case "rimgo": {
|
||||
if (url.href.search(/^https?:\/{2}(?:[im]\.)?stack\./) > -1) return `${randomInstance}/stack${url.pathname}${url.search}`
|
||||
else return `${randomInstance}${url.pathname}${url.search}`
|
||||
case "libreddit":
|
||||
}
|
||||
case "libreddit": {
|
||||
const subdomain = url.hostname.match(/^(?:(?:external-)?preview|i)(?=\.redd\.it)/)
|
||||
if (!subdomain) return `${randomInstance}${url.pathname}${url.search}`
|
||||
switch (subdomain[0]) {
|
||||
|
@ -381,12 +395,14 @@ function redirect(url, type, initiator, forceRedirection) {
|
|||
case "i":
|
||||
return `${randomInstance}/img${url.pathname}`
|
||||
}
|
||||
case "teddit":
|
||||
}
|
||||
case "teddit": {
|
||||
if (/^(?:(?:external-)?preview|i)\.redd\.it/.test(url.hostname)) {
|
||||
if (url.search == "") return `${randomInstance}${url.pathname}?teddit_proxy=${url.hostname}`
|
||||
else return `${randomInstance}${url.pathname}${url.search}&teddit_proxy=${url.hostname}`
|
||||
}
|
||||
return `${randomInstance}${url.pathname}${url.search}`
|
||||
}
|
||||
case "neuters": {
|
||||
const p = url.pathname
|
||||
if (p.startsWith('/article/') || p.startsWith('/pf/') || p.startsWith('/arc/') || p.startsWith('/resizer/')) {
|
||||
|
@ -405,6 +421,10 @@ function redirect(url, type, initiator, forceRedirection) {
|
|||
if (!url.pathname.startsWith('/questions') && url.pathname != '/') return
|
||||
return `${randomInstance}${url.pathname}${url.search}`
|
||||
}
|
||||
case "biblioReads": {
|
||||
if (!url.pathname.startsWith('/book/show/') && url.pathname != '/') return
|
||||
return `${randomInstance}${url.pathname}${url.search}`
|
||||
}
|
||||
default:
|
||||
return `${randomInstance}${url.pathname}${url.search}`
|
||||
}
|
||||
|
@ -547,6 +567,7 @@ function initDefaults() {
|
|||
options['dumb'] = ['https://dm.vern.cc']
|
||||
options['ruralDictionary'] = ['https://rd.vern.cc']
|
||||
options['anonymousOverflow'] = ['https://code.whatever.social']
|
||||
options['biblioReads'] = ['https://biblioreads.ml']
|
||||
|
||||
browser.storage.local.set({ options },
|
||||
() => resolve()
|
||||
|
|
|
@ -542,6 +542,25 @@
|
|||
"imageType": "svgMono",
|
||||
"embeddable": false,
|
||||
"url": "https://stackoverflow.com/"
|
||||
},
|
||||
"goodReads": {
|
||||
"frontends": {
|
||||
"biblioReads": {
|
||||
"name": "goodReads",
|
||||
"instanceList": true,
|
||||
"url": "https://github.com/nesaku/BiblioReads"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
"^https?:\\/{2}(www\\.)?goodreads\\.com\\/"
|
||||
],
|
||||
"name": "Goodreads",
|
||||
"options": {
|
||||
"enabled": false
|
||||
},
|
||||
"imageType": "svg",
|
||||
"embeddable": false,
|
||||
"url": "https://goodreads.com/"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue