This commit is contained in:
Tim Speckhals 2019-01-21 09:40:12 +01:00
parent 6905d417f3
commit 79c7510e4f
3 changed files with 12 additions and 45 deletions

View File

@ -51,14 +51,12 @@ brws.storage.onChanged.addListener(changes=>{
userscript=changes.userscript.newValue userscript=changes.userscript.newValue
} }
}) })
chrome.runtime.onMessage.addListener((request,sender,sendResponse)=>{ chrome.runtime.onMessage.addListener((req, sender, respond) => {
if(enabled) respond({
{ enabled: enabled,
sendResponse({ crowdEnabled: crowdEnabled,
crowdEnabled: crowdEnabled, userscript: userscript
userscript: userscript })
})
}
}) })
//Internal redirects to extension URLs to bypass content script limitations //Internal redirects to extension URLs to bypass content script limitations

View File

@ -2,45 +2,14 @@
if(document instanceof HTMLDocument) if(document instanceof HTMLDocument)
{ {
let brws = (typeof browser == "undefined" ? chrome : browser) let brws = (typeof browser == "undefined" ? chrome : browser)
brws.storage.sync.get(["crowd_bypass_opt_out"],res=>{ brws.runtime.sendMessage({}, res => {
document.documentElement.setAttribute("data-crowd-bypass-opt",(res&&res.crowd_bypass_opt_out&&res.crowd_bypass_opt_out==="true"?"o":"i")) if(!res.enabled)
})
brws.storage.local.get(["custom_bypasses"],res=>{
let f=()=>{
if(res&&res.custom_bypasses)
{
let customBypasses=JSON.parse(res.custom_bypasses)
for(let name in customBypasses)
{
let customBypass=customBypasses[name]
if(customBypass.domains=="*")
injectScript(customBypass.content)
else
{
let domains=customBypass.domains.split(",")
for(let i in domains)
{
let domain=domains[i]
if(location.hostname==domain||location.hostname.substr(location.hostname.length-(domain.length+1))=="."+domain)
injectScript(customBypass.content)
}
}
}
}
}
if(["interactive","complete"].indexOf(document.readyState)>-1)
{ {
f() return
} }
else
{
document.addEventListener("DOMContentLoaded",f)
}
})
brws.runtime.sendMessage({},response=>{
let script=document.createElement("script") let script=document.createElement("script")
script.innerHTML=`(()=>{//Hello, this is Universal Bypass' injection! script.innerHTML=`(()=>{//Hello, this is Universal Bypass' injection!
let crowdEnabled=`+(response.crowdEnabled?"true":"false")+`, let crowdEnabled=`+(res.crowdEnabled ? "true" : "false")+`,
ODP=(t,p,o)=>{try{Object.defineProperty(t,p,o)}catch(e){console.trace("[Universal Bypass] Couldn't define",p)}}, ODP=(t,p,o)=>{try{Object.defineProperty(t,p,o)}catch(e){console.trace("[Universal Bypass] Couldn't define",p)}},
//Copying eval, etc. to prevent issues with other extensions, such as uBlockOrigin. Also, note that this is the page level, so there are no security risks in using eval. //Copying eval, etc. to prevent issues with other extensions, such as uBlockOrigin. Also, note that this is the page level, so there are no security risks in using eval.
ev=eval,sT=setTimeout,sI=setInterval, ev=eval,sT=setTimeout,sI=setInterval,
@ -1064,7 +1033,7 @@ if(document instanceof HTMLDocument)
} }
}); });
dO.observe(document.documentElement, {attributes: true}) dO.observe(document.documentElement, {attributes: true})
script.innerHTML+="\n"+response.userscript+"\n})()" script.innerHTML+="\n"+res.userscript+"\n})()"
script=document.documentElement.appendChild(script) script=document.documentElement.appendChild(script)
setTimeout(()=>document.documentElement.removeChild(script),10) setTimeout(()=>document.documentElement.removeChild(script),10)
}) })

View File

@ -11,7 +11,7 @@
"name": "Universal Bypass", "name": "Universal Bypass",
"description": "__MSG_appDesc__", "description": "__MSG_appDesc__",
"homepage_url": "https://universal-bypass.org/", "homepage_url": "https://universal-bypass.org/",
"version": "9.2.4", "version": "9.2.5",
"author": "Tim \"timmyRS\" Speckhals", "author": "Tim \"timmyRS\" Speckhals",
"incognito": "split", "incognito": "split",
"permissions": [ "permissions": [