diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js
index 59316df..afd7906 100644
--- a/src/assets/javascripts/services.js
+++ b/src/assets/javascripts/services.js
@@ -76,7 +76,7 @@ function redirect(url, type, initiator) {
}
if (Object.keys(config.services[service].frontends).length > 1) {
- if (type == "sub_frame") frontend = options[service].embedFrontend
+ if (type == "sub_frame" && config.services[service].embeddable && !config.services[service].frontends[options[service].frontend].embeddable) frontend = options[service].embedFrontend
else frontend = options[service].frontend
} else frontend = Object.keys(config.services[service].frontends)[0]
diff --git a/src/config/config.json b/src/config/config.json
index 6866453..09c95bb 100644
--- a/src/config/config.json
+++ b/src/config/config.json
@@ -279,7 +279,7 @@
"options": { "enabled": false },
"imageType": "svg",
"embeddable": false,
- "url": "https://wikipedia.com"
+ "url": "https://wikipedia.org"
},
"medium": {
"frontends": {
diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py
index 9a53f92..c789f55 100644
--- a/src/instances/get_instances.py
+++ b/src/instances/get_instances.py
@@ -25,16 +25,33 @@ with open('./src/config/config.json', 'rt') as tmp:
def filterLastSlash(urlList):
tmp = {}
- for x in urlList:
- tmp[x] = {}
- for y in urlList[x]:
- tmp[x][y] = []
- for z in urlList[x][y]:
- if z.endswith('/'):
- tmp[x][y].append(z[:-1])
- print(Fore.YELLOW + "Fixed " + Style.RESET_ALL + z)
+ for frontend in urlList:
+ tmp[frontend] = {}
+ for network in urlList[frontend]:
+ tmp[frontend][network] = []
+ for url in urlList[frontend][network]:
+ if url.endswith('/'):
+ tmp[frontend][network].append(url[:-1])
+ print(Fore.YELLOW + "Fixed " + Style.RESET_ALL + url)
else:
- tmp[x][y].append(z)
+ tmp[frontend][network].append(url)
+ return tmp
+
+
+def idnaEncode(urlList):
+ tmp = {}
+ for frontend in urlList:
+ tmp[frontend] = {}
+ for network in urlList[frontend]:
+ tmp[frontend][network] = []
+ for url in urlList[frontend][network]:
+ try:
+ encodedUrl = url.encode("idna").decode("utf8")
+ tmp[frontend][network].append(encodedUrl)
+ if (encodedUrl != url):
+ print(Fore.YELLOW + "Fixed " + Style.RESET_ALL + url)
+ except Exception:
+ tmp[frontend][network].append(url)
return tmp
@@ -247,7 +264,7 @@ def piped():
_list['loki'] = []
r = requests.get(
'https://raw.githubusercontent.com/wiki/TeamPiped/Piped/Instances.md')
-
+
tmp = re.findall(
r'(?:[^\s\/]+\.)+[a-zA-Z]+ (?:\(Official\) )?\| (https:\/{2}(?:[^\s\/]+\.)+[a-zA-Z]+) \| ', r.text)
for item in tmp:
@@ -431,7 +448,6 @@ def peertube():
def isValid(url): # This code is contributed by avanitrachhadiya2155
try:
- url.encode('ascii')
result = urlparse(url)
return all([result.scheme, result.netloc])
except Exception:
@@ -465,6 +481,7 @@ hyperpipe()
facil()
simpleertube()
mightyList = filterLastSlash(mightyList)
+mightyList = idnaEncode(mightyList)
cloudflare = []
authenticate = []
diff --git a/src/pages/options/index.html b/src/pages/options/index.html
index 5421bb8..d79da01 100644
--- a/src/pages/options/index.html
+++ b/src/pages/options/index.html
@@ -116,7 +116,7 @@
@@ -182,56 +182,56 @@
-
Twitter
+
Twitter
@@ -243,42 +243,42 @@
- Medium
+ Medium
@@ -288,7 +288,7 @@
- Search
+ Search
@@ -298,7 +298,7 @@
- Translate
+ Translate
@@ -308,7 +308,7 @@
- Maps
+ Maps
@@ -318,7 +318,7 @@
- Send Files
+ Send Files
diff --git a/src/pages/options/widgets/general.ejs b/src/pages/options/widgets/general.ejs
index 8f7ab02..77028ac 100644
--- a/src/pages/options/widgets/general.ejs
+++ b/src/pages/options/widgets/general.ejs
@@ -21,7 +21,7 @@
@@ -92,7 +92,7 @@
<% } else { _%>
<%- include ('src/assets/images/' + service + '-icon.svg') %>
<% } _%>
- <%= config.services[service].name %>
+ <%= config.services[service].name %>
diff --git a/src/pages/options/widgets/general.js b/src/pages/options/widgets/general.js
index 92632f2..a58ca3e 100644
--- a/src/pages/options/widgets/general.js
+++ b/src/pages/options/widgets/general.js
@@ -28,7 +28,7 @@ async function getConfig() {
})
}
-function setOption(option, multiChoice, event) {
+function setOption(option, type, event) {
browser.storage.local.get("options", r => {
let options = r.options
browser.storage.local.set({ options })
@@ -36,13 +36,15 @@ function setOption(option, multiChoice, event) {
browser.storage.local.get("options", r => {
let options = r.options
- if (multiChoice) {
+ if (type == "select") {
options[option] = event.target.options[event.target.options.selectedIndex].value
- } else {
+ } else if (type == "checkbox") {
options[option] = event.target.checked
+ } else if (type == "range") {
+ options[option] = event.target.value
}
+
browser.storage.local.set({ options })
- location.reload()
})
}
@@ -120,30 +122,30 @@ resetSettings.addEventListener("click", async () => {
let autoRedirectElement = document.getElementById("auto-redirect")
autoRedirectElement.addEventListener("change", event => {
- setOption("autoRedirect", false, event)
+ setOption("autoRedirect", "checkbox", event)
})
let themeElement = document.getElementById("theme")
themeElement.addEventListener("change", event => {
- setOption("theme", true, event)
+ setOption("theme", "select", event)
location.reload()
})
let networkElement = document.getElementById("network")
networkElement.addEventListener("change", event => {
- setOption("network", true, event)
+ setOption("network", "select", event)
location.reload()
})
let networkFallbackCheckbox = document.getElementById("network-fallback-checkbox")
networkFallbackCheckbox.addEventListener("change", event => {
- setOption("networkFallback", false, event)
+ setOption("networkFallback", "checkbox", event)
})
let latencyOutput = document.getElementById("latency-output")
let latencyInput = document.getElementById("latency-input")
latencyInput.addEventListener("change", event => {
- setOption("latencyThreshold", false, event)
+ setOption("latencyThreshold", "range", event)
})
latencyInput.addEventListener("input", event => {
latencyOutput.value = event.target.value
@@ -153,18 +155,19 @@ let nameCustomInstanceInput = document.getElementById("exceptions-custom-instanc
let instanceTypeElement = document.getElementById("exceptions-custom-instance-type")
let instanceType = "url"
-let popupServices
-
await getConfig()
for (const service in config.services) {
document.getElementById(service).addEventListener("change", event => {
- if (event.target.checked && !popupServices.includes(service)) popupServices.push(service)
- else if (popupServices.includes(service)) {
- var index = popupServices.indexOf(service)
- if (index !== -1) popupServices.splice(index, 1)
- }
- browser.storage.local.set({ popupServices })
+ 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 })
+ })
})
}
// const firstPartyIsolate = document.getElementById('firstPartyIsolate');
@@ -176,13 +179,14 @@ browser.storage.local.get("options", r => {
networkElement.value = r.options.network
networkFallbackCheckbox.checked = r.options.networkFallback
latencyOutput.value = r.options.latencyThreshold
+ let options = r.options
// firstPartyIsolate.checked = r.firstPartyIsolate;
- let networkFallbackElement = document.getElementById("network-fallback")
+ //let networkFallbackElement = document.getElementById("network-fallback")
if (networkElement.value == "clearnet") {
- networkFallbackElement.style.display = "none"
+ networkFallbackCheckbox.disabled = true
} else {
- networkFallbackElement.style.display = "block"
+ networkFallbackCheckbox.disabled = false
}
instanceTypeElement.addEventListener("change", event => {
@@ -251,6 +255,5 @@ browser.storage.local.get("options", r => {
calcExceptionsCustomInstances()
})
- popupServices = r.options.popupServices
- for (const service in config.services) document.getElementById(service).checked = popupServices.includes(service)
+ for (const service in config.services) document.getElementById(service).checked = options.popupServices.includes(service)
})
diff --git a/src/pages/popup/popup.html b/src/pages/popup/popup.html
index b507663..54c4fef 100644
--- a/src/pages/popup/popup.html
+++ b/src/pages/popup/popup.html
@@ -43,7 +43,7 @@
Imgur
-