ad pac file based proxy setting so it can be easy on Android
This commit is contained in:
2
Makefile
2
Makefile
@@ -24,7 +24,7 @@ uninstall:
|
||||
clobber:
|
||||
rm -f ../i2psetproxy.js.zip ../i2p_proxy*.xpi
|
||||
|
||||
VERSION=1.19
|
||||
VERSION=1.21
|
||||
|
||||
xpi:
|
||||
mv ~/Downloads/i2p_proxy-$(VERSION)-an+fx.xpi ../i2psetproxy.js@eyedeekay.github.io.xpi
|
||||
|
||||
3
android.pac
Normal file
3
android.pac
Normal file
@@ -0,0 +1,3 @@
|
||||
function FindProxyForURL(url, host) {
|
||||
return "PROXY 127.0.0.1:4444";
|
||||
}
|
||||
@@ -1,9 +1,5 @@
|
||||
chrome.windows.onCreated.addListener(themeWindow);
|
||||
|
||||
// Theme all currently open windows
|
||||
//browser.windows.getAll().then(wins => wins.forEach(themeWindow));
|
||||
|
||||
|
||||
var titlepref = chrome.i18n.getMessage("titlePreface");
|
||||
var titleprefpriv = chrome.i18n.getMessage("titlePrefacePrivate");
|
||||
|
||||
@@ -12,10 +8,10 @@ function themeWindow(window) {
|
||||
if (window.incognito) {
|
||||
chrome.theme.update(window.id, {
|
||||
images: {
|
||||
headerURL: "icons/toopie.png",
|
||||
theme_frame: "icons/toopie.png",
|
||||
},
|
||||
colors: {
|
||||
accentcolor: "#A0A0DE",
|
||||
frame: "#A0A0DE",
|
||||
textcolor: "white",
|
||||
toolbar: "#A0A0DE",
|
||||
toolbar_text: "white"
|
||||
@@ -28,10 +24,10 @@ function themeWindow(window) {
|
||||
else {
|
||||
chrome.theme.update(window.id, {
|
||||
images: {
|
||||
headerURL: "icons/toopie.png",
|
||||
theme_frame: "icons/toopie.png",
|
||||
},
|
||||
colors: {
|
||||
accentcolor: "#BFA0DE",
|
||||
frame: "#BFA0DE",
|
||||
textcolor: "white",
|
||||
toolbar: "#BFA0DE",
|
||||
toolbar_text: "white"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"permissions": ["theme", "proxy", "privacy", "storage"],
|
||||
"manifest_version": 2,
|
||||
"name": "__MSG_extensionName__",
|
||||
"version": "1.19",
|
||||
"version": "1.20",
|
||||
"description": "__MSG_extensionDescription__",
|
||||
"homepage_url": "https://github.com/eyedeekay/i2psetproxy.js",
|
||||
"icons": {
|
||||
@@ -28,3 +28,4 @@
|
||||
},
|
||||
"default_locale": "en"
|
||||
}
|
||||
|
||||
|
||||
31
proxy.js
31
proxy.js
@@ -9,6 +9,14 @@ function isFirefox() {
|
||||
}
|
||||
return false
|
||||
}
|
||||
function isDroid() {
|
||||
testPlain = navigator.userAgent.indexOf('Android') !== -1;
|
||||
if (testPlain) {
|
||||
return testPlain
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
if (isFirefox()) {
|
||||
browser.privacy.network.peerConnectionEnabled.set({value: false});
|
||||
}
|
||||
@@ -20,19 +28,24 @@ console.log("Preliminarily disabled WebRTC.")
|
||||
var controlHost = "127.0.0.1" //getControlHost()
|
||||
var controlPort = "7951" //getControlPort();
|
||||
|
||||
|
||||
function setupProxy() {
|
||||
var controlHost = getControlHost();
|
||||
var controlPort = getControlPort();
|
||||
if (isFirefox()) {
|
||||
if (getScheme() == "http") {
|
||||
var proxySettings = {
|
||||
proxyType: "manual",
|
||||
http: getHost()+":"+getPort(),
|
||||
passthrough: "",
|
||||
httpProxyAll: true
|
||||
};
|
||||
chrome.proxy.settings.set({value:proxySettings});
|
||||
console.log("i2p settings created for Firefox")
|
||||
if (isDroid()) {
|
||||
browser.proxy.register("android.pac");
|
||||
}else{
|
||||
if (getScheme() == "http") {
|
||||
var proxySettings = {
|
||||
proxyType: "manual",
|
||||
http: getHost()+":"+getPort(),
|
||||
passthrough: "",
|
||||
httpProxyAll: true
|
||||
};
|
||||
chrome.proxy.settings.set({value:proxySettings});
|
||||
console.log("i2p settings created for Firefox")
|
||||
}
|
||||
}
|
||||
}else{
|
||||
var config = {
|
||||
|
||||
Reference in New Issue
Block a user