Fixed a bug that bypassses iframes in frontends pages https://github.com/libredirect/browser_extension/issues/866
This commit is contained in:
parent
dbd0bbb03e
commit
e48f68126d
|
@ -104,7 +104,10 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
|
||||||
initiator
|
initiator
|
||||||
&&
|
&&
|
||||||
instanceList.includes(initiator.origin)
|
instanceList.includes(initiator.origin)
|
||||||
) return "BYPASSTAB"
|
) {
|
||||||
|
if (type != "main_frame") return null
|
||||||
|
else return "BYPASSTAB"
|
||||||
|
}
|
||||||
|
|
||||||
randomInstance = utils.getRandomInstance(instanceList)
|
randomInstance = utils.getRandomInstance(instanceList)
|
||||||
if (config.services[service].frontends[frontend].localhost && options[service].instance == "localhost") {
|
if (config.services[service].frontends[frontend].localhost && options[service].instance == "localhost") {
|
||||||
|
@ -581,7 +584,7 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
|
||||||
const reg = /^([0-9]+)\.media\.tumblr\.com/.exec(url.hostname) // *.media.tumblr.com
|
const reg = /^([0-9]+)\.media\.tumblr\.com/.exec(url.hostname) // *.media.tumblr.com
|
||||||
if (reg)
|
if (reg)
|
||||||
return `${randomInstance}/tblr/media/${reg[1]}${url.pathname}${url.search}`
|
return `${randomInstance}/tblr/media/${reg[1]}${url.pathname}${url.search}`
|
||||||
|
|
||||||
const blogregex = /^(?:www\.)?([a-z\d-]+)\.tumblr\.com/.exec(url.hostname) // <blog>.tumblr.com
|
const blogregex = /^(?:www\.)?([a-z\d-]+)\.tumblr\.com/.exec(url.hostname) // <blog>.tumblr.com
|
||||||
if (blogregex) {
|
if (blogregex) {
|
||||||
const blog_name = blogregex[1];
|
const blog_name = blogregex[1];
|
||||||
|
|
|
@ -71,7 +71,7 @@ browser.webRequest.onBeforeRequest.addListener(
|
||||||
if (tabIdRedirects[details.tabId] != false) tabIdRedirects[details.tabId] = false
|
if (tabIdRedirects[details.tabId] != false) tabIdRedirects[details.tabId] = false
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
console.info("Redirecting", url.href, "=>", newUrl)
|
console.log("Redirecting", url.href, "=>", newUrl)
|
||||||
return { redirectUrl: newUrl }
|
return { redirectUrl: newUrl }
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
|
Loading…
Reference in New Issue