2019-02-05 17:27:39 -05:00
|
|
|
function isFirefox() {
|
|
|
|
testPlain = navigator.userAgent.indexOf('Firefox') !== -1;
|
|
|
|
if (testPlain) {
|
|
|
|
return testPlain
|
|
|
|
}
|
|
|
|
testTorBrowser = navigator.userAgent.indexOf('Tor') !== -1;
|
|
|
|
if (testTorBrowser) {
|
|
|
|
return testTorBrowser
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
2019-02-05 10:53:26 -05:00
|
|
|
|
2019-02-05 17:27:39 -05:00
|
|
|
if (isFirefox()) {
|
|
|
|
var proxySettings = {
|
|
|
|
proxyType: "manual",
|
|
|
|
http: "http://127.0.0.1:4444",
|
|
|
|
passthrough: "",
|
|
|
|
httpProxyAll: true
|
|
|
|
};
|
|
|
|
browser.proxy.settings.set({value:proxySettings});
|
|
|
|
}else{
|
|
|
|
var config = {
|
|
|
|
mode: "fixed_servers",
|
|
|
|
rules: {
|
|
|
|
proxyForHttp: {
|
|
|
|
scheme: "http",
|
|
|
|
host: "127.0.0.1",
|
|
|
|
port: 4444
|
|
|
|
},
|
|
|
|
proxyForFtp: {
|
|
|
|
scheme: "http",
|
|
|
|
host: "127.0.0.1",
|
|
|
|
port: 4444
|
|
|
|
},
|
|
|
|
proxyForHttps: {
|
|
|
|
scheme: "http",
|
|
|
|
host: "127.0.0.1",
|
|
|
|
port: 4444
|
|
|
|
},
|
|
|
|
fallbackProxy: {
|
|
|
|
scheme: "http",
|
|
|
|
host: "127.0.0.1",
|
|
|
|
port: 4444
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
chrome.proxy.settings.set(
|
|
|
|
{value: config, scope: 'regular'},
|
|
|
|
function() {});
|
|
|
|
}
|