Fixed a bug that bypassses iframes in frontends pages https://github.com/libredirect/browser_extension/issues/866

This commit is contained in:
ManeraKai 2023-12-12 14:42:45 +03:00
parent dbd0bbb03e
commit e48f68126d
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
2 changed files with 6 additions and 3 deletions

View File

@ -104,7 +104,10 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
initiator
&&
instanceList.includes(initiator.origin)
) return "BYPASSTAB"
) {
if (type != "main_frame") return null
else return "BYPASSTAB"
}
randomInstance = utils.getRandomInstance(instanceList)
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
if (reg)
return `${randomInstance}/tblr/media/${reg[1]}${url.pathname}${url.search}`
const blogregex = /^(?:www\.)?([a-z\d-]+)\.tumblr\.com/.exec(url.hostname) // <blog>.tumblr.com
if (blogregex) {
const blog_name = blogregex[1];

View File

@ -71,7 +71,7 @@ browser.webRequest.onBeforeRequest.addListener(
if (tabIdRedirects[details.tabId] != false) tabIdRedirects[details.tabId] = false
return null
}
console.info("Redirecting", url.href, "=>", newUrl)
console.log("Redirecting", url.href, "=>", newUrl)
return { redirectUrl: newUrl }
}
return null