Hey it works with chrome too, mostly
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
browser.windows.onCreated.addListener(themeWindow);
|
||||
chrome.windows.onCreated.addListener(themeWindow);
|
||||
|
||||
// Theme all currently open windows
|
||||
browser.windows.getAll().then(wins => wins.forEach(themeWindow));
|
||||
//browser.windows.getAll().then(wins => wins.forEach(themeWindow));
|
||||
|
||||
var titlepref = browser.i18n.getMessage("titlePreface");
|
||||
var titleprefpriv = browser.i18n.getMessage("titlePrefacePrivate");
|
||||
|
||||
var titlepref = chrome.i18n.getMessage("titlePreface");
|
||||
var titleprefpriv = chrome.i18n.getMessage("titlePrefacePrivate");
|
||||
|
||||
function themeWindow(window) {
|
||||
// Check if the window is in private browsing
|
||||
if (window.incognito) {
|
||||
browser.theme.update(window.id, {
|
||||
chrome.theme.update(window.id, {
|
||||
images: {
|
||||
headerURL: "icons/toopie.png",
|
||||
},
|
||||
@@ -20,12 +21,12 @@ function themeWindow(window) {
|
||||
toolbar_text: "white"
|
||||
}
|
||||
});
|
||||
browser.windows.update(window.id, {
|
||||
chrome.windows.update(window.id, {
|
||||
titlePreface: titleprefpriv
|
||||
});
|
||||
}
|
||||
else {
|
||||
browser.theme.update(window.id, {
|
||||
chrome.theme.update(window.id, {
|
||||
images: {
|
||||
headerURL: "icons/toopie.png",
|
||||
},
|
||||
@@ -36,7 +37,7 @@ function themeWindow(window) {
|
||||
toolbar_text: "white"
|
||||
}
|
||||
});
|
||||
browser.windows.update(window.id, {
|
||||
chrome.windows.update(window.id, {
|
||||
titlePreface: titlepref
|
||||
});
|
||||
}
|
||||
@@ -44,12 +45,12 @@ function themeWindow(window) {
|
||||
|
||||
function setTitle(window){
|
||||
if (window.incognito) {
|
||||
browser.windows.update(window.id, {
|
||||
chrome.windows.update(window.id, {
|
||||
titlePreface: titleprefpriv
|
||||
});
|
||||
}
|
||||
else {
|
||||
browser.windows.update(window.id, {
|
||||
chrome.windows.update(window.id, {
|
||||
titlePreface: titlepref
|
||||
});
|
||||
}
|
||||
@@ -59,12 +60,12 @@ function setTitleError(window){
|
||||
alert("plugin error setting title on", window.id)
|
||||
}
|
||||
|
||||
browser.windows.onCreated.addListener(() => {
|
||||
const gettingStoredSettings = browser.storage.local.get();
|
||||
chrome.windows.onCreated.addListener(() => {
|
||||
const gettingStoredSettings = chrome.storage.local.get();
|
||||
gettingStoredSettings.then(setupProxy, onError);
|
||||
});
|
||||
|
||||
browser.tabs.onCreated.addListener(() => {
|
||||
const getting = browser.windows.getCurrent({populate: true});
|
||||
chrome.tabs.onCreated.addListener(() => {
|
||||
const getting = chrome.windows.getCurrent({populate: true});
|
||||
getting.then(setTitle, setTitleError);
|
||||
});
|
||||
|
8
info.js
8
info.js
@@ -1,6 +1,6 @@
|
||||
document.addEventListener("click", (e) => {
|
||||
function getCurrentWindow() {
|
||||
return browser.windows.getCurrent();
|
||||
return chrome.windows.getCurrent();
|
||||
}
|
||||
|
||||
if (e.target.id === "window-create-help-panel") {
|
||||
@@ -8,7 +8,7 @@ document.addEventListener("click", (e) => {
|
||||
type: "panel",
|
||||
incognito: true,
|
||||
};
|
||||
let creating = browser.windows.create(createData);
|
||||
let creating = chrome.windows.create(createData);
|
||||
creating.then(() => {
|
||||
console.log("The help panel has been created");
|
||||
});
|
||||
@@ -17,7 +17,7 @@ document.addEventListener("click", (e) => {
|
||||
type: "panel",
|
||||
incognito: true,
|
||||
};
|
||||
let creating = browser.windows.create(createData);
|
||||
let creating = chrome.windows.create(createData);
|
||||
creating.then(() => {
|
||||
console.log("The news panel has been created");
|
||||
});
|
||||
@@ -38,7 +38,7 @@ document.addEventListener("click", (e) => {
|
||||
let updateInfo = {
|
||||
titlePreface: "I2P Help | "
|
||||
}
|
||||
browser.windows.update(currentWindow.id, updateInfo);
|
||||
chrome.windows.update(currentWindow.id, updateInfo);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
"permissions": ["theme", "proxy", "privacy", "storage"],
|
||||
"manifest_version": 2,
|
||||
"name": "__MSG_extensionName__",
|
||||
"version": "1.17",
|
||||
"version": "1.18",
|
||||
"description": "__MSG_extensionDescription__",
|
||||
"homepage_url": "https://github.com/eyedeekay/i2psetproxy.js",
|
||||
"icons": {
|
||||
|
@@ -1,27 +1,27 @@
|
||||
|
||||
function SetHostText(){
|
||||
var hostid = document.getElementById('hostText');
|
||||
hostid.textContent = browser.i18n.getMessage("hostText");
|
||||
hostid.textContent = chrome.i18n.getMessage("hostText");
|
||||
}
|
||||
|
||||
function SetPortText(){
|
||||
var portid = document.getElementById('portText');
|
||||
portid.textContent = browser.i18n.getMessage("portText");
|
||||
portid.textContent = chrome.i18n.getMessage("portText");
|
||||
}
|
||||
|
||||
function SetControlHostText(){
|
||||
var controlhostid = document.getElementById('controlHostText');
|
||||
controlhostid.textContent = browser.i18n.getMessage("controlHostText");
|
||||
controlhostid.textContent = chrome.i18n.getMessage("controlHostText");
|
||||
}
|
||||
|
||||
function SetControlPortText(){
|
||||
var controlportid = document.getElementById('controlPortText');
|
||||
controlportid.textContent = browser.i18n.getMessage("controlPortText");
|
||||
controlportid.textContent = chrome.i18n.getMessage("controlPortText");
|
||||
}
|
||||
|
||||
function SetControlHelpText(){
|
||||
var portid = document.getElementById('controlHelpText');
|
||||
portid.textContent = browser.i18n.getMessage("controlHelpText");
|
||||
portid.textContent = chrome.i18n.getMessage("controlHelpText");
|
||||
}
|
||||
|
||||
function getScheme() {
|
||||
@@ -95,7 +95,7 @@ function checkStoredSettings(storedSettings) {
|
||||
if (!storedSettings.control_port) {
|
||||
defaultSettings["control_port"] = 4444
|
||||
}
|
||||
browser.storage.local.set(defaultSettings);
|
||||
chrome.storage.local.set(defaultSettings);
|
||||
}
|
||||
|
||||
function onError(e) {
|
||||
@@ -116,7 +116,7 @@ function setupProxy() {
|
||||
passthrough: "",
|
||||
httpProxyAll: true
|
||||
};
|
||||
browser.proxy.settings.set({value:proxySettings});
|
||||
chrome.proxy.settings.set({value:proxySettings});
|
||||
console.log("i2p settings created for Firefox")
|
||||
}
|
||||
}else{
|
||||
@@ -158,7 +158,7 @@ function storeSettings() {
|
||||
let proxy_port = getPort()
|
||||
let control_host = getControlHost()
|
||||
let control_port = getControlPort()
|
||||
browser.storage.local.set({
|
||||
chrome.storage.local.set({
|
||||
proxy_scheme,
|
||||
proxy_host,
|
||||
proxy_port,
|
||||
@@ -206,10 +206,10 @@ function onError(e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
const assureStoredSettings = browser.storage.local.get();
|
||||
const assureStoredSettings = chrome.storage.local.get();
|
||||
assureStoredSettings.then(checkStoredSettings, onError);
|
||||
|
||||
const gettingStoredSettings = browser.storage.local.get();
|
||||
const gettingStoredSettings = chrome.storage.local.get();
|
||||
gettingStoredSettings.then(updateUI, onError);
|
||||
|
||||
const saveButton = document.querySelector("#save-button");
|
||||
|
26
proxy.js
26
proxy.js
@@ -9,10 +9,11 @@ function isFirefox() {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
browser.privacy.network.peerConnectionEnabled.set({value: false});
|
||||
browser.privacy.network.networkPredictionEnabled.set({value: false});
|
||||
browser.privacy.network.webRTCIPHandlingPolicy.set({value: "disable_non_proxied_udp"});
|
||||
if (isFirefox()) {
|
||||
browser.privacy.network.peerConnectionEnabled.set({value: false});
|
||||
}
|
||||
chrome.privacy.network.networkPredictionEnabled.set({value: false});
|
||||
chrome.privacy.network.webRTCIPHandlingPolicy.set({value: "disable_non_proxied_udp"});
|
||||
|
||||
console.log("Preliminarily disabled WebRTC.")
|
||||
|
||||
@@ -30,7 +31,7 @@ function setupProxy() {
|
||||
passthrough: "",
|
||||
httpProxyAll: true
|
||||
};
|
||||
browser.proxy.settings.set({value:proxySettings});
|
||||
chrome.proxy.settings.set({value:proxySettings});
|
||||
console.log("i2p settings created for Firefox")
|
||||
}
|
||||
}else{
|
||||
@@ -66,15 +67,8 @@ function setupProxy() {
|
||||
}
|
||||
}
|
||||
|
||||
function RefreshIdentity(){
|
||||
console.log("Generating new identity")
|
||||
const Http = new XMLHttpRequest();
|
||||
const url='http://' + controlHost + ":" + controlPort
|
||||
Http.open("GET", url);
|
||||
Http.send();
|
||||
Http.onreadystatechange=(e)=>{
|
||||
console.log(Http.responseText)
|
||||
}
|
||||
}
|
||||
|
||||
browser.browserAction.onClicked.addListener(RefreshIdentity);
|
||||
if (isFirefox()){
|
||||
// Theme all currently open windows
|
||||
browser.windows.getAll().then(wins => wins.forEach(themeWindow));
|
||||
}
|
||||
|
Reference in New Issue
Block a user