about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorHygna <hygna@proton.me>2022-09-30 14:54:56 +0100
committerHygna <hygna@proton.me>2022-09-30 14:54:56 +0100
commit18facf37a2f058b1314f5fd3a1f9d36c70ba27f5 (patch)
tree5042ecbc2172c95a7a505ae71a7f3e263dfaa1d8 /src
parentChanges: (diff)
downloadlibredirect-18facf37a2f058b1314f5fd3a1f9d36c70ba27f5.zip
Squashed a few bugs
Diffstat (limited to 'src')
-rw-r--r--src/assets/images/sendTargets-icon.svg3
-rw-r--r--src/assets/javascripts/services.js36
-rw-r--r--src/assets/javascripts/utils.js124
-rw-r--r--src/config/config.json19
-rw-r--r--src/pages/background/background.js30
-rw-r--r--src/pages/options/index.html14
-rw-r--r--src/pages/options/widgets/general.js2
-rw-r--r--src/pages/options/widgets/services.js2
-rw-r--r--src/pages/popup/popup.html20
9 files changed, 131 insertions, 119 deletions
diff --git a/src/assets/images/sendTargets-icon.svg b/src/assets/images/sendTargets-icon.svg
deleted file mode 100644
index 5557664e..00000000
--- a/src/assets/images/sendTargets-icon.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
-  <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path>
-</svg>
diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js
index 49af6d1f..404962ee 100644
--- a/src/assets/javascripts/services.js
+++ b/src/assets/javascripts/services.js
@@ -391,7 +391,7 @@ function redirect(url, type, initiator) {
 	}

 }

 

-function initDefaults() {

+async function initDefaults() {

 	return new Promise(async resolve => {

 		fetch("/instances/data.json")

 			.then(response => response.text())

@@ -400,13 +400,12 @@ function initDefaults() {
 					let redirects = JSON.parse(data)

 					let options = r.options

 					let targets = {}

-					// let latency = {}

+					const localstorage = {}

+					const latency = {}

 					for (const service in config.services) {

 						options[service] = {}

-						// latency[service] = {}

 						if (config.services[service].targets == "datajson") {

 							targets[service] = redirects[service]

-							//delete dataJson[service]

 						}

 						for (const defaultOption in config.services[service].options) {

 							options[service][defaultOption] = config.services[service].options[defaultOption]

@@ -416,11 +415,11 @@ function initDefaults() {
 								options[frontend] = {}

 								for (const network in config.networks) {

 									options[frontend][network] = {}

-									options[frontend][network].enabled = redirects[frontend][network]

+									options[frontend][network].enabled = JSON.parse(data)[frontend][network]

 									options[frontend][network].custom = []

 								}

 								for (const blacklist in r.blacklists) {

-									for (const instance of blacklist) {

+									for (const instance of r.blacklists[blacklist]) {

 										let i = options[frontend].clearnet.enabled.indexOf(instance)

 										if (i > -1) options[frontend].clearnet.enabled.splice(i, 1)

 									}

@@ -428,7 +427,7 @@ function initDefaults() {
 							}

 						}

 					}

-					browser.storage.local.set({ redirects, options, targets /*, latency*/ })

+					browser.storage.local.set({ redirects, options, targets, latency, localstorage })

 					resolve()

 				})

 			})

@@ -449,7 +448,8 @@ function computeService(url, returnFrontend) {
 			}

 		}

 	}

-	return null

+	if (returnFrontend) return [null, null]

+	else return null

 }

 

 function switchInstance(url) {

@@ -515,7 +515,7 @@ function reverse(url) {
 	})

 }

 

-function unifyPreferences(url) {

+function unifyPreferences(url, tabId) {

 	return new Promise(async resolve => {

 		// await init()

 		// await getConfig()

@@ -539,7 +539,23 @@ function unifyPreferences(url) {
 				await utils.copyCookie(currentFrontend, url, instancesList, cookie)

 			}

 		}

-		if ("localStorage" in frontend.preferences) {

+		if ("localstorage" in frontend.preferences) {

+			browser.tabs.executeScript(tabId, {

+				code: "const frontend = " + frontend,

+				code: "const items = " + config.services[currentService].frontends[currentFrontend].preferences.localStorage,

+				//file: "/assets/javascripts/get-localstorage.js",

+				runAt: "document_start",

+			})

+

+			for (const instance of instancesList)

+				browser.tabs.create({ url: instance }, tab =>

+					browser.tabs.executeScript(tab.id, {

+						code: "const frontend = " + frontend,

+						code: "const items = " + config.services[currentService].frontends[currentFrontend].preferences.localStorage,

+						file: "/assets/javascripts/set-localstorage.js",

+						runAt: "document_start",

+					})

+				)

 		}

 		if ("indexeddb" in frontend.preferences) {

 		}

diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js
index 186fae43..a1c559df 100644
--- a/src/assets/javascripts/utils.js
+++ b/src/assets/javascripts/utils.js
@@ -59,27 +59,26 @@ function protocolHost(url) {
 	return `${url.protocol}//${url.host}`
 }
 
-async function processDefaultCustomInstances(service, name, network, document) {
+async function processDefaultCustomInstances(service, frontend, network, document) {
 	let instancesLatency
-	let nameNetworkElement = document.getElementById(name).getElementsByClassName(network)[0]
+	let frontendNetworkElement = document.getElementById(frontend).getElementsByClassName(network)[0]
 
-	let nameCustomInstances = []
-	let nameCheckListElement = nameNetworkElement.getElementsByClassName("checklist")[0]
+	let frontendCustomInstances = []
+	let frontendCheckListElement = frontendNetworkElement.getElementsByClassName("checklist")[0]
 
 	await initBlackList()
 
-	let nameDefaultRedirects
+	let frontendDefaultRedirects
 
 	let redirects, options
 
 	async function getFromStorage() {
 		return new Promise(async resolve =>
 			browser.storage.local.get(["options", "redirects", "latency"], r => {
-				nameDefaultRedirects = r.options[name][network].enabled
-				nameCustomInstances = r.options[name][network].custom
+				frontendDefaultRedirects = r.options[frontend][network].enabled
+				frontendCustomInstances = r.options[frontend][network].custom
 				options = r.options
-				if (r.latency) instancesLatency = r.latency[name] ?? []
-				else instancesLatency = []
+				instancesLatency = r.latency[frontend] ?? []
 				redirects = r.redirects
 				resolve()
 			})
@@ -88,27 +87,26 @@ async function processDefaultCustomInstances(service, name, network, document) {
 
 	await getFromStorage()
 
-	function calcNameCheckBoxes() {
+	function calcFrontendCheckBoxes() {
 		let isTrue = true
-		for (const item of redirects[name][network]) {
-			if (nameDefaultRedirects === undefined) console.log(name + network + " is undefined")
-			if (!nameDefaultRedirects.includes(item)) {
+		for (const item of redirects[frontend][network]) {
+			if (!frontendDefaultRedirects.includes(item)) {
 				isTrue = false
 				break
 			}
 		}
-		for (const element of nameCheckListElement.getElementsByTagName("input")) {
-			element.checked = nameDefaultRedirects.includes(element.className)
+		for (const element of frontendCheckListElement.getElementsByTagName("input")) {
+			element.checked = frontendDefaultRedirects.includes(element.className)
 		}
-		if (nameDefaultRedirects.length == 0) isTrue = false
-		nameNetworkElement.getElementsByClassName("toggle-all")[0].checked = isTrue
+		if (frontendDefaultRedirects.length == 0) isTrue = false
+		frontendNetworkElement.getElementsByClassName("toggle-all")[0].checked = isTrue
 	}
-	nameCheckListElement.innerHTML = [
+	frontendCheckListElement.innerHTML = [
 		`<div>
         <x data-localise="__MSG_toggleAll__">Toggle All</x>
         <input type="checkbox" class="toggle-all"/>
       </div>`,
-		...redirects[name][network].map(x => {
+		...redirects[frontend][network].map(x => {
 			const cloudflare = cloudflareBlackList.includes(x) ? ' <span style="color:red;">cloudflare</span>' : ""
 			const authenticate = authenticateBlackList.includes(x) ? ' <span style="color:orange;">authenticate</span>' : ""
 			const offline = offlineBlackList.includes(x) ? ' <span style="color:grey;">offline</span>' : ""
@@ -132,33 +130,33 @@ async function processDefaultCustomInstances(service, name, network, document) {
 
 	localise.localisePage()
 
-	calcNameCheckBoxes()
-	nameNetworkElement.getElementsByClassName("toggle-all")[0].addEventListener("change", async event => {
-		if (event.service.checked) nameDefaultRedirects = [...redirects[name][network]]
-		else nameDefaultRedirects = []
+	calcFrontendCheckBoxes()
+	frontendNetworkElement.getElementsByClassName("toggle-all")[0].addEventListener("change", async event => {
+		if (event.target.checked) frontendDefaultRedirects = [...redirects[frontend][network]]
+		else frontendDefaultRedirects = []
 
-		options[service][network].enabled = nameDefaultRedirects
+		options[frontend][network].enabled = frontendDefaultRedirects
 		browser.storage.local.set({ options })
-		calcNameCheckBoxes()
+		calcFrontendCheckBoxes()
 	})
 
-	for (let element of nameCheckListElement.getElementsByTagName("input")) {
+	for (let element of frontendCheckListElement.getElementsByTagName("input")) {
 		if (element.className != "toggle-all")
-			nameNetworkElement.getElementsByClassName(element.className)[0].addEventListener("change", async event => {
-				if (event.service.checked) nameDefaultRedirects.push(element.className)
+			frontendNetworkElement.getElementsByClassName(element.className)[0].addEventListener("change", async event => {
+				if (event.target.checked) frontendDefaultRedirects.push(element.className)
 				else {
-					let index = nameDefaultRedirects.indexOf(element.className)
-					if (index > -1) nameDefaultRedirects.splice(index, 1)
+					let index = frontendDefaultRedirects.indexOf(element.className)
+					if (index > -1) frontendDefaultRedirects.splice(index, 1)
 				}
 
-				options[service][network].enabled = nameDefaultRedirects
+				options[frontend][network].enabled = frontendDefaultRedirects
 				browser.storage.local.set({ options })
-				calcNameCheckBoxes()
+				calcFrontendCheckBoxes()
 			})
 	}
 
-	function calcNameCustomInstances() {
-		nameNetworkElement.getElementsByClassName("custom-checklist")[0].innerHTML = nameCustomInstances
+	function calcFrontendCustomInstances() {
+		frontendNetworkElement.getElementsByClassName("custom-checklist")[0].innerHTML = frontendCustomInstances
 			.map(
 				x => `<div>
                 ${x}
@@ -172,30 +170,30 @@ async function processDefaultCustomInstances(service, name, network, document) {
 			)
 			.join("\n")
 
-		for (const item of nameCustomInstances) {
-			nameNetworkElement.getElementsByClassName(`clear-${item}`)[0].addEventListener("click", async () => {
-				let index = nameCustomInstances.indexOf(item)
-				if (index > -1) nameCustomInstances.splice(index, 1)
-				options[service][network].custom = nameCustomInstances
+		for (const item of frontendCustomInstances) {
+			frontendNetworkElement.getElementsByClassName(`clear-${item}`)[0].addEventListener("click", async () => {
+				let index = frontendCustomInstances.indexOf(item)
+				if (index > -1) frontendCustomInstances.splice(index, 1)
+				options[frontend][network].custom = frontendCustomInstances
 				browser.storage.local.set({ options })
-				calcNameCustomInstances()
+				calcFrontendCustomInstances()
 			})
 		}
 	}
-	calcNameCustomInstances()
-	nameNetworkElement.getElementsByClassName("custom-instance-form")[0].addEventListener("submit", async event => {
+	calcFrontendCustomInstances()
+	frontendNetworkElement.getElementsByClassName("custom-instance-form")[0].addEventListener("submit", async event => {
 		event.preventDefault()
-		let nameCustomInstanceInput = nameNetworkElement.getElementsByClassName("custom-instance")[0]
-		let url = new URL(nameCustomInstanceInput.value)
+		let frontendCustomInstanceInput = frontendNetworkElement.getElementsByClassName("custom-instance")[0]
+		let url = new URL(frontendCustomInstanceInput.value)
 		let protocolHostVar = protocolHost(url)
-		if (nameCustomInstanceInput.validity.valid && !redirects[name][network].includes(protocolHostVar)) {
-			if (!nameCustomInstances.includes(protocolHostVar)) {
-				nameCustomInstances.push(protocolHostVar)
-				options[service][network].custom = nameCustomInstances
+		if (frontendCustomInstanceInput.validity.valid && !redirects[frontend][network].includes(protocolHostVar)) {
+			if (!frontendCustomInstances.includes(protocolHostVar)) {
+				frontendCustomInstances.push(protocolHostVar)
+				options[frontend][network].custom = frontendCustomInstances
 				browser.storage.local.set({ options })
-				nameCustomInstanceInput.value = ""
+				frontendCustomInstanceInput.value = ""
 			}
-			calcNameCustomInstances()
+			calcFrontendCustomInstances()
 		}
 	})
 }
@@ -245,11 +243,12 @@ function pingOnce(href) {
 async function testLatency(element, instances, frontend) {
 	return new Promise(async resolve => {
 		let myList = {}
-		let latencyThreshold
-		let redirectsChecks = []
+		let latencyThreshold, options
+		//let redirectsChecks = []
 		browser.storage.local.get(["options"], r => {
 			latencyThreshold = r.options.latencyThreshold
-			redirectsChecks = r.options[frontend].clearnet.enabled
+			//redirectsChecks = r.options[frontend].clearnet.enabled
+			options = r.options
 		})
 		for (const href of instances)
 			await ping(href).then(time => {
@@ -261,11 +260,9 @@ async function testLatency(element, instances, frontend) {
 					else color = "red"
 
 					if (time > latencyThreshold) {
-						redirectsChecks.splice(redirectsChecks.indexOf(href), 1)
+						options[frontend].clearnet.enabled.splice(options[frontend].clearnet.enabled.indexOf(href), 1)
 					}
 
-					browser.storage.local.set({ [`${frontend}ClearnetRedirectsChecks`]: redirectsChecks })
-
 					let text
 					if (time == 5000) text = "5000ms+"
 					else if (time > 5000) text = `ERROR: ${time - 5000}`
@@ -273,6 +270,7 @@ async function testLatency(element, instances, frontend) {
 					element.innerHTML = `${href}:&nbsp;<span style="color:${color};">${text}</span>`
 				}
 			})
+		browser.storage.local.set({ options })
 		resolve(myList)
 	})
 }
@@ -386,7 +384,7 @@ function unify() {
 					return
 				}
 
-				let result = await servicesHelper.unifyPreferences(url)
+				let result = await servicesHelper.unifyPreferences(url, currTab.id)
 
 				resolve(result)
 			}
@@ -417,21 +415,21 @@ function switchInstance(test) {
 	})
 }
 
-function latency(name, frontend, document, location) {
+function latency(service, frontend, document, location) {
 	let latencyElement = document.getElementById(`latency-${frontend}`)
 	let latencyLabel = document.getElementById(`latency-${frontend}-label`)
 	latencyElement.addEventListener("click", async () => {
 		let reloadWindow = () => location.reload()
 		latencyElement.addEventListener("click", reloadWindow)
-		let key = `${name} Redirects`
-		browser.storage.local.get(key, r => {
-			let redirects = r[key]
+		browser.storage.local.get(["redirects", "latency"], r => {
+			let redirects = r.redirects
 			const oldHtml = latencyLabel.innerHTML
 			latencyLabel.innerHTML = "..."
 			testLatency(latencyLabel, redirects[frontend].clearnet, frontend).then(r => {
-				browser.storage.local.set({ [`${frontend}Latency`]: r })
+				latency[frontend] = r
+				browser.storage.local.set({ latency })
 				latencyLabel.innerHTML = oldHtml
-				processDefaultCustomInstances(name, frontend, "clearnet", document)
+				processDefaultCustomInstances(service, frontend, "clearnet", document)
 				latencyElement.removeEventListener("click", reloadWindow)
 			})
 		})
diff --git a/src/config/config.json b/src/config/config.json
index e2b511b9..b15c20d4 100644
--- a/src/config/config.json
+++ b/src/config/config.json
@@ -48,7 +48,8 @@
 							"sponsorblock",

 							"theme",

 							"volume",

-							"watchHistory"

+							"watchHistory",

+							"localSubscriptions"

 						]

 					},

 					"name": "Piped",

@@ -490,13 +491,13 @@
 				},

 				"lingva": {

 					"preferences": {

-						"localstorage": ["isauto", "source", "target"]

+						"localstorage": ["isauto", "source", "target", "chakra-ui-color-mode"]

 					},

-					"name": "Lingva",

+					"name": "Lingva Translate",

 					"instanceList": true

 				}

 			},

-			"targets": ["^https?:\\/{2}translate\\.google(\\.[a-z]{2,3}){1,2}\\/"],

+			"targets": ["^https?:\\/{2}translate\\.google(\\.[a-z]{2,3}){1,2}\\/", "^https?:\\/{2}translate\\.libredirect\\.invalid"],

 			"name": "Translate",

 			"options": {

 				"enabled": true,

@@ -504,7 +505,7 @@
 			},

 			"imageType": "svgMono",

 			"embeddable": false,

-			"url": "https://translate.google.com"

+			"url": "https://translate.libredirect.invalid"

 		},

 		"maps": {

 			"frontends": {

@@ -518,7 +519,7 @@
 					"singleInstance": "https://www.openstreetmap.org"

 				}

 			},

-			"targets": ["^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)"],

+			"targets": ["^https?:\\/{2}maps\\.libredirect\\.invalid", "^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)"],

 			"name": "Maps",

 			"options": {

 				"enabled": true,

@@ -526,16 +527,16 @@
 			},

 			"imageType": "svgMono",

 			"embeddable": false,

-			"url": "https://maps.google.com"

+			"url": "https://maps.libredirect.invalid"

 		},

-		"sendTargets": {

+		"uploadFiles": {

 			"frontends": {

 				"send": {

 					"name": "Send",

 					"instanceList": "true"

 				}

 			},

-			"targets": ["^https?:\\/{2}send\\.libredirect\\.invalid\\/?$", "^https?:\\/{2}send\\.firefox\\.com\\/?$", "^https?:\\/{2}sendfiles\\.online\\/?$"],

+			"targets": ["^https?:\\/{2}send\\.libredirect\\.invalid", "^https?:\\/{2}send\\.firefox\\.com\\/?$", "^https?:\\/{2}sendfiles\\.online\\/?$"],

 			"name": "Send Files",

 			"options": { "enabled": true },

 			"imageType": "svgMono",

diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index e9bf691f..3a900609 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -6,20 +6,7 @@ import servicesHelper from "../../assets/javascripts/services.js"
 

 window.browser = window.browser || window.chrome

 

-browser.runtime.onInstalled.addListener(details => {

-	function initDefaults() {

-		fetch("/instances/blacklist.json")

-			.then(response => response.text())

-			.then(async data => {

-				browser.storage.local.clear(() => {

-					browser.storage.local.set({ blacklists: JSON.parse(data) }, () => {

-						generalHelper.initDefaults()

-						servicesHelper.initDefaults()

-					})

-				})

-			})

-	}

-

+browser.runtime.onInstalled.addListener(async details => {

 	// if (details.reason == 'install' || (details.reason == "update" && details.previousVersion != browser.runtime.getManifest().version)) {

 	//   if (details.reason == "update")

 	//     browser.storage.local.get(null, r => {

@@ -38,12 +25,25 @@ browser.runtime.onInstalled.addListener(details => {
 		case "update":

 			switch (details.previousVersion) {

 				case "2.2.1":

-					//do stuff

+					initDefaults()

 					break

 			}

 	}

 })

 

+function initDefaults() {

+	browser.storage.local.clear(() => {

+		fetch("/instances/blacklist.json")

+			.then(response => response.text())

+			.then(async data => {

+				browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => {

+					await generalHelper.initDefaults()

+					await servicesHelper.initDefaults()

+				})

+			})

+	})

+}

+

 let BYPASSTABs = []

 browser.webRequest.onBeforeRequest.addListener(

 	details => {

diff --git a/src/pages/options/index.html b/src/pages/options/index.html
index 6ef33723..71d04fd0 100644
--- a/src/pages/options/index.html
+++ b/src/pages/options/index.html
@@ -84,7 +84,7 @@
   <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path>
 </svg>
 
-    <a href="#sendTargets" data-localise="__MSG_sendTargets__">Send Files</a></div>
+    <a href="#uploadFiles" data-localise="__MSG_uploadFiles__">Send Files</a></div>
     <div class="title"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="currentColor">
   <path d="M11 17h2v-6h-2Zm1-8q.425 0 .713-.288Q13 8.425 13 8t-.287-.713Q12.425 7 12 7t-.712.287Q11 7.575 11 8t.288.712Q11.575 9 12 9Zm0 13q-2.075 0-3.9-.788-1.825-.787-3.175-2.137-1.35-1.35-2.137-3.175Q2 14.075 2 12t.788-3.9q.787-1.825 2.137-3.175 1.35-1.35 3.175-2.138Q9.925 2 12 2t3.9.787q1.825.788 3.175 2.138 1.35 1.35 2.137 3.175Q22 9.925 22 12t-.788 3.9q-.787 1.825-2.137 3.175-1.35 1.35-3.175 2.137Q14.075 22 12 22Zm0-2q3.35 0 5.675-2.325Q20 15.35 20 12q0-3.35-2.325-5.675Q15.35 4 12 4 8.65 4 6.325 6.325 4 8.65 4 12q0 3a.35 2.325 5.675Q8.65 20 12 20Zm0-8Z"></path>
 </svg>
@@ -318,9 +318,9 @@
   <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path>
 </svg>
 
-    <x data-localise="__MSG_sendTargets__">Send Files</x>
+    <x data-localise="__MSG_uploadFiles__">Send Files</x>
       </div>
-      <input id="sendTargets" type="checkbox">
+      <input id="uploadFiles" type="checkbox">
     </div>
     
 </div>
@@ -2818,7 +2818,7 @@
     <h4 data-localise="__MSG_frontend__">Frontend</h4>
     <select id="translate-frontend">
             <option value="simplyTranslate">SimplyTranslate</option>
-            <option value="lingva">Lingva</option>
+            <option value="lingva">Lingva Translate</option>
       
     </select>
   </div>
@@ -3134,14 +3134,14 @@
   </div>
         
 </section>
-<section class="option-block" id="sendTargets_page">
+<section class="option-block" id="uploadFiles_page">
   <div class="some-block option-block">
-    <h1 data-localise="__MSG_sendTargets__">Send Files</h1>
+    <h1 data-localise="__MSG_uploadFiles__">Send Files</h1>
   </div>
   <hr>
   <div class="some-block option-block">
     <h4 data-localise="__MSG_enable__">Enable</h4>
-    <input id="sendTargets-enabled" type="checkbox">
+    <input id="uploadFiles-enabled" type="checkbox">
   </div>
       <hr>
       <div id="send">
diff --git a/src/pages/options/widgets/general.js b/src/pages/options/widgets/general.js
index 23ed73ee..cd5cfb47 100644
--- a/src/pages/options/widgets/general.js
+++ b/src/pages/options/widgets/general.js
@@ -37,7 +37,6 @@ function setOption(option, multiChoice, event) {
 	browser.storage.local.get("options", r => {
 		let options = r.options
 		if (multiChoice) {
-			console.log(event.target.options)
 			options[option] = event.target.options[event.target.options.selectedIndex].value
 		} else {
 			options[option] = event.target.checked
@@ -95,6 +94,7 @@ resetSettings.addEventListener("click", async () => {
 			.then(response => response.text())
 			.then(async data => {
 				browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => {
+					await generalHelper.initDefaults()
 					await servicesHelper.initDefaults()
 					location.reload()
 				})
diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js
index 873950f3..98e068a1 100644
--- a/src/pages/options/widgets/services.js
+++ b/src/pages/options/widgets/services.js
@@ -77,7 +77,7 @@ function changeNetworkSettings() {
 changeNetworkSettings()
 for (const service in config.services) {
 	divs[service] = {}
-	divs[service][service] = document.getElementById(`${service}_page`)
+	//divs[service].page = document.getElementById(`${service}_page`)
 	for (const option in config.services[service].options) {
 		divs[service][option] = document.getElementById(`${service}-${option}`)
 
diff --git a/src/pages/popup/popup.html b/src/pages/popup/popup.html
index d52a34b6..56e4ca14 100644
--- a/src/pages/popup/popup.html
+++ b/src/pages/popup/popup.html
@@ -91,7 +91,7 @@
     <h4 data-localise="__MSG_search__">Search</h4></a>
   <input class="search-enabled" type="checkbox"/>
 </div>
-<div class="translate some-block"><a class="title" href="https://translate.google.com">
+<div class="translate some-block"><a class="title" href="https://translate.libredirect.invalid">
     <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
   <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path>
 </svg>
@@ -99,7 +99,7 @@
     <h4 data-localise="__MSG_translate__">Translate</h4></a>
   <input class="translate-enabled" type="checkbox"/>
 </div>
-<div class="maps some-block"><a class="title" href="https://maps.google.com">
+<div class="maps some-block"><a class="title" href="https://maps.libredirect.invalid">
     <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
   <path d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z"></path>
 </svg>
@@ -107,13 +107,13 @@
     <h4 data-localise="__MSG_maps__">Maps</h4></a>
   <input class="maps-enabled" type="checkbox"/>
 </div>
-<div class="sendTargets some-block"><a class="title" href="https://send.libredirect.invalid">
+<div class="uploadFiles some-block"><a class="title" href="https://send.libredirect.invalid">
     <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
   <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path>
 </svg>
 
-    <h4 data-localise="__MSG_sendTargets__">Send Files</h4></a>
-  <input class="sendTargets-enabled" type="checkbox"/>
+    <h4 data-localise="__MSG_uploadFiles__">Send Files</h4></a>
+  <input class="uploadFiles-enabled" type="checkbox"/>
 </div>
 
       <div id="current_site_divider">
@@ -204,7 +204,7 @@
     <h4 data-localise="__MSG_search__">Search</h4></a>
   <input class="search-enabled" type="checkbox"/>
 </div>
-<div class="translate some-block"><a class="title" href="https://translate.google.com">
+<div class="translate some-block"><a class="title" href="https://translate.libredirect.invalid">
     <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
   <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path>
 </svg>
@@ -212,7 +212,7 @@
     <h4 data-localise="__MSG_translate__">Translate</h4></a>
   <input class="translate-enabled" type="checkbox"/>
 </div>
-<div class="maps some-block"><a class="title" href="https://maps.google.com">
+<div class="maps some-block"><a class="title" href="https://maps.libredirect.invalid">
     <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
   <path d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z"></path>
 </svg>
@@ -220,13 +220,13 @@
     <h4 data-localise="__MSG_maps__">Maps</h4></a>
   <input class="maps-enabled" type="checkbox"/>
 </div>
-<div class="sendTargets some-block"><a class="title" href="https://send.libredirect.invalid">
+<div class="uploadFiles some-block"><a class="title" href="https://send.libredirect.invalid">
     <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
   <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path>
 </svg>
 
-    <h4 data-localise="__MSG_sendTargets__">Send Files</h4></a>
-  <input class="sendTargets-enabled" type="checkbox"/>
+    <h4 data-localise="__MSG_uploadFiles__">Send Files</h4></a>
+  <input class="uploadFiles-enabled" type="checkbox"/>
 </div>
 
     </div>