Compare commits

..

No commits in common. "759e403883981a39d14458eab9015fe2cf5a8627" and "811f8766eee28308817109a983fe86d87808f2e7" have entirely different histories.

21 changed files with 664 additions and 806 deletions

View File

@ -7,8 +7,7 @@
},
"scripts": {
"start": "web-ext run",
"nightly": "web-ext run --firefox=/home/manerakai/software/firefox_nightly/firefox",
"android": "web-ext run -t firefox-android --adb-device emulator-5554 --firefox-apk org.mozilla.fenix",
"start_ar": "web-ext run --firefox=/home/esmail/Downloads/ar/firefox/firefox --pref font.language.group=ar",
"build": "web-ext build",
"test": "web-ext lint",
"html": "pug --basedir ./ --obj ./src/config.json src/pages/options/index.pug --out src/pages/options/ && pug --basedir ./ --obj ./src/config.json src/pages/popup/popup.pug --out src/pages/popup/"

View File

@ -99,14 +99,5 @@
},
"about": {
"message": "Über"
},
"unsupportedIframesHandling": {
"message": "Umgang mit nicht unterstützten iFrames"
},
"fetchPublicInstances": {
"message": "Abrufen öffentlicher Instanzen"
},
"disable": {
"message": "Deaktivieren"
}
}

View File

@ -105,8 +105,5 @@
},
"disable": {
"message": "Désactiver"
},
"unsupportedIframesHandling": {
"message": "Gestion des iframes non prises en charge"
}
}

View File

@ -36,7 +36,7 @@
"description": "used in the settings page"
},
"excludeFromRedirecting": {
"message": "Excluído da redirección",
"message": "Excluded from redirecting",
"description": "used in the settings page"
},
"importSettings": {
@ -56,7 +56,7 @@
"description": "used in the settings page"
},
"showInPopup": {
"message": "Mostrar nunha ventá emerxente",
"message": "Show in popup",
"description": "used in the settings page"
},
"frontend": {
@ -76,21 +76,21 @@
"description": "used in the settings page"
},
"onlyNotEmbedded": {
"message": "non incrustados",
"message": "non incrustados",
"description": "used in the settings page"
},
"addYourFavoriteInstances": {
"message": "Engade as túas instancias favoritas",
"message": "Add your favorite instances",
"description": "used in the settings page"
},
"copyRaw": {
"message": "Copiar Orixinal"
"message": "Copiar en crú"
},
"copied": {
"message": "Copiouse"
"message": "Copied"
},
"redirectToOriginal": {
"message": "Ir ao orixinal",
"message": "Redirect to original",
"description": "Used in context menus when right clicking on a page/tab"
},
"redirectLink": {
@ -98,10 +98,10 @@
"description": "Used in context menus when right clicking on a hyperlink"
},
"about": {
"message": "Acerca de"
"message": "About"
},
"unsupportedIframesHandling": {
"message": "Xestión de iframes sen soporte"
"message": "Sen soporte para a xestión de iframes"
},
"fetchPublicInstances": {
"message": "Obter instancias públicas"

View File

@ -99,8 +99,5 @@
},
"about": {
"message": "Sobre"
},
"disable": {
"message": "Desativar"
}
}

View File

@ -36,15 +36,15 @@
"description": "used in the settings page"
},
"excludeFromRedirecting": {
"message": "Không được chuyển hướng",
"message": "Excluded from redirecting",
"description": "used in the settings page"
},
"importSettings": {
"message": "Nhập vào cài đặt",
"message": "Nhập cài đặt",
"description": "used in the settings page"
},
"exportSettings": {
"message": "Xuất ra cài đặt",
"message": "Xuất cài đặt",
"description": "used in the settings page"
},
"resetSettings": {
@ -72,25 +72,25 @@
"description": "used in the settings page"
},
"onlyEmbedded": {
"message": "chỉ các mã nhúng",
"message": "only embedded",
"description": "used in the settings page"
},
"onlyNotEmbedded": {
"message": "chỉ những cái không phải là mã nhúng",
"message": "only not embedded",
"description": "used in the settings page"
},
"addYourFavoriteInstances": {
"message": "Thêm những instance bạn yêu thích",
"message": "Add your favorite instances",
"description": "used in the settings page"
},
"copyRaw": {
"message": "Sao chép liên kết gốc"
"message": "Copy Raw"
},
"copied": {
"message": "Đã Sao Chép"
},
"redirectToOriginal": {
"message": "Chuyển hướng tới trang web gốc",
"message": "Redirect to original",
"description": "Used in context menus when right clicking on a page/tab"
},
"redirectLink": {
@ -99,14 +99,5 @@
},
"about": {
"message": "Về tiện ích"
},
"unsupportedIframesHandling": {
"message": "Cách xử lý các iframe không được hỗ trợ"
},
"fetchPublicInstances": {
"message": "Tìm các instance công cộng"
},
"disable": {
"message": "Tắt"
}
}

View File

@ -1,4 +1,63 @@
<svg width="36" height="32" viewBox="0 0 360 320" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M254.896 184.158C252.81 183.926 250.733 183.645 248.671 183.315C250.773 183.574 252.849 183.855 254.896 184.158Z" fill="white"/>
<path d="M180 141.964C163.699 110.262 119.308 51.1817 78.0347 22.044C38.4971 -5.86834 23.414 -1.03207 13.526 3.43594C2.08093 8.60755 0 26.1785 0 36.5164C0 46.8542 5.66748 121.272 9.36416 133.694C21.5786 174.738 65.0603 188.607 105.104 184.156C107.151 183.852 109.227 183.572 111.329 183.312C109.267 183.642 107.19 183.924 105.104 184.156C46.4204 192.847 -5.69621 214.233 62.6582 290.33C137.848 368.18 165.705 273.637 180 225.702C194.295 273.637 210.76 364.771 295.995 290.33C360 225.702 313.58 192.85 254.896 184.158C252.81 183.926 250.733 183.645 248.671 183.315C250.773 183.574 252.849 183.855 254.896 184.158C294.94 188.61 338.421 174.74 350.636 133.697C354.333 121.275 360 46.8568 360 36.519C360 26.1811 357.919 8.61012 346.474 3.43851C336.586 -1.02949 321.503 -5.86576 281.965 22.0466C240.692 51.1843 196.301 110.262 180 141.964Z" fill="#295ef6"/>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="512"
height="512"
viewBox="0 0 135.46666 135.46667"
version="1.1"
id="svg1"
xml:space="preserve"
inkscape:version="1.3.1 (91b66b0783, 2023-11-16)"
sodipodi:docname="bluesky-icon.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
inkscape:zoom="1.1452094"
inkscape:cx="358.01312"
inkscape:cy="227.46931"
inkscape:window-width="1888"
inkscape:window-height="1060"
inkscape:window-x="32"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" /><defs
id="defs1"><linearGradient
id="linearGradient1"
inkscape:collect="always"><stop
style="stop-color:#0062ff;stop-opacity:1;"
offset="0"
id="stop1" /><stop
style="stop-color:#0090fe;stop-opacity:1;"
offset="1"
id="stop2" /></linearGradient><linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1"
id="linearGradient2"
x1="-16.737301"
y1="0.19602649"
x2="-16.737301"
y2="136.34718"
gradientUnits="userSpaceOnUse" /></defs><g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"><rect
style="fill:url(#linearGradient2);stroke-width:1.165;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:0.53144"
id="rect1"
width="135.46667"
height="136.65152"
x="-4.9023438e-06"
y="-0.59242737"
ry="24.716606"
rx="24.716606" /></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,52 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
<svg
version="1.1"
id="Calque_1"
x="0px"
y="0px"
width="256px"
height="256px"
viewBox="0 0 256 256"
enable-background="new 0 0 256 256"
xml:space="preserve"
sodipodi:docname="Tumblr.svg"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs4" /><sodipodi:namedview
id="namedview4"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="2.622483"
inkscape:cx="108.10366"
inkscape:cy="127.93219"
inkscape:window-width="1888"
inkscape:window-height="1056"
inkscape:window-x="32"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="g4" />
<g
id="g4">
<g
id="g3"
style="fill:#314358;fill-opacity:1"
transform="matrix(1.2688081,0,0,1.2688081,-34.911581,-33.121241)">
<path
fill="#FFFFFF"
d="m 168.08,170.918 c -2.969,1.416 -8.647,2.648 -12.881,2.754 -12.783,0.342 -15.264,-8.979 -15.367,-15.736 v -49.705 h 32.065 V 84.055 H 139.943 V 43.382 c 0,0 -23.008,0 -23.383,0 -0.385,0 -1.057,0.337 -1.152,1.192 -1.368,12.448 -7.192,34.296 -31.416,43.032 v 20.624 h 16.16 v 52.167 c 0,17.863 13.176,43.24 47.959,42.641 11.736,-0.201 24.77,-5.113 27.648,-9.354 l -7.679,-22.766"
id="path2"
style="fill:#314358;fill-opacity:1" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -104,10 +104,7 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
initiator
&&
instanceList.includes(initiator.origin)
) {
if (type != "main_frame") return null
else return "BYPASSTAB"
}
) return "BYPASSTAB"
randomInstance = utils.getRandomInstance(instanceList)
if (config.services[service].frontends[frontend].localhost && options[service].instance == "localhost") {
@ -134,12 +131,36 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
}
return randomInstance
}
case "librey": {
case "librex": {
return `${randomInstance}/search.php${url.search}`
}
case "send": {
return randomInstance
}
case "nitter": {
let search = new URLSearchParams(url.search)
search.delete("ref_src")
search.delete("ref_url")
search.delete("s") // type of device that shared the link
search.delete("t") // some sort of tracking ID
search = search.toString()
if (search !== "") search = `?${search}`
if (url.host.split(".")[0] === "pbs" || url.host.split(".")[0] === "video") {
try {
const [, id, format, extra] = search.match(/(.*)\?format=(.*)&(.*)/)
const query = encodeURIComponent(`${id}.${format}?${extra}`)
return `${randomInstance}/pic${url.pathname}${query}`
} catch {
return `${randomInstance}/pic${url.pathname}${search}`
}
}
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": {
return url.href.replace(/^https?:\/{2}/, "yattee://")
}
@ -186,8 +207,9 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
return `${randomInstance}/${search}`
}
case "osm": {
const placeRegex = /\/place\/(.*?)\//
function convertMapCentre(url) {
const dataLatLngRegex = /!3d(-?[0-9]{1,}.[0-9]{1,})!4d(-?[0-9]{1,}.[0-9]{1,})/
const placeRegex = /\/place\/(.*)\//
function convertMapCentre() {
let [lat, lon, zoom] = [null, null, null]
const reg = url.pathname.match(/@(-?\d[0-9.]*),(-?\d[0-9.]*),(\d{1,2})[.z]/)
if (reg) {
@ -199,6 +221,14 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
}
return { zoom, lon, lat }
}
if (initiator && initiator.host === "earth.google.com") return randomInstance
const travelModes = {
driving: "fossgis_osrm_car",
walking: "fossgis_osrm_foot",
bicycling: "fossgis_osrm_bike",
transit: "fossgis_osrm_car", // not implemented on OSM, default to car.
}
function addressToLatLng(address) {
const http = new XMLHttpRequest()
http.open("GET", `https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(address)}&format=json&limit=1`, false)
@ -214,69 +244,86 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
return {}
}
}
function getQuery(url) {
let mapCentre = "#"
let prefs = {}
const mapCentreData = convertMapCentre()
if (mapCentreData.zoom && mapCentreData.lon && mapCentreData.lat) mapCentre = `#map=${mapCentreData.zoom}/${mapCentreData.lon}/${mapCentreData.lat}`
if (url.searchParams.get("layer")) prefs.layers = osmLayers[url.searchParams.get("layer")]
if (url.pathname.includes("/embed")) {
// Handle Google Maps Embed API
// https://www.google.com/maps/embed/v1/place?key=AIzaSyD4iE2xVSpkLLOXoyqT-RuPwURN3ddScAI&q=Eiffel+Tower,Paris+France
let query = ""
if (url.searchParams.has("q")) query = url.searchParams.get("q")
else if (url.searchParams.has("query")) query = url.searchParams.has("query")
return query
}
function prefsEncoded(prefs) {
return new URLSearchParams(prefs).toString()
}
else if (url.searchParams.has("pb"))
try {
query = url.searchParams.get("pb").split(/!2s(.*?)!/)[1]
} catch (error) {
// Unable to find map marker in URL.
console.error(error)
}
if (initiator && initiator.host === "earth.google.com") return randomInstance
let mapCentre = "#"
let prefs = { layers: "mapnik" }
const mapCentreData = convertMapCentre(url)
if (mapCentreData.zoom && mapCentreData.lon && mapCentreData.lat) mapCentre = `#map=${mapCentreData.zoom}/${mapCentreData.lon}/${mapCentreData.lat}`
if (url.pathname.includes("/embed")) { // https://www.google.com/maps/embed/v1/place?key=AIzaSyD4iE2xVSpkLLOXoyqT-RuPwURN3ddScAI&q=Eiffel+Tower,Paris+France
const query = getQuery(url)
let { coordinate, boundingbox } = addressToLatLng(query)
prefs.bbox = boundingbox
prefs.marker = coordinate
return `${randomInstance}/export/embed.html?${prefsEncoded(prefs)}`
prefs.layers = "mapnik"
let prefsEncoded = new URLSearchParams(prefs).toString()
return `${randomInstance}/export/embed.html?${prefsEncoded}`
} else if (url.pathname.includes("/dir")) {
// Handle Google Maps Directions
if (url.searchParams.has("travelmode")) {
const travelModes = {
driving: "fossgis_osrm_car",
walking: "fossgis_osrm_foot",
bicycling: "fossgis_osrm_bike",
transit: "fossgis_osrm_car", // not implemented on OSM, default to car.
}
prefs.engine = travelModes[url.searchParams.get("travelmode")]
}
const regex1 = /\/dir\/([^@/]+)\/([^@/]+)\/@-?\d[0-9.]*,-?\d[0-9.]*,\d{1,2}[.z]/.exec(url.pathname)
const regex2 = /\/dir\/([^@/]+)\//.exec(url.pathname)
if (regex1) { // https://www.google.com/maps/dir/92+Rue+Moncey,+69003+Lyon,+France/M%C3%A9dip%C3%B4le+Lyon-Villeurbanne/@45.760254,4.8486298,13z?travelmode=bicycling
if (regex1) {
// https://www.google.com/maps/dir/92+Rue+Moncey,+69003+Lyon,+France/M%C3%A9dip%C3%B4le+Lyon-Villeurbanne/@45.760254,4.8486298,13z?travelmode=bicycling
const origin = addressToLatLng(decodeURIComponent(regex1[1])).coordinate ?? ''
const destination = addressToLatLng(decodeURIComponent(regex1[2])).coordinate ?? ''
prefs.route = `${origin};${destination}`
} else if (regex2) { // https://www.google.com/maps/dir/92+Rue+Moncey,+69003+Lyon,+France/@45.760254,4.8486298,13z?travelmode=bicycling
} else if (regex2) {
// https://www.google.com/maps/dir/92+Rue+Moncey,+69003+Lyon,+France/@45.760254,4.8486298,13z?travelmode=bicycling
const origin = addressToLatLng(decodeURIComponent(regex2[1])).coordinate ?? ''
prefs.route = `${origin};`
} else { // https://www.google.com/maps/dir/?api=1&origin=Space+Needle+Seattle+WA&destination=Pike+Place+Market+Seattle+WA&travelmode=bicycling
} else {
// https://www.google.com/maps/dir/?api=1&origin=Space+Needle+Seattle+WA&destination=Pike+Place+Market+Seattle+WA&travelmode=bicycling
const origin = addressToLatLng(url.searchParams.get("origin")).coordinate ?? ''
const destination = addressToLatLng(url.searchParams.get("destination")).coordinate ?? ''
prefs.route = `${origin};${destination}`
}
return `${randomInstance}/directions?${prefsEncoded(prefs)}${mapCentre}`
} else if (url.pathname.match(placeRegex)) { // https://www.google.com/maps/place/H%C3%B4tel+de+Londres+Eiffel/@40.9845265,28.7081268,14z
const query = url.pathname.match(placeRegex)[1]
return `${randomInstance}/search?query=${query}${mapCentre}`
} else if (url.searchParams.has("ll")) { // https://maps.google.com/?ll=38.882147,-76.99017
const prefsEncoded = new URLSearchParams(prefs).toString()
return `${randomInstance}/directions?${prefsEncoded}${mapCentre}`
} else if (url.pathname.includes("data=") && url.pathname.match(dataLatLngRegex)) {
// Get marker from data attribute
// https://www.google.com/maps/place/41%C2%B001'58.2%22N+40%C2%B029'18.2%22E/@41.032833,40.4862063,17z/data=!3m1!4b1!4m6!3m5!1s0x0:0xf64286eaf72fc49d!7e2!8m2!3d41.0328329!4d40.4883948
let [, mlat, mlon] = url.pathname.match(dataLatLngRegex)
return `${randomInstance}/search?query=${mlat}%2C${mlon}`
} else if (url.searchParams.has("ll")) {
// Get marker from ll param
// https://maps.google.com/?ll=38.882147,-76.99017
const [mlat, mlon] = url.searchParams.get("ll").split(",")
return `${randomInstance}/search?query=${mlat}%2C${mlon}`
} else if (url.searchParams.has("viewpoint")) { // https://www.google.com/maps/@?api=1&map_action=pano&viewpoint=48.857832,2.295226&heading=-45&pitch=38&fov=80
} else if (url.searchParams.has("viewpoint")) {
// Get marker from viewpoint param.
// https://www.google.com/maps/@?api=1&map_action=pano&viewpoint=48.857832,2.295226&heading=-45&pitch=38&fov=80
const [mlat, mlon] = url.searchParams.get("viewpoint").split(",")
return `${randomInstance}/search?query=${mlat}%2C${mlon}`
} else {
const query = getQuery(url)
if (query) return `${randomInstance}/search?query="${query}${mapCentre}&${prefsEncoded(prefs)}`
// Use query as search if present.
let query
if (url.searchParams.has("q")) query = url.searchParams.get("q")
else if (url.searchParams.has("query")) query = url.searchParams.get("query")
else if (url.pathname.match(placeRegex)) query = url.pathname.match(placeRegex)[1]
let prefsEncoded = new URLSearchParams(prefs).toString()
if (query) return `${randomInstance}/search?query="${query}${mapCentre}&${prefsEncoded}`
}
return `${randomInstance}/${mapCentre}&${prefsEncoded(prefs)}`
let prefsEncoded = new URLSearchParams(prefs).toString()
return `${randomInstance}/${mapCentre}&${prefsEncoded}`
}
case "breezeWiki": {
let wiki, urlpath = ""
@ -304,7 +351,6 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
}
return `${randomInstance}${url.pathname}${url.search}`
}
case "redlib":
case "libreddit": {
const subdomain = url.hostname.match(/^(?:(?:external-)?preview|i)(?=\.redd\.it)/)
if (!subdomain) return `${randomInstance}${url.pathname}${url.search}`
@ -396,11 +442,12 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
}
case "gothub": {
if (url.hostname == "gist.github.com") return `${randomInstance}/gist${url.pathname}${url.search}`
if (url.hostname == "raw.githubusercontent.com") return `${randomInstance}/raw${url.pathname}${url.search}`
return `${randomInstance}${url.pathname}${url.search}`
}
case "mikuInvidious": {
console.log("Hello?")
if (url.hostname == "bilibili.com" || url.hostname == "www.bilibili.com" || url.hostname == 'b23.tv') {
console.log('wewe')
return `${randomInstance}${url.pathname}${url.search}`
}
if (url.hostname == "space.bilibili.com") {
@ -444,6 +491,7 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
}
case "binternet": {
if (url.hostname == "i.pinimg.com") return `${randomInstance}/image_proxy.php?url=${url.href}`
return randomInstance
}
case "laboratory": {
let path = url.pathname
@ -452,6 +500,7 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
}
case "quetre": {
const regex = /([a-z]+)\.quora\.com/.exec(url.hostname)
console.log(regex)
if (regex) {
const lang = regex[1]
url.searchParams.append("lang", lang)
@ -472,9 +521,6 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
const watch = url.pathname.substring(url.pathname.lastIndexOf('/') + 1)
return `${randomInstance}/watch?v=${watch}`
}
if (url.hostname.endsWith("youtube.com") && url.pathname.startsWith("/redirect?")) {
return url.href
}
return `${randomInstance}${url.pathname}${url.search}`
}
case "invidiousMusic": {
@ -525,32 +571,6 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
if (url.pathname == '/') return randomInstance
return `${randomInstance}?url=${encodeURIComponent(url.href)}`
}
case "priviblur": {
if (url.hostname == "www.tumblr.com")
return `${randomInstance}${url.pathname}${url.search}`
if (url.hostname.startsWith("assets"))
return `${randomInstance}/tblr/assets${url.pathname}${url.search}`
if (url.hostname.startsWith("static"))
return `${randomInstance}/tblr/static${url.pathname}${url.search}`
const reg = /^([0-9]+)\.media\.tumblr\.com/.exec(url.hostname) // *.media.tumblr.com
if (reg)
return `${randomInstance}/tblr/media/${reg[1]}${url.pathname}${url.search}`
const blogregex = /^(?:www\.)?([a-z\d-]+)\.tumblr\.com/.exec(url.hostname) // <blog>.tumblr.com
if (blogregex) {
const blog_name = blogregex[1];
// Under the <blog>.tumblr.com domain posts are under a /post path
if (url.pathname.startsWith("/post")) {
return `${randomInstance}/${blog_name}${url.pathname.slice(5)}${url.search}`
} else {
return `${randomInstance}/${blog_name}${url.pathname}${url.search}`;
}
}
return `${randomInstance}${url.pathname}${url.search}`;
}
default: {
return `${randomInstance}${url.pathname}${url.search}`
}
@ -598,11 +618,7 @@ function switchInstance(url, customService) {
if (customService) {
const instancesList = options[options[customService].frontend]
if (instancesList !== undefined) {
const newInstance = utils.getNextInstance(url.origin, instancesList)
if (newInstance) {
resolve(`${newInstance}${url.pathname}${url.search}`)
return
}
resolve(`${utils.getRandomInstance(instancesList)}${url.pathname}${url.search}`)
}
} else {
for (const service in config.services) {
@ -615,11 +631,8 @@ function switchInstance(url, customService) {
resolve()
return
}
const newInstance = utils.getNextInstance(url.origin, instancesList)
if (newInstance) {
resolve(`${newInstance}${url.pathname}${url.search}`)
return
}
resolve(`${utils.getRandomInstance(instancesList)}${url.pathname}${url.search}`)
return
}
}
resolve()
@ -642,6 +655,7 @@ async function reverse(url) {
case "imdb":
case "imgur":
case "tiktok":
case "twitter":
case "reddit":
case "imdb":
case "snopes":
@ -682,13 +696,12 @@ async function reverse(url) {
const defaultInstances = {
'invidious': ['https://inv.vern.cc'],
'viewtube': ['https://viewtube.io'],
'piped': ['https://pipedapi-libre.kavin.rocks'],
'pipedMaterial': ['https://piped-material.xn--17b.net'],
'cloudtube': ['https://tube.cadence.moe'],
'poketube': ['https://poketube.fun'],
'proxiTok': ['https://proxitok.pabloferreiro.es'],
'redlib': ['https://safereddit.com'],
'nitter': ['https://nitter.net'],
'libreddit': ['https://libreddit.spike.codes'],
'teddit': ['https://teddit.net'],
'scribe': ['https://scribe.rip'],
@ -701,6 +714,7 @@ const defaultInstances = {
'4get': ['https://4get.ca'],
'rimgo': ['https://rimgo.vern.cc'],
'hyperpipe': ['https://hyperpipe.surge.sh'],
'facil': [' https://facilmap.org '],
'osm': ['https://www.openstreetmap.org'],
'breezeWiki': ['https://breezewiki.com'],
'neuters': ['https://neuters.de'],
@ -728,7 +742,6 @@ const defaultInstances = {
'tuboSoundcloud': ['https://tubo.migalmoreno.com'],
'tekstoLibre': ['https://davilarek.github.io/TekstoLibre'],
'skyview': ['https://skyview.social'],
'priviblur': ['https://pb.bloat.cat'],
}
function initDefaults() {
@ -747,12 +760,12 @@ function initDefaults() {
}
}
}
options.exceptions = {
options['exceptions'] = {
url: [],
regex: [],
}
options.theme = "detect"
options.popupServices = ["youtube", "tiktok", "imgur", "reddit", "quora", "translate", "maps"]
options.popupServices = ["youtube", "twitter", "tiktok", "imgur", "reddit", "quora", "translate", "maps"]
options.fetchInstances = 'github'
options.redirectOnlyInIncognito = false
@ -779,27 +792,28 @@ function upgradeOptions() {
function processUpdate() {
return new Promise(async resolve => {
let frontends = []
const config = await utils.getConfig()
let config = await utils.getConfig()
let options = await utils.getOptions()
for (const service in config.services) {
if (!options[service]) options[service] = {}
if (!(options[service].frontend in config.services[service].frontends)) {
options[service] = config.services[service].options // Reset settings for service
delete options[options[service].frontend] // Remove deprecated frontend
options[service] = config.services[service].options
delete options[options[service].frontend]
}
for (const defaultOption in config.services[service].options) {
if (!(defaultOption in options[service])) {
if (options[service][defaultOption] === undefined) {
options[service][defaultOption] = config.services[service].options[defaultOption]
}
}
for (const frontend in config.services[service].frontends) {
frontends.push(frontend)
if (!(frontend in options) && config.services[service].frontends[frontend].instanceList) {
options[frontend] = defaultInstances[frontend] || []
if (options[frontend] === undefined && config.services[service].frontends[frontend].instanceList) {
options[frontend] = defaultInstances[frontend]
}
else if (frontend in options && !(frontend in config.services[service].frontends)) {
delete options[frontend]
}
}
@ -810,20 +824,6 @@ function processUpdate() {
}
}
}
const general = ['theme', 'popupServices', 'fetchInstances', 'redirectOnlyInIncognito']
const combined = [
...Object.keys(config.services),
...frontends,
...general,
'exceptions',
'popupServices',
'version',
]
for (const key in options) {
if (combined.indexOf(key) < 0) {
delete options[key] // Remove any unknown settings in options
}
}
browser.storage.local.set({ options }, () => {
resolve()
})

View File

@ -8,23 +8,6 @@ function getRandomInstance(instances) {
return instances[~~(instances.length * Math.random())]
}
/**
* @param {string} currentInstanceUrl
* @param {Array.<T>} instances
* @returns {T}
*/
function getNextInstance(currentInstanceUrl, instances) {
const currentInstanceIndex = instances.indexOf(currentInstanceUrl);
if (currentInstanceIndex === -1){
return getRandomInstance(instances);
}
const nextInstanceIndex = (currentInstanceIndex + 1) % instances.length;
return instances[nextInstanceIndex];
}
/**
* @param {string} str
*/
@ -214,7 +197,6 @@ function ping(href) {
export default {
getRandomInstance,
getNextInstance,
protocolHost,
getList,
getBlacklist,

File diff suppressed because it is too large Load Diff

View File

@ -7,9 +7,6 @@
"gecko": {
"id": "7esoorv3@alefvanoon.anonaddy.me",
"strict_min_version": "89.0"
},
"gecko_android": {
"strict_min_version": "113.0"
}
},
"background": {
@ -88,4 +85,4 @@
"default_locale": "en",
"update_url": "https://raw.githubusercontent.com/libredirect/libredirect/master/src/updates/updates.xml",
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAroWDSoSRZ1scj+eJRrvnhJbrqXTKnhQuxs6+AJg16sqr0bsMdFV+MSY4i4xnK+K5WOYkBliWXgUyk/wzicoAjOnSJddrL/Md4FuWHI2NVIkrlsLOrYkygi5OLqGPajRH/w8Cdmg7KzEpXe/OnYV0/qS8li8huEdTzdeLdhfbiVl1j3DOr4OJALQ7mPeeNFHFo/oVQ+OkSezWLezA5jUGfhtzPYV6u1TXzX7lCi8E/BbDbwkvvXOMcjXCv08kjdLOY2djCA2a6zr0xAb3q8DlexAMZ8vMof7AQRFtBKhLc9n9VFoipMMdBOVQQj/eIcRILBrmkcZNnJxFKiHNJ+NcZQIDAQAB"
}
}

View File

@ -71,7 +71,7 @@ browser.webRequest.onBeforeRequest.addListener(
if (tabIdRedirects[details.tabId] != false) tabIdRedirects[details.tabId] = false
return null
}
console.log("Redirecting", url.href, "=>", newUrl)
console.info("Redirecting", url.href, "=>", newUrl)
return { redirectUrl: newUrl }
}
return null
@ -160,7 +160,9 @@ browser.contextMenus.onClicked.addListener(async (info) => {
case 'switchInstanceTab': {
const url = new URL(info.pageUrl)
const newUrl = await servicesHelper.switchInstance(url)
if (newUrl) browser.tabs.update({ url: newUrl })
if (newUrl) {
browser.tabs.update({ url: newUrl })
}
return
}
case 'settingsTab': {

View File

@ -109,18 +109,6 @@ redirectOnlyInIncognitoElement.addEventListener('change', event => {
setOption('redirectOnlyInIncognito', 'checkbox', event)
})
const bookmarksMenuElement = document.getElementById('bookmarksMenu')
bookmarksMenuElement.addEventListener('change', async event => {
if (event.target.checked)
bookmarksMenuElement.checked = await browser.permissions.request({
permissions: ["bookmarks"]
})
else
bookmarksMenuElement.checked = !await browser.permissions.remove({
permissions: ["bookmarks"]
})
})
let themeElement = document.getElementById("theme")
themeElement.addEventListener("change", event => {
setOption("theme", "select", event)
@ -148,8 +136,7 @@ for (const service in config.services) {
let options = await utils.getOptions()
themeElement.value = options.theme
fetchInstancesElement.value = options.fetchInstances
redirectOnlyInIncognitoElement.checked = options.redirectOnlyInIncognito
bookmarksMenuElement.checked = await browser.permissions.contains({ permissions: ["bookmarks"] })
redirectOnlyInIncognitoElement.target.checked = options.redirectOnlyInIncognito
for (const service in config.services) document.getElementById(service).checked = options.popupServices.includes(service)
instanceTypeElement.addEventListener("change", event => {

View File

@ -21,10 +21,6 @@ section(class="block-option" id="general_page")
label(for='redirectOnlyInIncognito' data-localise="__MSG_redirectOnlyInIncognito__") Redirect Only in Incognito
input(id='redirectOnlyInIncognito' type="checkbox")
div(class="block block-option")
label(for='bookmarksMenu' data-localise="__MSG_bookmarksMenu__") Bookmarks menu
input(id='bookmarksMenu' type="checkbox")
div(class="block block-option")
label(data-localise="__MSG_excludeFromRedirecting__") Excluded from redirecting
@ -51,7 +47,7 @@ section(class="block-option" id="general_page")
path(d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z")
|&nbsp;
x(data-localise="__MSG_importSettings__") Import Settings
input(id="import-settings" type="file" accept=".json" style="display: none")
input(id="import-settings" type="file" style="display: none")
|&nbsp;&nbsp;

View File

@ -4,18 +4,7 @@ window.browser = window.browser || window.chrome
import servicesHelper from "../../assets/javascripts/services.js"
import utils from "../../assets/javascripts/utils.js"
document.getElementById("more-options").href = browser.runtime.getURL("pages/options/index.html")
document.getElementById("more-options").setAttribute('target', '_blank')
const os = (await browser.runtime.getPlatformInfo()).os
switch (os) {
case "fuchsia":
case "ios":
case "android": {
document.getElementsByTagName("html")[0].classList.add("mobile")
}
}
document.getElementById("more-options").addEventListener("click", () => browser.runtime.openOptionsPage())
const allSites = document.getElementById("all_sites")
const currSite = document.getElementById("current_site")

View File

@ -6,32 +6,6 @@ html(lang="en")
link(href="../stylesheets/styles.css" rel="stylesheet")
link(href="./style.css" rel="stylesheet")
body(dir="auto")
div(class="block" id="change_instance_div" style="display: none")
button(class="title button bottom-button" id="change_instance")
label(data-localise="__MSG_switchInstance__") Switch Instance
svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" preserveAspectRatio="xMinYMin meet" fill="currentColor")
path(d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z")
div(class="block" id="copy_original_div" title="Copy the original redirected link" style="display: none")
button(class="title button bottom-button" id="copy_original")
label() Copy Original
svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" preserveAspectRatio="xMinYMin meet" fill="currentColor")
path(d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z")
div(class="block" id="redirect_div" style="display: none")
button(class="title button bottom-button" id="redirect")
label Redirect
svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" preserveAspectRatio="xMinYMin meet" fill="currentColor")
path(d="M7 20v-9q0-.825.588-1.413Q8.175 9 9 9h8.2l-1.6-1.6L17 6l4 4-4 4-1.4-1.4 1.6-1.6H9v9Z")
div(class="block" id="redirect_to_original_div" style="display: none")
button(class="title button bottom-button" id="redirect_to_original")
label Redirect To Original
svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" preserveAspectRatio="xMinYMin meet" fill="currentColor")
path(d="M 17,20 V 11 Q 17,10.175 16.412,9.587 15.825,9 15,9 H 6.8 L 8.4,7.4 7,6 3,10 7,14 8.4,12.6 6.8,11 H 15 v 9 z" id="path2")
hr
div(id="current_site")
include /src/pages/popup/switches
div(id="current_site_divider" style="display: none")
@ -42,12 +16,36 @@ html(lang="en")
hr
div(class="block" id="change_instance_div" style="display: none")
button(class="title button bottom-button" id="change_instance")
label(data-localise="__MSG_switchInstance__") Switch Instance
svg(xmlns="http://www.w3.org/2000/svg" height="26px" width="26px" fill="currentColor")
path(d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z")
div(class="block" id="copy_original_div" title="Copy the original redirected link" style="display: none")
button(class="title button bottom-button" id="copy_original")
label() Copy Original
svg(xmlns="http://www.w3.org/2000/svg" height="24px" width="24px" fill="currentColor")
path(d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z")
div(class="block" id="redirect_div" style="display: none")
button(class="title button bottom-button" id="redirect")
label Redirect
svg(xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="currentColor")
path(d="M7 20v-9q0-.825.588-1.413Q8.175 9 9 9h8.2l-1.6-1.6L17 6l4 4-4 4-1.4-1.4 1.6-1.6H9v9Z")
div(class="block" id="redirect_to_original_div" style="display: none")
button(class="title button bottom-button" id="redirect_to_original")
label Redirect To Original
svg(xmlns="http://www.w3.org/2000/svg" height="24px" width="24px" fill="currentColor")
path(d="M 17,20 V 11 Q 17,10.175 16.412,9.587 15.825,9 15,9 H 6.8 L 8.4,7.4 7,6 3,10 7,14 8.4,12.6 6.8,11 H 15 v 9 z" id="path2")
div(class="block")
a(class="title button bottom-button" id="more-options")
button(class="title button bottom-button" id="more-options")
label(data-localise="__MSG_settings__") Settings
svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" preserveAspectRatio="xMinYMin meet" fill="currentColor")
svg(xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" width="26px" fill="currentColor")
path(d="m9.25 22-.4-3.2q-.325-.125-.612-.3-.288-.175-.563-.375L4.7 19.375l-2.75-4.75 2.575-1.95Q4.5 12.5 4.5 12.337v-.675q0-.162.025-.337L1.95 9.375l2.75-4.75 2.975 1.25q.275-.2.575-.375.3-.175.6-.3l.4-3.2h5.5l.4 3.2q.325.125.613.3.287.175.562.375l2.975-1.25 2.75 4.75-2.575 1.95q.025.175.025.337v.675q0 .163-.05.338l2.575 1.95-2.75 4.75-2.95-1.25q-.275.2-.575.375-.3.175-.6.3l-.4 3.2Zm2.8-6.5q1.45 0 2.475-1.025Q15.55 13.45 15.55 12q0-1.45-1.025-2.475Q13.5 8.5 12.05 8.5q-1.475 0-2.488 1.025Q8.55 10.55 8.55 12q0 1.45 1.012 2.475Q10.575 15.5 12.05 15.5Z")
div(class="space")
script(type="module" src="../options/init.js")
script(type="module" src="./popup.js")
script(type="module" src="./popup.js")

View File

@ -36,6 +36,7 @@ input {
width: 46px;
}
div.block label {
margin: 0;
font-size: 18px;
@ -49,17 +50,4 @@ div.block label:hover {
div.block div {
display: flex;
}
html.mobile body {
width: 100%;
}
html.mobile div.block label {
font-size: 24px;
}
html.mobile .button svg {
width: 30px;
height: 30px;
}

View File

@ -10,5 +10,5 @@ each _, service in services
div
input(class=`${service}-enabled` type="checkbox" aria-label=`toggle ${services[service].name}`)
button(class=`${service}-change_instance title button` aria-label=`change instance for ${services[service].name}`)
svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" preserveAspectRatio="xMinYMin meet" fill="currentColor")
svg(xmlns="http://www.w3.org/2000/svg" height="26px" width="26px" fill="currentColor")
path(d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z")

View File

@ -388,55 +388,4 @@ input:disabled {
width: 750px;
padding: 0 55px;
}
}
html.mobile img,
html.mobile svg {
margin-right: 10px;
height: 30px;
width: 30px;
color: var(--text);
}
html.mobile div.block {
padding: 0 15px;
justify-content: space-between;
display: flex;
align-items: center;
margin-top: 20px;
margin-bottom: 20px;
}
html.mobile div.block input[type="checkbox"] {
width: 58px;
height: 30px;
}
html.mobile div.block input[type="checkbox"]::before {
width: 24px;
height: 24px;
top: 3px;
left: 3.5px;
}
html.mobile div.block input[type="checkbox"]:checked::before {
left: 30px;
}
html.mobile body.option {
flex-direction: column;
width: 100%;
padding: 0;
align-items: center;
}
html.mobile section.links {
flex-direction: row;
width: 100%;
padding: 0 55px;
}
html.mobile section.block-option {
width: 100%;
}

View File

@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='oladmjdebphlnjjcnomfhhbfdldiimaf'>
<updatecheck codebase='https://github.com/libredirect/libredirect/releases/download/v2.8.2/libredirect-2.8.2.crx' version='2.8.2' />
<updatecheck codebase='https://github.com/libredirect/libredirect/releases/download/v2.8.0/libredirect-2.8.0.crx' version='2.8.0' />
</app>
</gupdate>