about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--README.md29
-rw-r--r--src/assets/javascripts/services.js7
-rw-r--r--src/config.json68
-rw-r--r--src/pages/background/background.js4
-rw-r--r--src/pages/options/index.js18
-rw-r--r--src/pages/options/widgets/services.pug9
6 files changed, 80 insertions, 55 deletions
diff --git a/README.md b/README.md
index f22e0371..6424a2e5 100644
--- a/README.md
+++ b/README.md
@@ -1,48 +1,51 @@
 <img src="./img/libredirect_full.svg" height="50"/>
 
-A web extension that redirects YouTube, Twitter, TikTok... requests to alternative privacy friendly frontends and backends.
+A browser extension that redirects YouTube, Twitter, TikTok... requests to alternative privacy friendly frontends and backends.
 
-[![Firefox Add-on](./img/badge-amo.png)](https://addons.mozilla.org/firefox/addon/libredirect/)&nbsp;
+<a href="https://addons.mozilla.org/firefox/addon/libredirect/">
+    <img src ="./img/badge-amo.png" height=60 >
+</a>
+&nbsp;
 <a href="https://libredirect.github.io/download_chromium.html">
-<img src ="./img/badge-chromium.png" height=60 >
+    <img src ="./img/badge-chromium.png" height=60 >
 </a>
 
 ## Translate
-
-[![Weblate](./img/weblate.svg)](https://hosted.weblate.org/projects/libredirect/extension)
+<a href="https://hosted.weblate.org/projects/libredirect/extension">
+    <img src ="./img/weblate.svg">
+</a>
 
 ## Development
-Requirements: [Node.js LTS](https://nodejs.org/)
+Install [Node.js](https://nodejs.org/)
 ```bash
 git clone https://github.com/libredirect/browser_extension
 cd browser_extension
 npm install
-npm run html # Generates html files using Pug
-npm run start # Runs in debug mode in firefox using Web-ext
+npm run html # Generates html using Pug
+npm run start # Runs in firefox in debug mode using Web-ext
 ```
-### Run on Chromium manually
+### Build and Run on Chromium manually
 1. Open `chrome://extensions`
 2. Enable `dev mode`
 3. Select `load unpacked extension`
 4. Select `src` folder
 
-### Build zip package (Firefox)
+### Build a zip package for Firefox
 ```bash
 npm run build
 ```
-### Install zip package on Firefox (temporarily)
+### Install the zip package on Firefox (temporarily)
 3. Type in the address bar: `about:debugging#/runtime/this-firefox`
 4. Press `Load Temporary Add-on...`
 5. Select `libredirect-VERSION.zip` from `web-ext-artifacts` folder
 
-### Install zip package on Firefox ESR, Developer Edition, Nightly
+### Install the zip package on Firefox ESR, Developer Edition, Nightly
 3. Type in the address bar: `about:config`
 4. Set `xpinstall.signatures.required` to `false`
 5. Type in the address bar: `about:addons`
 6. Click on the gear shaped `settings` button and select `Install Add-on From File...`
 7. Select `libredirect-VERSION.zip` from `web-ext-artifacts` folder
 
-
 ---
 
 Forked from [Privacy Redirect](https://github.com/SimonBrazell/privacy-redirect)
diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js
index aa163451..61d033c0 100644
--- a/src/assets/javascripts/services.js
+++ b/src/assets/javascripts/services.js
@@ -56,7 +56,7 @@ function redirect(url, type, initiator, forceRedirection) {
 	for (const service in config.services) {
 		if (!forceRedirection && !options[service].enabled) continue
 
-		frontend = options[service].frontend ?? Object.keys(config.services[service].frontends)[0]
+		frontend = options[service].frontend
 
 		if (!regexArray(service, url, config, frontend)) {
 			frontend = null
@@ -210,7 +210,6 @@ function redirect(url, type, initiator, forceRedirection) {
 				.replace("tl", "target")
 				.replace("text", "q")
 			return `${randomInstance}/${search}`
-
 		}
 		case "lingva": {
 			let params_arr = url.search.split("&")
@@ -623,7 +622,7 @@ function switchInstance(url) {
 
 		const protocolHost = utils.protocolHost(url)
 		for (const service in config.services) {
-			let frontend = options[service].frontend ?? Object.keys(config.services[service].frontends)[0]
+			let frontend = options[service].frontend
 			let instancesList = options[frontend]
 			if (instancesList === undefined) continue
 			if (!instancesList.includes(protocolHost)) continue
@@ -650,7 +649,7 @@ function reverse(url) {
 
 		let protocolHost = utils.protocolHost(url)
 		for (const service in config.services) {
-			let frontend = options[service].frontend ?? Object.keys(config.services[service].frontends)[0]
+			let frontend = options[service].frontend
 			if (options[frontend] == undefined) continue
 			if (!options[frontend].includes(protocolHost)) continue
 
diff --git a/src/config.json b/src/config.json
index b68321be..32dec362 100644
--- a/src/config.json
+++ b/src/config.json
@@ -150,6 +150,7 @@
 				"enabled": false,
 				"redirectType": "main_frame",
 				"unsupportedUrls": "bypass",
+				"frontend": "nitter",
 				"instance": "public"
 			},
 			"imageType": "png",
@@ -171,7 +172,9 @@
 			"name": "TikTok",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "proxiTok",
+				"instance": "public"
 			},
 			"imageType": "png",
 			"embeddable": false,
@@ -224,6 +227,7 @@
 				"enabled": false,
 				"redirectType": "main_frame",
 				"unsupportedUrls": "bypass",
+				"frontend": "rimgo",
 				"instance": "public"
 			},
 			"imageType": "png",
@@ -289,7 +293,9 @@
 			"name": "Quora",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "quetre",
+				"instance": "public"
 			},
 			"imageType": "png",
 			"embeddable": false,
@@ -310,7 +316,9 @@
 			"name": "IMDb",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "libremdb",
+				"instance": "public"
 			},
 			"imageType": "svg",
 			"embeddable": false,
@@ -331,7 +339,8 @@
 			"options": {
 				"enabled": false,
 				"unsupportedUrls": "bypass",
-				"instance": "public"
+				"instance": "public",
+				"frontend": "breezeWiki"
 			},
 			"imageType": "svg",
 			"embeddable": false,
@@ -354,7 +363,8 @@
 			"options": {
 				"enabled": false,
 				"redirectType": "main_frame",
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "lbryDesktop"
 			},
 			"imageType": "png",
 			"embeddable": true,
@@ -391,7 +401,8 @@
 			"options": {
 				"enabled": false,
 				"frontend": "searxng",
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"instance": "public"
 			},
 			"imageType": "svgMono",
 			"embeddable": false,
@@ -475,7 +486,8 @@
 			"name": "Send Files",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "send"
 			},
 			"imageType": "svgMono",
 			"embeddable": false,
@@ -495,7 +507,8 @@
 			"name": "Paste Text",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "privateBin"
 			},
 			"imageType": "svgMono",
 			"embeddable": false,
@@ -515,7 +528,8 @@
 			"name": "Reuters",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "neuters"
 			},
 			"imageType": "svg",
 			"embeddable": false,
@@ -536,7 +550,9 @@
 			"name": "Genius",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "dumb",
+				"instance": "public"
 			},
 			"imageType": "svg",
 			"embeddable": false,
@@ -556,7 +572,8 @@
 			"name": "Urban Dictionary",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "ruralDictionary"
 			},
 			"imageType": "svg",
 			"embeddable": false,
@@ -578,7 +595,9 @@
 			"name": "Stack Overflow",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "anonymousOverflow",
+				"instance": "public"
 			},
 			"imageType": "svgMono",
 			"embeddable": false,
@@ -599,7 +618,9 @@
 			"name": "Goodreads",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "biblioReads",
+				"instance": "public"
 			},
 			"imageType": "svgMono",
 			"embeddable": false,
@@ -619,7 +640,8 @@
 			"name": "Wikipedia",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "wikiless"
 			},
 			"imageType": "svg",
 			"embeddable": false,
@@ -639,7 +661,8 @@
 			"name": "Snopes",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "suds"
 			},
 			"imageType": "svg",
 			"embeddable": false,
@@ -659,7 +682,8 @@
 			"name": "Wayback Machine",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "waybackClassic"
 			},
 			"imageType": "svgMono",
 			"embeddable": false,
@@ -679,7 +703,8 @@
 			"name": "GitHub",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "gothub"
 			},
 			"imageType": "svgMono",
 			"embeddable": false,
@@ -700,7 +725,8 @@
 			"name": "Bilibili",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "mikuInvidious"
 			},
 			"imageType": "svgMono",
 			"embeddable": false,
@@ -721,7 +747,8 @@
 			"name": "Bandcamp",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "tent"
 			},
 			"imageType": "svg",
 			"embeddable": false,
@@ -741,7 +768,8 @@
 			"name": "WolframAlpha",
 			"options": {
 				"enabled": false,
-				"unsupportedUrls": "bypass"
+				"unsupportedUrls": "bypass",
+				"frontend": "wolfreeAlpha"
 			},
 			"imageType": "svg",
 			"embeddable": false,
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 8e427763..cb925607 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -53,8 +53,8 @@ browser.webRequest.onBeforeRequest.addListener(
 		}
 
 		if (!newUrl) {
-			const match = url.href.match(/^https?:\/{2}(.*)\.libredirect\.invalid.*/)
-			if (match[1]) {
+			const match = url.href.match(/^https?:\/{2}.*\.libredirect\.invalid.*/)
+			if (match) {
 				browser.tabs.update({
 					url: browser.runtime.getURL(`/pages/messages/no_instance.html`)
 				});
diff --git a/src/pages/options/index.js b/src/pages/options/index.js
index 5b229656..c8eb500d 100644
--- a/src/pages/options/index.js
+++ b/src/pages/options/index.js
@@ -35,8 +35,10 @@ async function changeFrontendsSettings(service) {
 			if (typeof divs[service].frontend !== "undefined") {
 				if (frontend == divs[service].frontend.value) {
 					frontendDiv.style.display = ""
-					if (config.services[service].frontends[frontend].localhost == true) {
+					console.log(config.services[service].frontends[frontend].localhost)
+					if (config.services[service].frontends[frontend].localhost === true) {
 						document.getElementById(`${service}-instance-div`).style.display = ""
+
 						if (options[service].instance == "localhost") {
 							frontendDiv.style.display = "none"
 						}
@@ -50,7 +52,8 @@ async function changeFrontendsSettings(service) {
 		}
 	}
 	if (document.getElementById(`${service}-redirectType`)) {
-		const frontend = options[service].frontend ?? Object.keys(config.services[service].frontends)[0]
+		const frontend = options[service].frontend
+		console.log(frontend)
 		if (config.services[service].frontends[frontend].embeddable) {
 			document.getElementById(`${service}-redirectType`).innerHTML = `
 			<option value="both" data-localise="__MSG_both__">both</options>
@@ -59,19 +62,14 @@ async function changeFrontendsSettings(service) {
 			`
 			document.getElementById(`${service}-redirectType`).value = options[frontend].redirectType = options[service].redirectType
 		} else {
-			document.getElementById(`${service}-redirectType`).innerHTML = `
-			<option value="main_frame" data-localise="__MSG_onlyNotEmbedded__">Only Not Embedded</option>
-			`
+			document.getElementById(`${service}-redirectType`).innerHTML =
+				'<option value="main_frame" data-localise="__MSG_onlyNotEmbedded__">Only Not Embedded</option>'
 			options[service].redirectType = "main_frame"
 			browser.storage.local.set({ options })
 		}
 	}
 	const frontend_name_element = document.getElementById(`${service}_page`).getElementsByClassName("frontend_name")[0]
-	if (divs[service].frontend) {
-		frontend_name_element.href = config.services[service].frontends[divs[service].frontend.value].url
-	} else {
-		frontend_name_element.href = Object.values(config.services[service].frontends)[0].url
-	}
+	frontend_name_element.href = config.services[service].frontends[divs[service].frontend.value].url
 }
 
 async function loadPage(path) {
diff --git a/src/pages/options/widgets/services.pug b/src/pages/options/widgets/services.pug
index 6530bacf..7154050e 100644
--- a/src/pages/options/widgets/services.pug
+++ b/src/pages/options/widgets/services.pug
@@ -20,11 +20,8 @@ each val, service in services
                 h4
                     a(class="frontend_name" target="_blank" data-localise="__MSG_frontend__") Frontend
                 select(id=service+"-frontend")
-                    if Object.keys(services[service].frontends).length> 1
-                        each val, frontend in services[service].frontends
-                            option(value=frontend)=services[service].frontends[frontend].name
-                    else
-                        option(value=frontend)=Object.values(services[service].frontends)[0].name
+                    each val, frontend in services[service].frontends
+                        option(value=frontend)=services[service].frontends[frontend].name
 
             div(class="some-block option-block" id=service+"-instance-div")
                 h4() Instance
@@ -47,11 +44,11 @@ each val, service in services
                 div(class="some-block option-block")
                     h4 Set LibRedirect as Default Search Engine
 
-            hr            
 
             each val, frontend in services[service].frontends
                 if services[service].frontends[frontend].instanceList
                     div(id=frontend dir="ltr")
+                        hr        
                         div(dir="auto" class="some-block option-block")
                             h4(data-localise="__MSG_addYourFavoriteInstances__") Add your favorite instances