Skip to content

Commit

Permalink
Fixed a bug that bypassses iframes in frontends pages #866
Browse files Browse the repository at this point in the history
  • Loading branch information
ManeraKai committed Dec 12, 2023
1 parent dbd0bbb commit e48f681
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/assets/javascripts/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion src/pages/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e48f681

Please sign in to comment.