Fixed exclusions in a better way https://github.com/libredirect/browser_extension/issues/665
This commit is contained in:
parent
03d0b41a7f
commit
8f8c2a24e4
|
@ -821,7 +821,14 @@ async function copyRaw(url, test) {
|
||||||
function isException(url) {
|
function isException(url) {
|
||||||
let exceptions = options.exceptions
|
let exceptions = options.exceptions
|
||||||
if (exceptions && url) {
|
if (exceptions && url) {
|
||||||
if (exceptions.url) for (const item of exceptions.url) if (item == url.href) return true
|
if (exceptions.url) {
|
||||||
|
for (let item of exceptions.url) {
|
||||||
|
item = new URL(item)
|
||||||
|
item = item.href
|
||||||
|
item = item.replace(/^http:\/\//, 'https://')
|
||||||
|
if (item == url.href) return true
|
||||||
|
}
|
||||||
|
}
|
||||||
if (exceptions.regex) for (const item of exceptions.regex) if (new RegExp(item).test(url.href)) return true
|
if (exceptions.regex) for (const item of exceptions.regex) if (new RegExp(item).test(url.href)) return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -152,14 +152,10 @@ function calcExceptionsCustomInstances() {
|
||||||
}
|
}
|
||||||
calcExceptionsCustomInstances()
|
calcExceptionsCustomInstances()
|
||||||
document.getElementById("custom-exceptions-instance-form").addEventListener("submit", async event => {
|
document.getElementById("custom-exceptions-instance-form").addEventListener("submit", async event => {
|
||||||
console.log('something plz.... :\')')
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
let val
|
let val
|
||||||
if (instanceType == "url" && nameCustomInstanceInput.validity.valid) {
|
if (instanceType == "url" && nameCustomInstanceInput.validity.valid) {
|
||||||
val = nameCustomInstanceInput.value
|
val = nameCustomInstanceInput.value
|
||||||
const url = new URL(val)
|
|
||||||
val = url.href
|
|
||||||
val = val.replace(/^http:\/\//, 'https://')
|
|
||||||
if (!exceptionsCustomInstances.url.includes(val)) exceptionsCustomInstances.url.push(val)
|
if (!exceptionsCustomInstances.url.includes(val)) exceptionsCustomInstances.url.push(val)
|
||||||
} else if (instanceType == "regex") {
|
} else if (instanceType == "regex") {
|
||||||
val = nameCustomInstanceInput.value
|
val = nameCustomInstanceInput.value
|
||||||
|
|
Loading…
Reference in New Issue