about summary refs log tree commit diff stats
path: root/src/pages
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/background/background.js154
-rw-r--r--src/pages/options/index.ejs13
-rw-r--r--src/pages/options/index.js233
-rw-r--r--src/pages/options/index.pug10
-rw-r--r--src/pages/options/init.js59
-rw-r--r--src/pages/options/widgets/about.ejs37
-rw-r--r--src/pages/options/widgets/general.ejs70
-rw-r--r--src/pages/options/widgets/general.js238
-rw-r--r--src/pages/options/widgets/general.pug57
-rw-r--r--src/pages/options/widgets/services.ejs75
-rw-r--r--src/pages/options/widgets/services.js113
-rw-r--r--src/pages/options/widgets/services.pug60
-rw-r--r--src/pages/popup/popup.ejs47
-rw-r--r--src/pages/popup/popup.js152
-rw-r--r--src/pages/popup/popup.pug39
-rw-r--r--src/pages/stylesheets/styles.css54
-rw-r--r--src/pages/widgets/head.ejs8
-rw-r--r--src/pages/widgets/head.pug7
-rw-r--r--src/pages/widgets/links.ejs23
-rw-r--r--src/pages/widgets/links.pug22
-rw-r--r--src/pages/widgets/switches.ejs11
-rw-r--r--src/pages/widgets/switches.pug10
22 files changed, 700 insertions, 792 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 33f0d40b..0d9a0010 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -6,44 +6,26 @@ import servicesHelper from "../../assets/javascripts/services.js"
 
 window.browser = window.browser || window.chrome
 
-browser.runtime.onInstalled.addListener(details => {
+browser.runtime.onInstalled.addListener(async details => {
 	if (details.previousVersion != browser.runtime.getManifest().version) {
 		// ^Used to prevent this running when debugging with auto-reload
-		fetch("/instances/blacklist.json")
-			.then(response => response.text())
-			.then(async data => {
-				browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => {
-					switch (details.reason) {
-						case "install":
-							browser.storage.local.get("options", async r => {
-								if (!r.options) {
-									await generalHelper.initDefaults()
-									await servicesHelper.initDefaults()
-								}
-							})
-							break
-						case "update":
-							switch (details.previousVersion) {
-								case "2.2.0":
-								case "2.2.1":
-									browser.storage.local.get("options", async r => {
-										if (!r.options) {
-											await generalHelper.initDefaults()
-											await servicesHelper.initDefaults()
-											await servicesHelper.upgradeOptions()
-										}
-									})
-									break
-								default:
-									await servicesHelper.processUpdate()
-							}
-					}
-				})
-			})
+		if (details.reason == "install") {
+			if (!(await utils.getOptions())) {
+				await servicesHelper.initDefaults()
+			}
+		}
+		else if (details.reason == "update") {
+			if (details.previousVersion == '2.3.4') {
+				await servicesHelper.upgradeOptions()
+			}
+			// await servicesHelper.processUpdate()
+		}
+		browser.runtime.openOptionsPage()
 	}
 })
 
 let tabIdRedirects = {}
+
 // true == Always redirect, false == Never redirect, null/undefined == follow options for services
 browser.webRequest.onBeforeRequest.addListener(
 	details => {
@@ -57,11 +39,16 @@ browser.webRequest.onBeforeRequest.addListener(
 			return null
 		}
 		if (tabIdRedirects[details.tabId] == false) return null
-		let newUrl = servicesHelper.redirect(url, details.type, initiator, tabIdRedirects[details.tabId])
+		let newUrl = servicesHelper.redirect(url, details.type, initiator, tabIdRedirects[details.tabId], details.tabId)
 
 		if (details.frameAncestors && details.frameAncestors.length > 0 && generalHelper.isException(new URL(details.frameAncestors[0].url))) newUrl = null
 
-		if (generalHelper.isException(url)) newUrl = "BYPASSTAB"
+		if (generalHelper.isException(url)) {
+			if (details.type == "main_frame")
+				newUrl = "BYPASSTAB"
+			else
+				return null
+		}
 
 		if (newUrl) {
 			if (newUrl === "CANCEL") {
@@ -89,9 +76,12 @@ browser.tabs.onRemoved.addListener(tabId => {
 	}
 })
 
-browser.commands.onCommand.addListener(command => {
-	if (command === "switchInstance") utils.switchInstance()
-	else if (command == "copyRaw") utils.copyRaw()
+browser.commands.onCommand.addListener(async command => {
+	if (command == "switchInstance") {
+		const newUrl = await servicesHelper.switchInstance()
+		if (newUrl) browser.tabs.update({ url: newUrl })
+	}
+	else if (command == "copyRaw") servicesHelper.copyRaw()
 })
 
 browser.contextMenus.create({
@@ -113,73 +103,43 @@ browser.contextMenus.create({
 })
 
 browser.contextMenus.create({
+	id: "redirectToOriginal",
+	title: browser.i18n.getMessage("redirectToOriginal"),
+	contexts: ["browser_action"],
+})
+
+browser.contextMenus.create({
 	id: "redirectLink",
 	title: browser.i18n.getMessage("redirectLink"),
 	contexts: ["link"],
 })
 
-function handleToggleTab(tab) {
-	return new Promise(async resolve => {
-		switch (tabIdRedirects[tab.id]) {
-			case false:
-				const newUrl = await servicesHelper.reverse(tab.url, true)
-				if (newUrl) browser.tabs.update(tab.id, { url: newUrl })
-				resolve()
-				return
-			case true:
-				browser.tabs.reload(tab.id)
-				resolve()
-				return
-		}
-	})
-}
-
 browser.contextMenus.onClicked.addListener((info, tab) => {
 	return new Promise(async resolve => {
-		switch (info.menuItemId) {
-			case "switchInstance":
-				utils.switchInstance()
-				resolve()
-				return
-			case "settings":
-				browser.runtime.openOptionsPage()
-				resolve()
-				return
-			case "copyRaw":
-				utils.copyRaw()
-				resolve()
-				return
-			case "toggleTab":
-				if (tabIdRedirects[tab.id] != undefined) {
-					tabIdRedirects[tab.id] = !tabIdRedirects[tab.id]
-					await handleToggleTab(tab)
-					resolve()
-					return
-				} else {
-					const url = new URL(tab.url)
-					const service = await servicesHelper.computeService(url)
-					if (service) {
-						browser.storage.local.get("options", async r => {
-							if (r.options[service].enabled) tabIdRedirects[tab.id] = false
-							else tabIdRedirects[tab.id] = true
-							await handleToggleTab(tab)
-							resolve()
-							return
-						})
-					} else {
-						tabIdRedirects[tab.id] = false
-						await handleToggleTab(tab)
-						resolve()
-						return
-					}
-				}
-			case "redirectLink":
-				const tmpUrl = new URL(info.linkUrl)
-				const newUrl = servicesHelper.redirect(tmpUrl, "main_frame", null, true)
-				if (newUrl) browser.tabs.create({ url: newUrl })
-				resolve()
-				return
+		if (info.menuItemId == 'switchInstance') {
+			const newUrl = await servicesHelper.switchInstance()
+			if (newUrl) browser.tabs.update({ url: newUrl })
+		}
+		else if (info.menuItemId == 'settings') {
+			browser.runtime.openOptionsPage()
 		}
+		else if (info.menuItemId == 'copyRaw') {
+			servicesHelper.copyRaw()
+		}
+		else if (info.menuItemId == 'redirectToOriginal') {
+			const newUrl = await servicesHelper.reverse(tab.url)
+			if (newUrl) {
+				tabIdRedirects[tab.id] = false
+				browser.tabs.update(tab.id, { url: newUrl })
+			}
+		}
+		else if (info.menuItemId == 'redirectLink') {
+			const url = new URL(info.linkUrl)
+			const newUrl = servicesHelper.redirect(url, "main_frame", null, true)
+			if (newUrl) browser.tabs.create({ url: newUrl })
+		}
+		resolve()
+		return
 	})
 })
 
@@ -191,4 +151,4 @@ browser.webRequest.onHeadersReceived.addListener(
 	},
 	{ urls: ["<all_urls>"] },
 	["blocking", "responseHeaders"]
-)
\ No newline at end of file
+)
diff --git a/src/pages/options/index.ejs b/src/pages/options/index.ejs
deleted file mode 100644
index 7f09e6da..00000000
--- a/src/pages/options/index.ejs
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html id="elementToShowWithJavaScript" lang="en">
-  <%- include('src/pages/widgets/head') -%>
-  <body class="option" dir="auto">
-  <%- include('src/pages/widgets/links', {services: services}) -%>
-    <div id="pages">
-      <%- include('src/pages/options/widgets/general', {config: {networks, services}}) -%>
-      <%- include('src/pages/options/widgets/services', {config: {networks, services}}) -%>
-      <%- include('src/pages/options/widgets/about') -%>
-    </div>
-  </body>
-  <script type="module" src="./index.js"></script>
-</html>
diff --git a/src/pages/options/index.js b/src/pages/options/index.js
index 409fa5b5..c6c21095 100644
--- a/src/pages/options/index.js
+++ b/src/pages/options/index.js
@@ -1,23 +1,232 @@
+import utils from "../../assets/javascripts/utils.js"
+import localise from "../../assets/javascripts/localise.js"
+
+let config,
+	options,
+	divs = {}
+
 for (const a of document.getElementById("links").getElementsByTagName("a")) {
-	a.addEventListener("click", e => {
-		const path = a.getAttribute("href").replace("#", "")
-		loadPage(path)
-		e.preventDefault()
-	})
+	if (!a.href.includes("https://")) {
+		a.addEventListener("click", e => {
+			const path = a.getAttribute("href").replace("#", "")
+			loadPage(path)
+			e.preventDefault()
+		})
+	}
 }
 
-function loadPage(path) {
+config = await utils.getConfig()
+options = await utils.getOptions()
+
+function changeFrontendsSettings(service) {
+	const opacityDiv = document.getElementById(`${service}-opacity`)
+	if (document.getElementById(`${service}-enabled`).checked) {
+		opacityDiv.style.pointerEvents = 'auto'
+		opacityDiv.style.opacity = 1
+		opacityDiv.style.userSelect = 'auto'
+	} else {
+		opacityDiv.style.pointerEvents = 'none'
+		opacityDiv.style.opacity = 0.4
+		opacityDiv.style.userSelect = 'none'
+	}
+	for (const frontend in config.services[service].frontends) {
+		if (config.services[service].frontends[frontend].instanceList) {
+			const frontendDiv = document.getElementById(frontend)
+			if (typeof divs[service].frontend !== "undefined") {
+				if (frontend == divs[service].frontend.value) {
+					frontendDiv.style.display = "block"
+				} else {
+					frontendDiv.style.display = "none"
+				}
+			}
+		}
+	}
+}
+
+async function loadPage(path) {
 	for (const section of document.getElementById("pages").getElementsByTagName("section")) section.style.display = "none"
 	document.getElementById(`${path}_page`).style.display = "block"
 
-	for (const a of document.getElementById("links").getElementsByTagName("a"))
-		if (a.getAttribute("href") == `#${path}`) a.classList.add("selected")
-		else a.classList.remove("selected")
+	for (const a of document.getElementById("links").getElementsByTagName("a")) {
+		if (a.getAttribute("href") == `#${path}`) {
+			a.classList.add("selected")
+		} else {
+			a.classList.remove("selected")
+		}
+	}
+
+	window.history.pushState({ id: "100" }, "Page 2", `/pages/options/index.html#${path}`)
+
+	if (path != 'general') {
+		const service = path;
+
+		divs[service] = {}
+		options = await utils.getOptions()
+		for (const option in config.services[service].options) {
+			divs[service][option] = document.getElementById(`${service}-${option}`)
+			if (typeof config.services[service].options[option] == "boolean") divs[service][option].checked = options[service][option]
+			else divs[service][option].value = options[service][option]
+
+			divs[service][option].addEventListener("change", async () => {
+				let options = await utils.getOptions()
+				if (typeof config.services[service].options[option] == "boolean")
+					options[service][option] = divs[service][option].checked
+				else
+					options[service][option] = divs[service][option].value
+				browser.storage.local.set({ options })
+				changeFrontendsSettings(service)
+			})
+		}
+
+		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
+		}
+
+		changeFrontendsSettings(service)
+
+
+		for (const frontend in config.services[service].frontends) {
+			if (config.services[service].frontends[frontend].instanceList) {
+				processCustomInstances(frontend, document)
+			}
+		}
+
+		!async function () {
+			const blacklist = await utils.getBlacklist()
+			const redirects = await utils.getList()
+			for (const frontend in config.services[service].frontends) {
+				if (config.services[service].frontends[frontend].instanceList) {
+					createList(frontend, config.networks, document, redirects, blacklist)
+				}
+			}
+		}()
+	}
+}
+
+async function calcCustomInstances(frontend) {
+	let options = await utils.getOptions()
+	let customInstances = options[frontend]
+	document.getElementById(frontend).getElementsByClassName("custom-checklist")[0].innerHTML = customInstances
+		.map(
+			x => `
+			<div>
+				${x}
+				<button class="add clear-${x}">
+					<svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
+						<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
+					</svg>
+				</button>
+			  </div>
+			  <hr>`
+		)
+		.join("\n")
+	for (const item of customInstances) {
+		document.getElementById(frontend).getElementsByClassName(`clear-${item}`)[0].addEventListener("click", async () => {
+			const index = customInstances.indexOf(item)
+			if (index > -1) customInstances.splice(index, 1)
+			options = await utils.getOptions()
+			options[frontend] = customInstances
+			browser.storage.local.set({ options }, () => calcCustomInstances(frontend))
+		})
+	}
+}
+
+async function processCustomInstances(frontend, document) {
+	let options = await utils.getOptions()
+	let customInstances = options[frontend]
+
+	calcCustomInstances(frontend)
+	document.getElementById(frontend).getElementsByClassName("custom-instance-form")[0].addEventListener("submit", async event => {
+		event.preventDefault()
+		let frontendCustomInstanceInput = document.getElementById(frontend).getElementsByClassName("custom-instance")[0]
+		let url
+		try {
+			url = new URL(frontendCustomInstanceInput.value)
+		} catch (error) {
+			return
+		}
+		let protocolHostVar = utils.protocolHost(url)
+		if (frontendCustomInstanceInput.validity.valid) {
+			if (!customInstances.includes(protocolHostVar)) {
+				customInstances.push(protocolHostVar)
+				options = await utils.getOptions()
+				options[frontend] = customInstances
+				browser.storage.local.set({ options }, () => {
+					frontendCustomInstanceInput.value = ""
+					calcCustomInstances(frontend)
+				})
+			}
+		}
+	})
+}
+
+function createList(frontend, networks, document, redirects, blacklist) {
+	for (const network in networks) {
+		if (redirects[frontend]) {
+			if (redirects[frontend][network].length > 0) {
+				document.getElementById(frontend)
+					.getElementsByClassName(network)[0]
+					.getElementsByClassName("checklist")[0]
+					.innerHTML = [
+						`<div class="some-block option-block">
+						<h4>${utils.camelCase(network)}</h4>
+					</div>`,
+						...redirects[frontend][network]
+							.sort((a, b) =>
+								(blacklist.cloudflare.includes(a) && !blacklist.cloudflare.includes(b))
+							)
+							.map(x => {
+								const cloudflare = blacklist.cloudflare.includes(x) ?
+									` <a target="_blank" href="https://libredirect.github.io/docs.html#instances">
+							 		<span style="color:red;">cloudflare</span>
+								</a>` : ""
+
+								const warnings = [cloudflare].join(" ")
+								return `<div>
+										<x>
+											<a href="${x}" target="_blank">${x}</a>${warnings}
+										</x>
+										<button class="add add-${x}">
+											<svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
+												<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
+											</svg>
+										</button>
+						  			</div>`
+							}),
+						'<br>'
+					].join("\n<hr>\n")
+
+				for (const x of redirects[frontend][network]) {
+					document.getElementById(frontend)
+						.getElementsByClassName(network)[0]
+						.getElementsByClassName("checklist")[0]
+						.getElementsByClassName(`add-${x}`)[0]
+						.addEventListener("click", async () => {
+							let options = await utils.getOptions()
+							let customInstances = options[frontend]
+							if (!customInstances.includes(x)) {
+								customInstances.push(x)
+								options = await utils.getOptions()
+								options[frontend] = customInstances
+								browser.storage.local.set({ options }, () => {
+									calcCustomInstances(frontend)
+								})
+							}
+						})
+				}
+			}
+		} else {
+			document.getElementById(frontend).getElementsByClassName(network)[0].getElementsByClassName("checklist")[0].innerHTML =
+				`<div class="some-block option-block">No instances found.</div>`
+			break
+		}
 
-	let stateObj = { id: "100" }
-	window.history.pushState(stateObj, "Page 2", `/pages/options/index.html#${path}`)
+	}
 }
 
 const r = window.location.href.match(/#(.*)/)
 if (r) loadPage(r[1])
-else loadPage("general")
+else loadPage("general")
\ No newline at end of file
diff --git a/src/pages/options/index.pug b/src/pages/options/index.pug
new file mode 100644
index 00000000..4e19b087
--- /dev/null
+++ b/src/pages/options/index.pug
@@ -0,0 +1,10 @@
+doctype html
+html(id="elementToShowWithJavaScript" lang="en")
+    include /src/pages/widgets/head
+    body(class="option" dir="auto")
+        include /src/pages/widgets/links
+        div#pages
+            include /src/pages/options/widgets/general
+            include /src/pages/options/widgets/services
+    script(type="module" src="./index.js")
+    
\ No newline at end of file
diff --git a/src/pages/options/init.js b/src/pages/options/init.js
index cac23748..f88c9ef9 100644
--- a/src/pages/options/init.js
+++ b/src/pages/options/init.js
@@ -1,35 +1,54 @@
 window.browser = window.browser || window.chrome
 
 import localise from "../../assets/javascripts/localise.js"
+import utils from "../../assets/javascripts/utils.js"
+import servicesHelper from "../../assets/javascripts/services.js"
+
+if (!(await utils.getOptions())) {
+	await servicesHelper.initDefaults()
+}
 
 function changeTheme() {
-	return new Promise(resolve => {
-		browser.storage.local.get("options", r => {
-			switch (r.options.theme) {
-				case "dark":
-					document.body.classList.add("dark-theme")
-					document.body.classList.remove("light-theme")
-					break
-				case "light":
+	return new Promise(async resolve => {
+		switch ((await utils.getOptions()).theme) {
+			case "dark":
+				document.body.classList.add("dark-theme")
+				document.body.classList.remove("light-theme")
+				for (const element of document.body.getElementsByClassName('dark')) {
+					element.style.display = 'none';
+				}
+				break
+			case "light":
+				document.body.classList.add("light-theme")
+				document.body.classList.remove("dark-theme")
+				for (const element of document.body.getElementsByClassName('light')) {
+					element.style.display = 'none';
+				}
+				break
+			default:
+				if (matchMedia("(prefers-color-scheme: light)").matches) {
 					document.body.classList.add("light-theme")
 					document.body.classList.remove("dark-theme")
-					break
-				default:
-					if (matchMedia("(prefers-color-scheme: light)").matches) {
-						document.body.classList.add("light-theme")
-						document.body.classList.remove("dark-theme")
-					} else {
-						document.body.classList.add("dark-theme")
-						document.body.classList.remove("light-theme")
+					for (const element of document.body.getElementsByClassName('light')) {
+						element.style.display = 'none';
 					}
-			}
-			resolve()
-		})
+				} else {
+					document.body.classList.add("dark-theme")
+					document.body.classList.remove("light-theme")
+					for (const element of document.body.getElementsByClassName('dark')) {
+						element.style.display = 'none';
+					}
+				}
+		}
+		resolve()
 	})
 }
 
 changeTheme()
-if (["ar", "iw", "ku", "fa", "ur"].includes(browser.i18n.getUILanguage())) document.getElementsByTagName("body")[0].classList.add("rtl")
+if (["ar", "iw", "ku", "fa", "ur"].includes(browser.i18n.getUILanguage())) {
+	document.getElementsByTagName("body")[0].classList.add("rtl")
+	document.getElementsByTagName("body")[0].dir = "rtl"
+}
 localise.localisePage()
 
 window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", changeTheme)
diff --git a/src/pages/options/widgets/about.ejs b/src/pages/options/widgets/about.ejs
deleted file mode 100644
index c6f8a58f..00000000
--- a/src/pages/options/widgets/about.ejs
+++ /dev/null
@@ -1,37 +0,0 @@
-<section class="option-block" id="about_page">
-
-  <div class="some-block option-block">
-    <h1 data-localise="__MSG_about__">About</h1>
-  </div>
-
-  <hr>
-
-  <div class="about">
-
-    <div class="some-block option-block">
-      <h4>Donate: ♥️</h4>
-      <h4><a href='https://libredirect.codeberg.page/donate'>https://libredirect.github.io/donate</a> </h4>
-    </div>
-
-    <div class="some-block option-block">
-      <h4>FAQ:</h4>
-      <h4><a href='https://libredirect.codeberg.page/faq'>https://libredirect.github.io/faq</a></h4>
-    </div>
-
-    <div class="some-block option-block">
-      <h4>Docs:</h4>
-      <h4><a href='https://libredirect.codeberg.page/docs'>https://libredirect.github.io/docs</a></h4>
-    </div>
-
-    <div class="some-block option-block">
-      <h4>Source Code:</h4>
-      <h4><a href='https://libredirect.codeberg.page/source_code'>https://libredirect.github.io/source_code</a></h4>
-    </div>
-
-    <div class="some-block option-block">
-      <h4>Forked from:</h4>
-      <h4><a href="https://github.com/SimonBrazell/privacy-redirect">Privacy Redirect</a></h4>
-    </div>
-
-  </div>
-</section>
\ No newline at end of file
diff --git a/src/pages/options/widgets/general.ejs b/src/pages/options/widgets/general.ejs
deleted file mode 100644
index 6bb15bca..00000000
--- a/src/pages/options/widgets/general.ejs
+++ /dev/null
@@ -1,70 +0,0 @@
-<section class="option-block" id="general_page">
-  <div class="some-block option-block">
-    <h1 data-localise="__MSG_general__">General</h1>
-  </div>
-  <hr />
-
-  <div class="some-block option-block">
-    <h4 data-localise="__MSG_theme__">Theme</h4>
-    <select id="theme">
-      <option value="detect" data-localise="__MSG_detect__">Detect</option>
-      <option value="light" data-localise="__MSG_light__">Light</option>
-      <option value="dark" data-localise="__MSG_dark__">Dark</option>
-    </select>
-  </div>
-
-  <div class="some-block option-block">
-    <h4 data-localise="__MSG_exclude_from_redirecting_">Excluded from redirecting</h4>
-  </div>
-
-  <form id="custom-exceptions-instance-form">
-    <div class="some-block option-block">
-      <div class="some-block" style="padding: 0">
-        <input id="exceptions-custom-instance" placeholder="https://www.google.com" type="url" />&nbsp;
-        <select id="exceptions-custom-instance-type">
-          <option value="url">URL</option>
-          <option value="regex">Regex</option>
-        </select>&nbsp;
-      </div>
-      <button class="add" id="exceptions-add-instance" type="submit">
-        <svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
-          <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
-        </svg>
-      </button>
-    </div>
-  </form>
-
-  <hr>
-
-  <div class="checklist" id="exceptions-custom-checklist"></div>
-
-  <div class="buttons buttons-inline">
-    <a class="button button-inline" id="update-instances">
-      <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
-        <path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"></path>
-      </svg>
-      <x data-localise="__MSG_updateInstances__">Update Instances</x>
-    </a>&nbsp; &nbsp;
-  </div>
-
-  <div class="buttons buttons-inline">
-    <label class="button button-inline" id="import_settings_text" for="import-settings">
-      <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
-        <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"></path>
-      </svg>&nbsp;
-      <x data-localise="__MSG_importSettings__">Import Settings</x>
-    </label>
-    <input class="button button-inline" id="import-settings" type="file" style="display: none" />&nbsp; &nbsp;<a class="button button-inline" id="export-settings">
-      <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
-        <path d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"></path>
-      </svg>&nbsp; <x data-localise="__MSG_exportSettings__">Export Settings</x></a>&nbsp; &nbsp;<a class="button button-inline" id="reset-settings">
-      <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
-        <path d="M12,5V2L8,6l4,4V7c3.31,0,6,2.69,6,6c0,2.97-2.17,5.43-5,5.91v2.02c3.95-0.49,7-3.85,7-7.93C20,8.58,16.42,5,12,5z"></path>
-        <path d="M6,13c0-1.65,0.67-3.15,1.76-4.24L6.34,7.34C4.9,8.79,4,10.79,4,13c0,4.08,3.05,7.44,7,7.93v-2.02 C8.17,18.43,6,15.97,6,13z"></path>
-      </svg>
-      <x data-localise="__MSG_resetSettings__">Reset Settings</x>
-    </a>
-  </div>
-
-  <script type="module" src="./widgets/general.js"></script>
-</section>
\ No newline at end of file
diff --git a/src/pages/options/widgets/general.js b/src/pages/options/widgets/general.js
index a73ac85e..09c222a2 100644
--- a/src/pages/options/widgets/general.js
+++ b/src/pages/options/widgets/general.js
@@ -2,57 +2,29 @@
 window.browser = window.browser || window.chrome
 
 import utils from "../../../assets/javascripts/utils.js"
-import generalHelper from "../../../assets/javascripts/general.js"
 import servicesHelper from "../../../assets/javascripts/services.js"
 
-let updateInstancesElement = document.getElementById("update-instances")
-updateInstancesElement.addEventListener("click", async () => {
-	let oldHtml = updateInstancesElement.innerHTML
-	updateInstancesElement.innerHTML = "..."
-	if (await utils.updateInstances()) {
-		updateInstancesElement.innerHTML = oldHtml
-		location.reload()
-	} else updateInstancesElement.innerHTML = "Failed Miserabely"
-})
-
-let config
-
-async function getConfig() {
-	return new Promise(resolve => {
-		fetch("/config/config.json")
-			.then(response => response.text())
-			.then(data => {
-				config = JSON.parse(data)
-				resolve()
-			})
-	})
-}
-
-function setOption(option, type, event) {
-	browser.storage.local.get("options", r => {
-		let options = r.options
-		if (type == "select") {
-			options[option] = event.target.options[event.target.options.selectedIndex].value
-		} else if (type == "checkbox") {
-			options[option] = event.target.checked
-		} else if (type == "range") {
-			options[option] = event.target.value
-		}
-
-		browser.storage.local.set({ options })
-	})
+async function setOption(option, type, event) {
+	let options = await utils.getOptions()
+	if (type == "select") {
+		options[option] = event.target.options[event.target.options.selectedIndex].value
+	} else if (type == "checkbox") {
+		options[option] = event.target.checked
+	} else if (type == "range") {
+		options[option] = event.target.value
+	}
+	browser.storage.local.set({ options })
 }
 
 let exportSettingsElement = document.getElementById("export-settings")
 
-function exportSettings() {
-	browser.storage.local.get("options", result => {
-		result.options.version = browser.runtime.getManifest().version
-		let resultString = JSON.stringify(result.options, null, "  ")
-		exportSettingsElement.href = "data:application/json;base64," + btoa(resultString)
-		exportSettingsElement.download = "libredirect-settings.json"
-		return
-	})
+async function exportSettings() {
+	const options = await utils.getOptions()
+	options.version = browser.runtime.getManifest().version
+	let resultString = JSON.stringify(options, null, "  ")
+	exportSettingsElement.href = "data:application/json;base64," + btoa(resultString)
+	exportSettingsElement.download = "libredirect-settings.json"
+	return
 }
 exportSettings()
 
@@ -67,27 +39,14 @@ importSettingsElement.addEventListener("change", () => {
 	reader.readAsText(file)
 	reader.onload = async () => {
 		const data = JSON.parse(reader.result)
-		if ("theme" in data && "disableImgur" in data && "imgurRedirects" in data) {
-			browser.storage.local.clear(() =>
-				browser.storage.local.set({ ...data }, () => {
-					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()
-								await servicesHelper.upgradeOptions()
-								location.reload()
-							})
-						})
+		if (
+			"theme" in data
+			&& data.version == browser.runtime.getManifest().version
+		) {
+			browser.storage.local.clear(async () => {
+				browser.storage.local.set({ options: data }, () => {
+					location.reload()
 				})
-			)
-		} else if ("version" in data) {
-			let options = data
-			delete options.version
-			browser.storage.local.set({ options: data }, async () => {
-				await servicesHelper.processUpdate()
-				location.reload()
 			})
 		} else {
 			console.log("incompatible settings")
@@ -108,17 +67,8 @@ function importError() {
 const resetSettings = document.getElementById("reset-settings")
 resetSettings.addEventListener("click", async () => {
 	resetSettings.innerHTML = "..."
-	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()
-					location.reload()
-				})
-			})
-	})
+	await servicesHelper.initDefaults()
+	location.reload()
 })
 
 let themeElement = document.getElementById("theme")
@@ -131,41 +81,41 @@ let nameCustomInstanceInput = document.getElementById("exceptions-custom-instanc
 let instanceTypeElement = document.getElementById("exceptions-custom-instance-type")
 let instanceType = "url"
 
-await getConfig()
+let config = await utils.getConfig()
 
 for (const service in config.services) {
-	document.getElementById(service).addEventListener("change", event => {
-		browser.storage.local.get("options", r => {
-			let options = r.options
-			if (event.target.checked && !options.popupServices.includes(service)) options.popupServices.push(service)
-			else if (options.popupServices.includes(service)) {
-				var index = options.popupServices.indexOf(service)
-				if (index !== -1) options.popupServices.splice(index, 1)
-			}
-			browser.storage.local.set({ options })
-		})
+	document.getElementById(service).addEventListener("change", async event => {
+		let options = await utils.getOptions()
+		if (event.target.checked && !options.popupServices.includes(service)) options.popupServices.push(service)
+		else if (options.popupServices.includes(service)) {
+			var index = options.popupServices.indexOf(service)
+			if (index !== -1) options.popupServices.splice(index, 1)
+		}
+		browser.storage.local.set({ options })
 	})
 }
 
-browser.storage.local.get("options", r => {
-	themeElement.value = r.options.theme
-	let options = r.options
-
-	instanceTypeElement.addEventListener("change", event => {
-		instanceType = event.target.options[instanceTypeElement.selectedIndex].value
-		if (instanceType == "url") {
-			nameCustomInstanceInput.setAttribute("type", "url")
-			nameCustomInstanceInput.setAttribute("placeholder", "https://www.google.com")
-		} else if (instanceType == "regex") {
-			nameCustomInstanceInput.setAttribute("type", "text")
-			nameCustomInstanceInput.setAttribute("placeholder", "https?://(www.|)youtube.com/")
-		}
-	})
-	let exceptionsCustomInstances = r.options.exceptions
-	function calcExceptionsCustomInstances() {
-		document.getElementById("exceptions-custom-checklist").innerHTML = [...exceptionsCustomInstances.url, ...exceptionsCustomInstances.regex]
-			.map(
-				x => `<div>
+
+let options = await utils.getOptions()
+themeElement.value = options.theme
+for (const service in config.services) document.getElementById(service).checked = options.popupServices.includes(service)
+
+instanceTypeElement.addEventListener("change", event => {
+	instanceType = event.target.options[instanceTypeElement.selectedIndex].value
+	if (instanceType == "url") {
+		nameCustomInstanceInput.setAttribute("type", "url")
+		nameCustomInstanceInput.setAttribute("placeholder", "https://www.google.com")
+	} else if (instanceType == "regex") {
+		nameCustomInstanceInput.setAttribute("type", "text")
+		nameCustomInstanceInput.setAttribute("placeholder", "https?://(www.|)youtube.com/")
+	}
+})
+
+let exceptionsCustomInstances = options.exceptions
+function calcExceptionsCustomInstances() {
+	document.getElementById("exceptions-custom-checklist").innerHTML = [...exceptionsCustomInstances.url, ...exceptionsCustomInstances.regex]
+		.map(
+			x => `<div>
                       ${x}
                       <button class="add" id="clear-${x}">
                         <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
@@ -175,47 +125,47 @@ browser.storage.local.get("options", r => {
                       </button>
                     </div>
                     <hr>`
-			)
-			.join("\n")
-
-		for (const x of [...exceptionsCustomInstances.url, ...exceptionsCustomInstances.regex]) {
-			document.getElementById(`clear-${x}`).addEventListener("click", () => {
-				console.log(x)
-				let index
-				index = exceptionsCustomInstances.url.indexOf(x)
-				if (index > -1) exceptionsCustomInstances.url.splice(index, 1)
-				else {
-					index = exceptionsCustomInstances.regex.indexOf(x)
-					if (index > -1) exceptionsCustomInstances.regex.splice(index, 1)
-				}
-				options.exceptions = exceptionsCustomInstances
-				browser.storage.local.set({ options })
-				calcExceptionsCustomInstances()
-			})
-		}
-	}
-	calcExceptionsCustomInstances()
-	document.getElementById("custom-exceptions-instance-form").addEventListener("submit", event => {
-		event.preventDefault()
-
-		let val
-		if (instanceType == "url") {
-			if (nameCustomInstanceInput.validity.valid) {
-				let url = new URL(nameCustomInstanceInput.value)
-				val = `${url.protocol}//${url.host}`
-				if (!exceptionsCustomInstances.url.includes(val)) exceptionsCustomInstances.url.push(val)
+		)
+		.join("\n")
+
+	for (const x of [...exceptionsCustomInstances.url, ...exceptionsCustomInstances.regex]) {
+		document.getElementById(`clear-${x}`).addEventListener("click", async () => {
+			let index
+			index = exceptionsCustomInstances.url.indexOf(x)
+			if (index > -1) exceptionsCustomInstances.url.splice(index, 1)
+			else {
+				index = exceptionsCustomInstances.regex.indexOf(x)
+				if (index > -1) exceptionsCustomInstances.regex.splice(index, 1)
 			}
-		} else if (instanceType == "regex") {
-			val = nameCustomInstanceInput.value
-			if (val.trim() != "" && !exceptionsCustomInstances.regex.includes(val)) exceptionsCustomInstances.regex.push(val)
-		}
-		if (val) {
+			options = await utils.getOptions()
 			options.exceptions = exceptionsCustomInstances
 			browser.storage.local.set({ options })
-			nameCustomInstanceInput.value = ""
+			calcExceptionsCustomInstances()
+		})
+	}
+}
+calcExceptionsCustomInstances()
+document.getElementById("custom-exceptions-instance-form").addEventListener("submit", async event => {
+	event.preventDefault()
+
+	let val
+	if (instanceType == "url") {
+		if (nameCustomInstanceInput.validity.valid) {
+			val = nameCustomInstanceInput.value
+			if (!exceptionsCustomInstances.url.includes(val)) exceptionsCustomInstances.url.push(val)
 		}
-		calcExceptionsCustomInstances()
-	})
+	} else if (instanceType == "regex") {
+		val = nameCustomInstanceInput.value
+		if (val.trim() != "" && !exceptionsCustomInstances.regex.includes(val)) exceptionsCustomInstances.regex.push(val)
+	}
+	if (val) {
+		options = await utils.getOptions()
+		options.exceptions = exceptionsCustomInstances
+		console.log(options.exceptions)
+		browser.storage.local.set({ options }, () =>
+			nameCustomInstanceInput.value = ""
+		)
 
-	for (const service in config.services) document.getElementById(service).checked = options.popupServices.includes(service)
+	}
+	calcExceptionsCustomInstances()
 })
diff --git a/src/pages/options/widgets/general.pug b/src/pages/options/widgets/general.pug
new file mode 100644
index 00000000..dc3c3d93
--- /dev/null
+++ b/src/pages/options/widgets/general.pug
@@ -0,0 +1,57 @@
+section(class="option-block" id="general_page")
+    div(class="some-block option-block")
+        h1(data-localise="__MSG_general__") General
+    hr
+
+    div(class="some-block option-block")
+        h4(data-localise="__MSG_theme__") Theme
+        select#theme
+            option(value="detect" data-localise="__MSG_auto__") Auto
+            option(value="light" data-localise="__MSG_light__") Light
+            option(value="dark" data-localise="__MSG_dark__") Dark
+
+    div(class="some-block option-block")
+        h4(data-localise="__MSG_excludeFromRedirecting__") Excluded from redirecting
+
+    form(id="custom-exceptions-instance-form")
+        div(class="some-block option-block")
+            div(class="some-block" style="padding: 0")
+                input(id="exceptions-custom-instance" placeholder="https://www.google.com" type="url")
+                |&nbsp;
+                select(id="exceptions-custom-instance-type")
+                    option(value="url") URL
+                    option(value="regex") Regex
+                |&nbsp;
+            button(class="add" id="exceptions-add-instance" type="submit")
+                svg(xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor")
+                    path(d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z")
+
+    hr
+
+    div(class="checklist" id="exceptions-custom-checklist")
+
+    div(class="buttons buttons-inline")
+        label(class="button button-inline" id="import_settings_text" for="import-settings")
+            svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor")
+                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(class="button button-inline" id="import-settings" type="file" style="display: none")
+        
+        |&nbsp;&nbsp;
+        
+        a(class="button button-inline" id="export-settings")
+            svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor")
+                path(d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z")
+            |&nbsp;
+            x(data-localise="__MSG_exportSettings__") Export Settings
+        
+        |&nbsp;&nbsp;
+        
+        a(class="button button-inline" id="reset-settings")
+            svg(xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor")
+                path(d="M12,5V2L8,6l4,4V7c3.31,0,6,2.69,6,6c0,2.97-2.17,5.43-5,5.91v2.02c3.95-0.49,7-3.85,7-7.93C20,8.58,16.42,5,12,5z")
+                path(d="M6,13c0-1.65,0.67-3.15,1.76-4.24L6.34,7.34C4.9,8.79,4,10.79,4,13c0,4.08,3.05,7.44,7,7.93v-2.02 C8.17,18.43,6,15.97,6,13z")
+            x(data-localise="__MSG_resetSettings__") Reset Settings
+
+    script(type="module" src="./widgets/general.js")
\ No newline at end of file
diff --git a/src/pages/options/widgets/services.ejs b/src/pages/options/widgets/services.ejs
deleted file mode 100644
index ea93b1ce..00000000
--- a/src/pages/options/widgets/services.ejs
+++ /dev/null
@@ -1,75 +0,0 @@
-<% for (const service in config.services) { -%>
-<section class="option-block" id="<%= service %>_page">
-  <div class="some-block option-block">
-    <h1 data-localise="__MSG_<%= service %>__"><%= config.services[service].name %></h1>
-  </div>
-  <hr />
-  <div class="some-block option-block">
-    <h4 data-localise="__MSG_enable__">Enable</h4>
-    <input id="<%= service %>-enabled" type="checkbox" />
-  </div>
-  <div class="some-block option-block">
-    <h4 data-localise="__MSG_show_in_popup__">Show in Popup</h4>
-    <input id="<%= service %>" type="checkbox" />
-  </div>
-  <% if (Object.keys(config.services[service].frontends).length> 1) { %>
-  <div class="some-block option-block">
-    <h4 data-localise="__MSG_frontend__">Frontend</h4>
-    <select id="<%= service %>-frontend">
-      <% for (const frontend in config.services[service].frontends) { -%>
-      <option value="<%= frontend %>"><%= config.services[service].frontends[frontend].name %></option>
-      <% } %>
-    </select>
-  </div>
-  <% if (config.services[service].embeddable) { _%>
-  <div class="some-block option-block">
-    <h4 data-localise="__MSG_embed_frontend__">Embed Frontend</h4>
-    <select id="<%= service %>-embedFrontend">
-      <% for (const frontend in config.services[service].frontends) { -%> <% if (config.services[service].frontends[frontend].embeddable) { _%>
-      <option value="<%= frontend %>"><%= config.services[service].frontends[frontend].name %></option>
-      <% } _%> <% } %>
-    </select>
-  </div>
-  <% } _%> <% } _%> <% if (config.services[service].embeddable) { _%>
-  <div class="some-block option-block">
-    <h4 data-localise="__MSG_redirectType__">Redirect Type</h4>
-    <select id="<%= service %>-redirectType">
-      <option value="both" data-localise="__MSG_both__">both</option>
-      <option value="sub_frame" data-localise="__MSG_onlyEmbedded__">Only Embedded</option>
-      <option value="main_frame" data-localise="__MSG_onlyNotEmbedded__">Only Not Embedded</option>
-    </select>
-  </div>
-  <% } _%>
-  <hr />
-  <% for (const frontend in config.services[service].frontends) { -%> <% if (config.services[service].frontends[frontend].instanceList) { _%>
-  <div id="<%= frontend %>">
-    <% for (const network in config.networks) { -%>
-    <div class="<%= network %>">
-      <div class="some-block option-block">
-        <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4>
-      </div>
-      <div class="checklist"></div>
-      <hr />
-      <div class="some-block option-block">
-        <h4 data-localise="__MSG_customInstances__">Custom Instances</h4>
-      </div>
-      <form class="custom-instance-form">
-        <div class="some-block option-block">
-          <input class="custom-instance" placeholder="http://<%= frontend %>.<%= config.networks[network].tld %>" type="url" />
-          <button class="add add-instance" type="submit">
-            <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
-              <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
-            </svg>
-          </button>
-        </div>
-      </form>
-      <div class="checklist custom-checklist"></div>
-      <% if (network=="clearnet" ) { _%>
-      <% } _%>
-    </div>
-    <% } %>
-  </div>
-  <% } _%> <% } %>
-</section>
-<% } %>
-<script type="module" src="./widgets/services.js"></script>
\ No newline at end of file
diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js
deleted file mode 100644
index 351d45e5..00000000
--- a/src/pages/options/widgets/services.js
+++ /dev/null
@@ -1,113 +0,0 @@
-import utils from "../../../assets/javascripts/utils.js"
-
-let config,
-	options,
-	divs = {}
-
-function getConfig() {
-	return new Promise(resolve => {
-		fetch("/config/config.json")
-			.then(response => response.text())
-			.then(data => {
-				config = JSON.parse(data)
-				resolve()
-			})
-	})
-}
-
-function getOptions() {
-	return new Promise(resolve => {
-		browser.storage.local.get("options", r => {
-			options = r.options
-			resolve()
-		})
-	})
-}
-
-await getConfig()
-await getOptions()
-
-function changeFrontendsSettings(service) {
-	for (const frontend in config.services[service].frontends) {
-		if (config.services[service].frontends[frontend].instanceList) {
-			const frontendDiv = document.getElementById(frontend)
-			if (typeof divs[service].frontend !== "undefined") {
-				if (frontend == divs[service].frontend.value) {
-					frontendDiv.style.display = "block"
-				} else {
-					frontendDiv.style.display = "none"
-				}
-			}
-		}
-	}
-
-	if (config.services[service].embeddable) {
-		if (typeof divs[service].frontend !== "undefined") {
-			if (!config.services[service].frontends[divs[service].frontend.value].embeddable) {
-				divs[service].embedFrontend.disabled = false
-				for (const frontend in config.services[service].frontends) {
-					if (config.services[service].frontends[frontend].embeddable) {
-						const frontendDiv = document.getElementById(frontend)
-						if (frontend == divs[service].embedFrontend.value) {
-							frontendDiv.style.display = "block"
-						} else {
-							frontendDiv.style.display = "none"
-						}
-					}
-				}
-			} else if (Object.keys(config.services[service].frontends).length > 1) divs[service].embedFrontend.disabled = true
-		}
-	}
-}
-
-function changeNetworkSettings() {
-	for (const service in config.services) {
-		for (const frontend in config.services[service].frontends) {
-			if (config.services[service].frontends[frontend].instanceList) {
-				const frontendDiv = document.getElementById(frontend)
-				for (const network in config.networks) {
-					const networkDiv = frontendDiv.getElementsByClassName(network)[0]
-					if (network == options.network) {
-						networkDiv.style.display = "block"
-					} else {
-						networkDiv.style.display = "none"
-					}
-				}
-			}
-		}
-	}
-}
-
-changeNetworkSettings()
-for (const service in config.services) {
-	divs[service] = {}
-	//divs[service].page = document.getElementById(`${service}_page`)
-	for (const option in config.services[service].options) {
-		divs[service][option] = document.getElementById(`${service}-${option}`)
-
-		if (typeof config.services[service].options[option] == "boolean") divs[service][option].checked = options[service][option]
-		else divs[service][option].value = options[service][option]
-
-		divs[service][option].addEventListener("change", () => {
-			browser.storage.local.get("options", r => {
-				let options = r.options
-				if (typeof config.services[service].options[option] == "boolean") options[service][option] = divs[service][option].checked
-				else options[service][option] = divs[service][option].value
-				browser.storage.local.set({ options })
-				changeFrontendsSettings(service)
-			})
-		})
-	}
-
-	if (Object.keys(config.services[service].frontends).length > 1) {
-		changeFrontendsSettings(service)
-	}
-
-	for (const frontend in config.services[service].frontends) {
-		if (config.services[service].frontends[frontend].instanceList) {
-			for (const network in config.networks) {
-				utils.processDefaultCustomInstances(service, frontend, network, document)
-			}
-		}
-	}
-}
diff --git a/src/pages/options/widgets/services.pug b/src/pages/options/widgets/services.pug
new file mode 100644
index 00000000..257ffd7c
--- /dev/null
+++ b/src/pages/options/widgets/services.pug
@@ -0,0 +1,60 @@
+each val, service in services
+    section(class="option-block" id=service+"_page")
+        div(class="some-block option-block")
+            h1
+                a(target="_blank" href=services[service].url)=services[service].name
+
+        hr
+
+        div(class="some-block option-block")
+            h4(data-localise="__MSG_enable__") Enable
+            input(id=`${service}-enabled` type="checkbox")
+
+        div(id=service+"-opacity")
+
+            div(class="some-block option-block")
+                h4(data-localise="__MSG_showInPopup__") Show in popup
+                input(id=service type="checkbox")
+
+            if Object.keys(services[service].frontends).length> 1
+                div(class="some-block option-block")
+                    h4
+                        a(class="frontend_name" target="_blank" data-localise="__MSG_frontend__") Frontend
+                    select(id=service+"-frontend")
+                        each val, frontend in services[service].frontends
+                            option(value=frontend)=services[service].frontends[frontend].name
+            else 
+                div(class="some-block option-block")
+                    h4
+                        a(class="frontend_name" target="_blank" data-localise="__MSG_frontend__") Frontend
+
+            if services[service].embeddable
+                div(class="some-block option-block")
+                    h4(data-localise="__MSG_redirectType__") Redirect Type
+                    select(id=service+"-redirectType")
+                        option(value="both" data-localise="__MSG_both__") both
+                        option(value="sub_frame" data-localise="__MSG_onlyEmbedded__") Only Embedded
+                        option(value="main_frame" data-localise="__MSG_onlyNotEmbedded__") Only Not Embedded
+
+            hr
+
+            each val, frontend in services[service].frontends
+                if services[service].frontends[frontend].instanceList
+                    div(id=frontend dir="ltr")
+                        div(dir="auto" class="some-block option-block")
+                            h4(data-localise="__MSG_addYourFavoriteInstances__") Add your favorite instances
+
+                        form(class="custom-instance-form")
+                            div(class="some-block option-block")
+                                input(class="custom-instance" placeholder=`http://${frontend}.com` type="url" )
+                                button(class="add add-instance" type="submit")
+                                    svg(xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor")
+                                        path(d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z")
+
+                        div(class="checklist custom-checklist")  
+
+                        each val, network in networks
+                            div(class=network)
+                                div(class="checklist")
+                                    if (network == 'clearnet')
+                                        div(class="some-block option-block") Loading...
\ No newline at end of file
diff --git a/src/pages/popup/popup.ejs b/src/pages/popup/popup.ejs
deleted file mode 100644
index 76aadda7..00000000
--- a/src/pages/popup/popup.ejs
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
-  <meta charset="utf-8">
-  <meta name="viewport" content="width=device-width, initial-scale=1">
-  <link href="../stylesheets/styles.css" rel="stylesheet">
-  <link href="./style.css" rel="stylesheet">
-</head>
-
-<body dir="auto">
-  <div class="current_site">
-    <%- include('src/pages/widgets/switches', {services: services}) -%>
-    <div id="current_site_divider">
-      <hr>
-    </div>
-  </div>
-  <div class="all_sites">
-    <%- include('src/pages/widgets/switches', {services: services}) -%>
-  </div>
-  <hr>
-  <div class="some-block" id="change_instance_div">
-    <a class="title button prevent" id="change_instance">
-      <h4 data-localise="__MSG_switchInstance__">Change Instance</h4>
-      <svg xmlns="http://www.w3.org/2000/svg" height="26px" viewBox="0 0 24 24" 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"></path>
-      </svg>
-    </a>
-  </div>
-  <div class="some-block" id="copy_raw_div" title="Copy the original redirected link"> <a class="title button prevent" id="copy_raw">
-      <h4 data-localise="__MSG_copyRaw__">Copy Raw</h4>
-      <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" 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"></path>
-      </svg>
-    </a></div>
-  <div class="some-block"><a class="title button prevent" id="more-options">
-      <h4 data-localise="__MSG_settings__">Settings</h4>
-      <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor">
-        <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path>
-      </svg>
-    </a></div>
-  <div class="space"></div>
-  <script type="module" src="../options/init.js"></script>
-  <script type="module" src="./popup.js"></script>
-</body>
-
-</html>
\ No newline at end of file
diff --git a/src/pages/popup/popup.js b/src/pages/popup/popup.js
index 1ac804d0..560aea9d 100644
--- a/src/pages/popup/popup.js
+++ b/src/pages/popup/popup.js
@@ -1,35 +1,24 @@
 "use strict"
 window.browser = window.browser || window.chrome
 
+import servicesHelper from "../../assets/javascripts/services.js"
 import utils from "../../assets/javascripts/utils.js"
-import serviceHelper from "../../assets/javascripts/services.js"
 
-let config,
-	divs = {}
-
-async function getConfig() {
-	return new Promise(resolve => {
-		fetch("/config/config.json")
-			.then(response => response.text())
-			.then(data => {
-				config = JSON.parse(data)
-				resolve()
-			})
-	})
-}
-
-await getConfig()
-
-utils.switchInstance(true).then(r => {
-	if (!r) document.getElementById("change_instance_div").style.display = "none"
-	else document.getElementById("change_instance").addEventListener("click", () => utils.switchInstance(false))
+servicesHelper.switchInstance().then(r => {
+	if (!r)
+		document.getElementById("change_instance_div").style.display = "none"
+	else
+		document.getElementById("change_instance").addEventListener("click", async () => {
+			browser.tabs.update({ url: await servicesHelper.switchInstance() })
+		})
 })
 
-utils.copyRaw(true).then(r => {
-	if (!r) document.getElementById("copy_raw_div").style.display = "none"
+servicesHelper.copyRaw(true).then(r => {
+	if (!r)
+		document.getElementById("copy_raw_div").style.display = "none"
 	else {
 		const copy_raw = document.getElementById("copy_raw")
-		copy_raw.addEventListener("click", () => utils.copyRaw(false, copy_raw))
+		copy_raw.addEventListener("click", () => servicesHelper.copyRaw(false, copy_raw))
 	}
 })
 document.getElementById("more-options").addEventListener("click", () => browser.runtime.openOptionsPage())
@@ -37,78 +26,73 @@ document.getElementById("more-options").addEventListener("click", () => browser.
 const allSites = document.getElementsByClassName("all_sites")[0]
 const currSite = document.getElementsByClassName("current_site")[0]
 
-function setDivs() {
-	return new Promise(resolve => {
-		for (const service in config.services) {
-			divs[service] = {}
-			divs[service].toggle = {}
-			divs[service].current = currSite.getElementsByClassName(service)[0]
-			divs[service].all = allSites.getElementsByClassName(service)[0]
-			divs[service].toggle.current = currSite.getElementsByClassName(service + "-enabled")[0]
-			divs[service].toggle.all = allSites.getElementsByClassName(service + "-enabled")[0]
-		}
-		resolve()
-	})
-}
+const config = await utils.getConfig()
 
-await setDivs()
+let divs = {}
+for (const service in config.services) {
+	divs[service] = {}
+	divs[service].toggle = {}
+	divs[service].current = currSite.getElementsByClassName(service)[0]
+	divs[service].all = allSites.getElementsByClassName(service)[0]
+	divs[service].toggle.current = currSite.getElementsByClassName(service + "-enabled")[0]
+	divs[service].toggle.all = allSites.getElementsByClassName(service + "-enabled")[0]
+}
 
 const currentSiteIsFrontend = document.getElementById("current_site_divider")
 
-browser.storage.local.get(["options", "redirects"], r => {
-	browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
-		for (const service in config.services) {
-			if (!r.options.popupServices.includes(service)) allSites.getElementsByClassName(service)[0].classList.add("hide")
-			else allSites.getElementsByClassName(service)[0].classList.remove("hide")
-			currSite.getElementsByClassName(service)[0].classList.add("hide")
-		}
+browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
+	let options = await utils.getOptions()
+	for (const service in config.services) {
+		if (!options.popupServices.includes(service))
+			allSites.getElementsByClassName(service)[0].classList.add("hide")
+		else
+			allSites.getElementsByClassName(service)[0].classList.remove("hide")
+		currSite.getElementsByClassName(service)[0].classList.add("hide")
+	}
 
-		for (const service in config.services) {
-			divs[service].toggle.all.checked = r.options[service].enabled
-			divs[service].toggle.current.checked = r.options[service].enabled
-		}
+	for (const service in config.services) {
+		divs[service].toggle.all.checked = options[service].enabled
+		divs[service].toggle.current.checked = options[service].enabled
+	}
 
-		let url
-		try {
-			url = new URL(tabs[0].url)
-		} catch {
-			currentSiteIsFrontend.classList.add("hide")
-			return
-		}
+	let url
+	try {
+		url = new URL(tabs[0].url)
+	} catch {
+		currentSiteIsFrontend.classList.add("hide")
+		return
+	}
 
-		let service = await serviceHelper.computeService(url, true)
-		let frontend
-		let instance
-		if (service) {
-			if (typeof service != "string") {
-				instance = service[2]
-				frontend = service[1]
-				service = service[0]
-				let isCustom = false
-				for (const network in config.networks) if (r.options[frontend][network].custom.indexOf(instance) > -1) isCustom = true
-			}
-			divs[service].current.classList.remove("hide")
-			divs[service].all.classList.add("hide")
-		} else {
-			currentSiteIsFrontend.classList.add("hide")
+	let service = await servicesHelper.computeService(url, true)
+	let frontend
+	let instance
+	if (service) {
+		if (typeof service != "string") {
+			instance = service[2]
+			frontend = service[1]
+			service = service[0]
+			let isCustom = false
+			for (const network in config.networks)
+				if (options[frontend].indexOf(instance) > -1)
+					isCustom = true
 		}
-	})
+		divs[service].current.classList.remove("hide")
+		divs[service].all.classList.add("hide")
+	} else {
+		currentSiteIsFrontend.classList.add("hide")
+	}
 })
 
 for (const service in config.services) {
-	divs[service].toggle.all.addEventListener("change", () => {
-		browser.storage.local.get("options", r => {
-			let options = r.options
-			options[service].enabled = divs[service].toggle.all.checked
-			browser.storage.local.set({ options })
-		})
+	divs[service].toggle.all.addEventListener("change", async () => {
+		let options = await utils.getOptions()
+		options[service].enabled = divs[service].toggle.all.checked
+		browser.storage.local.set({ options })
 	})
-	divs[service].toggle.current.addEventListener("change", () => {
-		browser.storage.local.get("options", r => {
-			let options = r.options
-			options[service].enabled = divs[service].toggle.current.checked
-			browser.storage.local.set({ options })
-		})
+	divs[service].toggle.current.addEventListener("change", async () => {
+		let options = await utils.getOptions()
+		options[service].enabled = divs[service].toggle.current.checked
+		browser.storage.local.set({ options })
 	})
 }
 
@@ -119,4 +103,4 @@ for (const a of document.getElementsByTagName("a")) {
 			e.preventDefault()
 		}
 	})
-}
+}
\ No newline at end of file
diff --git a/src/pages/popup/popup.pug b/src/pages/popup/popup.pug
new file mode 100644
index 00000000..9a50f913
--- /dev/null
+++ b/src/pages/popup/popup.pug
@@ -0,0 +1,39 @@
+doctype html
+html(lang="en")
+    head
+        meta(charset="UTF-8")
+        meta(name="viewport" content="width=device-width, initial-scale=1.0")
+        link(href="../stylesheets/styles.css" rel="stylesheet")
+        link(href="./style.css" rel="stylesheet")
+    body(dir="auto")
+        div(class="current_site")
+            include /src/pages/widgets/switches
+            div(id="current_site_divider")
+                hr
+
+        div(class="all_sites")
+            include /src/pages/widgets/switches
+
+        hr
+
+        div(class="some-block" id="change_instance_div")
+            a(class="title button prevent" id="change_instance")
+                h4(data-localise="__MSG_switchInstance__") Change Instance
+                svg(xmlns="http://www.w3.org/2000/svg" height="26px" viewBox="0 0 24 24" 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="some-block" id="copy_raw_div" title="Copy the original redirected link")
+            a(class="title button prevent" id="copy_raw")
+                h4(data-localise="__MSG_copyRaw__") Copy Raw
+                svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" 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="some-block")
+            a(class="title button prevent" id="more-options")
+                h4(data-localise="__MSG_settings__") Settings
+                svg(xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor")
+                    path(d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z")
+
+        div(class="space")
+        script(type="module" src="../options/init.js")
+        script(type="module" src="./popup.js")
\ No newline at end of file
diff --git a/src/pages/stylesheets/styles.css b/src/pages/stylesheets/styles.css
index 5f2871e4..5f3c1cbe 100644
--- a/src/pages/stylesheets/styles.css
+++ b/src/pages/stylesheets/styles.css
@@ -28,6 +28,7 @@ body {
 	margin: auto;
 	padding: 0;
 	font-family: "Inter";
+	font-size: 16px;
 	background-color: var(--bg-main);
 	color: var(--text);
 }
@@ -126,6 +127,12 @@ section.links div {
 }
 
 a {
+	text-decoration: none;
+	color: var(--text);
+	transition: 0.1s;
+}
+
+a:hover {
 	color: var(--active);
 }
 
@@ -143,44 +150,11 @@ section.links a.selected {
 	color: var(--active);
 }
 
-input[type="range"] {
-	-webkit-appearance: none;
-	width: 350px;
-	height: 7px;
-	border-radius: 50px;
-	background: var(--text);
-	cursor: ew-resize;
-}
-
-input[type="range"]:hover {
-	background: var(--light-grey);
-}
-
-input[type="range"]::-webkit-slider-thumb {
-	appearance: none;
-	width: 20px;
-	height: 20px;
-	border-radius: 50%;
-	background: var(--active);
-	border: none;
-}
-
-input[type="range"]::-moz-range-thumb {
-	width: 20px;
-	height: 20px;
-	border-radius: 50%;
-	background: var(--active);
-	border: none;
-}
-
 ::placeholder {
 	color: var(--text);
 	opacity: 0.7;
 }
 
-#volume-value {
-	color: var(--active);
-}
 
 /* \25BE */
 
@@ -352,10 +326,6 @@ button svg {
 	color: var(--text);
 }
 
-div.checklist {
-	direction: ltr;
-}
-
 div.checklist div {
 	justify-content: space-between;
 	margin: 5px 15px;
@@ -386,6 +356,10 @@ div.checklist-popup div div {
 	margin: 0;
 }
 
+div.custom-checklist {
+	color: var(--active);
+}
+
 button.add {
 	background-color: transparent;
 	border: none;
@@ -413,7 +387,7 @@ div.disabled {
 body.light-theme {
 	--text: black;
 	--bg-main: white;
-	--bg-secondary: #fff;
+	--bg-secondary: #e4e4e4;
 	--active: #fb9817;
 }
 
@@ -434,6 +408,10 @@ body.light-theme a {
 	color: black;
 }
 
+body.light-theme a:hover {
+	color: var(--active)
+}
+
 section.general {
 	display: flex;
 	flex-wrap: wrap;
diff --git a/src/pages/widgets/head.ejs b/src/pages/widgets/head.ejs
deleted file mode 100644
index d9e3802a..00000000
--- a/src/pages/widgets/head.ejs
+++ /dev/null
@@ -1,8 +0,0 @@
-<head>
-  <meta charset="utf-8">
-  <meta name="viewport" content="width=device-width, initial-scale=1">
-  <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg">
-  <link href="../stylesheets/styles.css" rel="stylesheet">
-  <title>General</title>
-  <script type="module" src="./init.js"></script>
-</head>
diff --git a/src/pages/widgets/head.pug b/src/pages/widgets/head.pug
new file mode 100644
index 00000000..0c6e9fdb
--- /dev/null
+++ b/src/pages/widgets/head.pug
@@ -0,0 +1,7 @@
+head
+    meta(charset="utf-8")
+    meta(name="viewport" content="width=device-width, initial-scale=1")
+    link(rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg")
+    link(href="../stylesheets/styles.css" rel="stylesheet")
+    title Settings
+    script(type="module" src="./init.js")
\ No newline at end of file
diff --git a/src/pages/widgets/links.ejs b/src/pages/widgets/links.ejs
deleted file mode 100644
index 2373a101..00000000
--- a/src/pages/widgets/links.ejs
+++ /dev/null
@@ -1,23 +0,0 @@
-<section class="links" id="links">
-  <div class="title">
-  <a href="#general">
-  <%- include ('src/assets/images/general-icon.svg') %>
-  <span data-localise="__MSG_general__">General</span>
-  </a></div>
-  <% for (const service in services) { -%>
-  <div class="title">
-  <a href="#<%= service %>">
-  <% if (services[service].imageType != "svgMono") { _%>
-  <img src="../../../assets/images/<%= service %>-icon.<%= services[service].imageType %>">
-  <% } else { _%>
-  <%- include ('src/assets/images/' + service + '-icon.svg') %>
-  <% } _%>
-  <span data-localise="__MSG_<%= service %>__"><%= services[service].name %></span>
-  </a></div>
-  <% }; -%>
-  <div class="title">
-  <a href="#about">
-  <%- include ('src/assets/images/about-icon.svg') %>
-  <span data-localise="__MSG_about__">About</span>
-  </a></div>
-</section>
diff --git a/src/pages/widgets/links.pug b/src/pages/widgets/links.pug
new file mode 100644
index 00000000..253177f9
--- /dev/null
+++ b/src/pages/widgets/links.pug
@@ -0,0 +1,22 @@
+section(class="links" id="links")
+    div(class="title")
+        a(href="#general") 
+            include /src/assets/images/general-icon.svg
+            span(data-localise="__MSG_general__") General
+
+    each val, key in services
+        div(class="title")
+            a(href="#"+key)
+                if services[key].imageType == 'svgMono'
+                    img(class='dark' src=`/assets/images/${key}-icon.svg`)
+                    img(class='light' src=`/assets/images/${key}-icon-light.svg`)
+                else
+                    img(src=`/assets/images/${key}-icon.${services[key].imageType}`)
+                span=services[key].name
+
+    div(class="title")
+        a(target="_blank" href="https://libredirect.github.io")
+            img(class='dark' src="/assets/images/about-icon.svg")
+            img(class='light' src="/assets/images/about-icon-light.svg")
+
+            span(data-localise="__MSG_about__") About
diff --git a/src/pages/widgets/switches.ejs b/src/pages/widgets/switches.ejs
deleted file mode 100644
index e3ffdae7..00000000
--- a/src/pages/widgets/switches.ejs
+++ /dev/null
@@ -1,11 +0,0 @@
-<% for (const service in services) { -%>
-<div class="<%= service %> some-block"><a class="title" href="<%= services[service].url %>">
-  <% if (services[service].imageType != "svgMono") { _%>
-  <img src="../../assets/images/<%= service %>-icon.<%= services[service].imageType %>"/>
-  <% } else { _%>
-  <%- include ('src/assets/images/' + service + '-icon.svg') %>
-  <% } _%>
-  <h4 data-localise="__MSG_<%= service %>__"><%= services[service].name %></h4></a>
-  <input class="<%= service %>-enabled" type="checkbox"/>
-</div>
-<% } %>
diff --git a/src/pages/widgets/switches.pug b/src/pages/widgets/switches.pug
new file mode 100644
index 00000000..580a25dc
--- /dev/null
+++ b/src/pages/widgets/switches.pug
@@ -0,0 +1,10 @@
+each val, service in services    
+    div(class=service + " some-block")
+        a(class="title" href=services[service].url)
+            if services[service].imageType == 'svgMono'
+                img(class='dark' src=`/assets/images/${service}-icon.svg`)
+                img(class='light' src=`/assets/images/${service}-icon-light.svg`)
+            else
+                img(src=`/assets/images/${service}-icon.${services[service].imageType}`)
+            h4=services[service].name
+        input(class=service + "-enabled" type="checkbox")
\ No newline at end of file