diff --git a/.gitignore b/.gitignore
index 94e387d..e76e26f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
README.md.asc
node_modules/
+web-ext-artifacts
diff --git a/Makefile b/Makefile
index 3150e13..3ce0e52 100644
--- a/Makefile
+++ b/Makefile
@@ -36,8 +36,8 @@ clean:
## EVEN RELEASES are AMO RELEASES
## ODD RELEASES are SELFHOSTED RELEASES
-MOZ_VERSION=0.46
-VERSION=0.47
+MOZ_VERSION=0.48
+VERSION=0.49
#VERSION=$(MOZ_VERSION)
#VERSION=1.27
@@ -112,7 +112,8 @@ moz-sign: version
@echo "Using the 'sign' target to instantly sign an extension for self-distribution"
@echo "requires a JWT API Key and Secret from addons.mozilla.org to be made available"
@echo "to the Makefile under the variables WEB_EXT_API_KEY and WEB_EXT_API_SECRET."
- web-ext sign --channel unlisted --config-discovery false --api-key $(WEB_EXT_API_KEY) --api-secret $(WEB_EXT_API_SECRET); true
+ web-ext-submit --channel unlisted --config-discovery false --api-key $(WEB_EXT_API_KEY) --api-secret $(WEB_EXT_API_SECRET); true
+ cp web-ext-artifacts/*.xpi ./i2ppb@eyedeekay.github.io.xpi
##EVEN NUMBERED, MOZILLA-DISTRIBUTED VERSIONS HERE!
moz-submit: moz-version
diff --git a/README.md b/README.md
index 08fa7c7..08248f5 100644
--- a/README.md
+++ b/README.md
@@ -57,12 +57,12 @@ command:
to the I2P container. Isolate the router console from other local
applications by automatically intercepting requests to the router console to
another container.
- * [done/wip] **Indicate** the I2P browser is in use visually. Find an
+ * [done] **Indicate** the I2P browser is in use visually. Find an
acceptable way to indicate it on Android.
* [done] **Set** the http proxy to use the local I2P proxy automatically.
Provide specific configuration for other types of I2P proxies(SOCKS,
isolating HTTP)
- * [done/wip] **Disable** risky webRTC features/offer the option to re-enable
+ * [done] **Disable** risky webRTC features/offer the option to re-enable
them with the proxy enforced.
* [done] **Change** the color of the browser window to indicate that I2P is in
use
@@ -71,18 +71,18 @@ command:
* it does this by working in conjunction with this
[standalone HTTP proxy](https://github.com/eyedeekay/httptunnel), currently
disabled*.
- * [ready] **Provide** help in a variety of languages.
+ * [ready/broken/wip] **Provide** help in a variety of languages.
* [wip] **Monitor** the health and readiness of the I2P router it is
instructed to use. Currently the plugin checks whether the HTTP Proxy is
working by fetching an image from "http://proxy.i2p" and displaying a result.
A work-in-progress binding to i2pcontrol is available in ./i2pcontrol, it is
inert at this time.
- * [1/2] **Handle** router console applications under their own origins and
+ * [Done] **Handle** router console applications under their own origins and
within their own contextual identity. (1) The router console is automatically
confined to it's own container tab. (2) Use a custom protocol handler to
place each i2p application/plugin under it's own origin, shortening router
console URL's and placing applications under their own origin.
- * [not started] **Handle Torrents** by talking to i2psnark-rpc plugin and then
+ * [wip] **Handle Torrents** by talking to i2psnark-rpc plugin and then
adding them directly into the Firefox downloads drop-downs, menus, etc. If I
can.
diff --git a/background.js b/background.js
index 230db28..f697ade 100644
--- a/background.js
+++ b/background.js
@@ -11,7 +11,7 @@ var torrentprefpriv = chrome.i18n.getMessage("torrentPrefacePrivate");
var tunnelpref = chrome.i18n.getMessage("i2ptunnelPreface");
var tunnelprefpriv = chrome.i18n.getMessage("i2ptunnelPrefacePrivate");
-function onGot(contexts) {
+function onContextsGot(contexts) {
var ids = [];
for (let context of contexts) {
console.log(`Name: ${context.name}`);
@@ -78,25 +78,41 @@ function onCreated(context) {
console.log(`New identity's ID: ${context.cookieStoreId}.`);
}
-function onError(e) {
- console.error(e);
-}
+var gettingInfo = browser.runtime.getPlatformInfo();
+gettingInfo.then(got => {
+ if (got.os == "android") {
+ browser.contextualIdentities.query({}).then(onContextsGot, onError);
+ } else {
+ browser.windows.onCreated.addListener(() => {
+ browser.contextualIdentities.query({}).then(onContextsGot, onError);
+ });
+ }
+});
-browser.contextualIdentities.query({}).then(onGot, onError);
-
-if (!isDroid()) {
- chrome.windows.onCreated.addListener(themeWindow);
- chrome.windows.onFocusChanged.addListener(themeWindow);
- chrome.windows.onRemoved.addListener(themeWindow);
- chrome.tabs.onUpdated.addListener(themeWindowByTab);
- chrome.tabs.onActivated.addListener(themeWindowByTab);
-} else {
-}
+var gettingInfo = browser.runtime.getPlatformInfo();
+gettingInfo.then(got => {
+ if (got.os == "android") {
+ } else {
+ browser.windows.onCreated.addListener(themeWindow);
+ browser.windows.onFocusChanged.addListener(themeWindow);
+ browser.windows.onRemoved.addListener(themeWindow);
+ browser.tabs.onUpdated.addListener(themeWindowByTab);
+ browser.tabs.onActivated.addListener(themeWindowByTab);
+ }
+});
function themeWindowByTab(tabId) {
function tabWindow(tab) {
- getwindow = browser.windows.get(tab.windowId);
- getwindow.then(themeWindow);
+ var gettingInfo = browser.runtime.getPlatformInfo();
+ gettingInfo.then(got => {
+ if (got.os == "android") {
+ getwindow = browser.tabs.get(tab.tabId);
+ getwindow.then(themeWindow);
+ } else {
+ getwindow = browser.windows.get(tab.windowId);
+ getwindow.then(themeWindow);
+ }
+ });
}
if (typeof tabId === "number") {
tab = browser.tabs.get(tabId);
@@ -109,18 +125,18 @@ function themeWindowByTab(tabId) {
function themeWindow(window) {
// Check if the window is in private browsing
function logTabs(tabInfo) {
- function onGot(context) {
+ function onContextGotTheme(context) {
if (context.name == titlepref) {
console.log("Active in I2P window");
if (window.incognito) {
- chrome.theme.update(window.id, {
+ browser.theme.update(window.id, {
colors: {
frame: "#FFC56D",
toolbar: "#FFC56D"
}
});
} else {
- chrome.theme.update(window.id, {
+ browser.theme.update(window.id, {
colors: {
frame: "#FFC56D",
toolbar: "#FFC56D"
@@ -130,14 +146,14 @@ function themeWindow(window) {
} else if (context.name == routerpref) {
console.log("Active in Router Console window");
if (window.incognito) {
- chrome.theme.update(window.id, {
+ browser.theme.update(window.id, {
colors: {
frame: "#A4C8E1",
toolbar: "#A4C8E1"
}
});
} else {
- chrome.theme.update(window.id, {
+ browser.theme.update(window.id, {
colors: {
frame: "#A4C8E1",
toolbar: "#A4C8E1"
@@ -147,14 +163,14 @@ function themeWindow(window) {
} else if (context.name == tunnelpref) {
console.log("Active in Hidden Services Manager window");
if (window.incognito) {
- chrome.theme.update(window.id, {
+ browser.theme.update(window.id, {
colors: {
frame: "#D9D9D6",
toolbar: "#D9D9D6"
}
});
} else {
- chrome.theme.update(window.id, {
+ browser.theme.update(window.id, {
colors: {
frame: "#D9D9D6",
toolbar: "#D9D9D6"
@@ -164,14 +180,14 @@ function themeWindow(window) {
} else if (context.name == mailpref) {
console.log("Active in Web Mail window");
if (window.incognito) {
- chrome.theme.update(window.id, {
+ browser.theme.update(window.id, {
colors: {
frame: "#F7E59A",
toolbar: "#F7E59A"
}
});
} else {
- chrome.theme.update(window.id, {
+ browser.theme.update(window.id, {
colors: {
frame: "#F7E59A",
toolbar: "#F7E59A"
@@ -181,14 +197,14 @@ function themeWindow(window) {
} else if (context.name == torrentpref) {
console.log("Active in Bittorrent window");
if (window.incognito) {
- chrome.theme.update(window.id, {
+ browser.theme.update(window.id, {
colors: {
frame: "#A48FE1",
toolbar: "#A48FE1"
}
});
} else {
- chrome.theme.update(window.id, {
+ browser.theme.update(window.id, {
colors: {
frame: "#A48FE1",
toolbar: "#A48FE1"
@@ -197,7 +213,7 @@ function themeWindow(window) {
}
} else {
console.log("Not active in I2P window");
- chrome.theme.reset(window.id);
+ browser.theme.reset(window.id);
}
}
if (
@@ -206,9 +222,9 @@ function themeWindow(window) {
) {
browser.contextualIdentities
.get(tabInfo[0].cookieStoreId)
- .then(onGot, onError);
+ .then(onContextGotTheme, onError);
} else {
- chrome.theme.reset(window.id);
+ browser.theme.reset(window.id);
}
}
@@ -223,16 +239,16 @@ function setTitle(window) {
function logTabs(tabInfo) {
console.log(tabInfo);
- function onGot(context) {
+ function onContextGotTitle(context) {
if (context.name == titlepref) {
console.log("Active in I2P window");
if (window.incognito) {
- chrome.windows.update(window.id, {
+ browser.windows.update(window.id, {
titlePreface: titleprefpriv
});
} else {
- chrome.windows.update(window.id, {
+ browser.windows.update(window.id, {
titlePreface: titlepref
});
}
@@ -240,22 +256,22 @@ function setTitle(window) {
console.log("Active in Web window");
if (window.incognito) {
- chrome.windows.update(window.id, {
+ browser.windows.update(window.id, {
titlePreface: ""
});
} else {
- chrome.windows.update(window.id, {
+ browser.windows.update(window.id, {
titlePreface: ""
});
}
} else if (context.name == routerpref) {
console.log("Active in Router Console window");
if (window.incognito) {
- chrome.windows.update(window.id, {
+ browser.windows.update(window.id, {
titlePreface: routerprefpriv
});
} else {
- chrome.windows.update(window.id, {
+ browser.windows.update(window.id, {
titlePreface: routerpref
});
}
@@ -263,11 +279,11 @@ function setTitle(window) {
console.log("Active in Hidden Services Manager window");
if (window.incognito) {
- chrome.windows.update(window.id, {
+ browser.windows.update(window.id, {
titlePreface: tunnelprefpriv
});
} else {
- chrome.windows.update(window.id, {
+ browser.windows.update(window.id, {
titlePreface: tunnelpref
});
}
@@ -275,11 +291,11 @@ function setTitle(window) {
console.log("Active in Web Mail window");
if (window.incognito) {
- chrome.windows.update(window.id, {
+ browser.windows.update(window.id, {
titlePreface: mailprefpriv
});
} else {
- chrome.windows.update(window.id, {
+ browser.windows.update(window.id, {
titlePreface: mailpref
});
}
@@ -287,11 +303,11 @@ function setTitle(window) {
console.log("Active in I2P window");
if (window.incognito) {
- chrome.windows.update(window.id, {
+ browser.windows.update(window.id, {
titlePreface: torrentprefpriv
});
} else {
- chrome.windows.update(window.id, {
+ browser.windows.update(window.id, {
titlePreface: torrentpref
});
}
@@ -304,14 +320,14 @@ function setTitle(window) {
) {
browser.contextualIdentities
.get(tabInfo[0].cookieStoreId)
- .then(onGot, onError);
+ .then(onContextGotTitle, onError);
} else {
if (window.incognito) {
- chrome.windows.update(window.id, {
+ browser.windows.update(window.id, {
titlePreface: ""
});
} else {
- chrome.windows.update(window.id, {
+ browser.windows.update(window.id, {
titlePreface: ""
});
}
@@ -325,26 +341,44 @@ function setTitle(window) {
querying.then(logTabs, onError);
}
-chrome.windows.onCreated.addListener(() => {
- /* var gettingStoredSettings = chrome.storage.local.get();
+var gettingInfo = browser.runtime.getPlatformInfo();
+gettingInfo.then(got => {
+ if (got.os == "android") {
+ } else {
+ browser.windows.onCreated.addListener(() => {
+ /* var gettingStoredSettings = chrome.storage.local.get();
gettingStoredSettings.then(setupProxy, onError); */
- chrome.storage.local.get(function(got) {
- setupProxy();
- });
+ chrome.storage.local.get(function(got) {
+ setupProxy();
+ });
+ });
+ }
});
-chrome.tabs.onCreated.addListener(() => {
- var getting = browser.windows.getCurrent({
- populate: true
- });
- getting.then(setTitle, onError);
+var gettingInfo = browser.runtime.getPlatformInfo();
+gettingInfo.then(got => {
+ if (got.os == "android") {
+ } else {
+ browser.tabs.onCreated.addListener(() => {
+ var getting = browser.windows.getCurrent({
+ populate: true
+ });
+ getting.then(setTitle, onError);
+ });
+ }
});
-chrome.tabs.onActivated.addListener(() => {
- var getting = browser.windows.getCurrent({
- populate: true
- });
- getting.then(setTitle, onError);
+var gettingInfo = browser.runtime.getPlatformInfo();
+gettingInfo.then(got => {
+ if (got.os == "android") {
+ } else {
+ browser.tabs.onActivated.addListener(() => {
+ var getting = browser.windows.getCurrent({
+ populate: true
+ });
+ getting.then(setTitle, onError);
+ });
+ }
});
function handleUpdated(updateInfo) {
diff --git a/bookmarks.js b/bookmarks.js
index 491dca6..55a82d0 100644
--- a/bookmarks.js
+++ b/bookmarks.js
@@ -1,153 +1,166 @@
-function bookmarks(bookmarkToolbar) {
- console.log("Setting up bookmark toolbar", bookmarkToolbar);
- function bookHome(bookmarkItems) {
- if (!bookmarkItems.length) {
- function gotProxyInfo(info) {
- let host = info.value.http.split(":")[0];
- let port = info.value.http.split(":")[1];
- if (port == "7644") {
- var createBookmark = browser.bookmarks.create({
- url: "about:I2p",
- title: "I2P Home Page",
- parentId: bookmarkToolbar[0].id
- });
- createBookmark.then(onCreated);
- } else {
- var createBookmark = browser.bookmarks.create({
- url: browser.runtime.getURL("home.html"),
- title: "I2P Home Page",
- parentId: bookmarkToolbar[0].id
- });
- createBookmark.then(onCreated);
- }
- console.log("(bookmarks) adding home page bookmark");
- }
- console.log("(bookmarks) checking if we're running in an I2P Browser");
- var gettingInfo = browser.proxy.settings.get({});
- gettingInfo.then(gotProxyInfo);
- }
- }
- function bookTorrent(bookmarkItems) {
- if (!bookmarkItems.length) {
- function gotProxyInfo(info) {
- let host = info.value.http.split(":")[0];
- let port = info.value.http.split(":")[1];
- if (port == "7644") {
- var createBookmark = browser.bookmarks.create({
- url: "http://localhost:7647/i2psnark",
- title: "Bittorrent",
- parentId: bookmarkToolbar[0].id
- });
- createBookmark.then(onCreated);
- } else {
- var createBookmark = browser.bookmarks.create({
- url: "http://localhost:7657/i2psnark",
- title: "Bittorrent",
- parentId: bookmarkToolbar[0].id
- });
- createBookmark.then(onCreated);
+var gettingInfo = browser.runtime.getPlatformInfo();
+gettingInfo.then(got => {
+ if (got.os != "android") {
+ function bookmarks(bookmarkToolbar) {
+ console.log("Setting up bookmark toolbar", bookmarkToolbar);
+ function bookHome(bookmarkItems) {
+ if (!bookmarkItems.length) {
+ function gotProxyInfo(info) {
+ let host = info.value.http.split(":")[0];
+ let port = info.value.http.split(":")[1];
+ if (port == "7644") {
+ var createBookmark = browser.bookmarks.create({
+ url: "about:I2p",
+ title: "I2P Home Page",
+ parentId: bookmarkToolbar[0].id
+ });
+ createBookmark.then(onCreated);
+ } else {
+ var createBookmark = browser.bookmarks.create({
+ url: browser.runtime.getURL("home.html"),
+ title: "I2P Home Page",
+ parentId: bookmarkToolbar[0].id
+ });
+ createBookmark.then(onCreated);
+ }
+ console.log("(bookmarks) adding home page bookmark");
+ }
+ console.log(
+ "(bookmarks) checking if we're running in an I2P Browser"
+ );
+ var gettingInfo = browser.proxy.settings.get({});
+ gettingInfo.then(gotProxyInfo);
}
}
- console.log("(bookmarks) checking if we're running in an I2P Browser");
- var gettingInfo = browser.proxy.settings.get({});
- gettingInfo.then(gotProxyInfo);
- }
- }
- function bookMail(bookmarkItems) {
- if (!bookmarkItems.length) {
- function gotProxyInfo(info) {
- let host = info.value.http.split(":")[0];
- let port = info.value.http.split(":")[1];
- if (port == "7644") {
- var createBookmark = browser.bookmarks.create({
- url: "http://localhost:7647/webmail",
- title: "Web Mail",
- parentId: bookmarkToolbar[0].id
- });
- createBookmark.then(onCreated);
- } else {
- var createBookmark = browser.bookmarks.create({
- url: "http://localhost:7657/webmail",
- title: "Web Mail",
- parentId: bookmarkToolbar[0].id
- });
- createBookmark.then(onCreated);
+ function bookTorrent(bookmarkItems) {
+ if (!bookmarkItems.length) {
+ function gotProxyInfo(info) {
+ let host = info.value.http.split(":")[0];
+ let port = info.value.http.split(":")[1];
+ if (port == "7644") {
+ var createBookmark = browser.bookmarks.create({
+ url: "http://localhost:7647/i2psnark",
+ title: "Bittorrent",
+ parentId: bookmarkToolbar[0].id
+ });
+ createBookmark.then(onCreated);
+ } else {
+ var createBookmark = browser.bookmarks.create({
+ url: "http://localhost:7657/i2psnark",
+ title: "Bittorrent",
+ parentId: bookmarkToolbar[0].id
+ });
+ createBookmark.then(onCreated);
+ }
+ }
+ console.log(
+ "(bookmarks) checking if we're running in an I2P Browser"
+ );
+ var gettingInfo = browser.proxy.settings.get({});
+ gettingInfo.then(gotProxyInfo);
}
- console.log("(bookmarks) adding webmail bookmark");
}
- console.log("(bookmarks) checking if we're running in an I2P Browser");
- var gettingInfo = browser.proxy.settings.get({});
- gettingInfo.then(gotProxyInfo);
- }
- }
- function bookI2PTunnel(bookmarkItems) {
- if (!bookmarkItems.length) {
- function gotProxyInfo(info) {
- let host = info.value.http.split(":")[0];
- let port = info.value.http.split(":")[1];
- if (port == "7644") {
- var createBookmark = browser.bookmarks.create({
- url: "http://localhost:7647/i2ptunnelmgr",
- title: "Hidden Services Manager",
- parentId: bookmarkToolbar[0].id
- });
- createBookmark.then(onCreated);
- } else {
- var createBookmark = browser.bookmarks.create({
- url: "http://localhost:7657/i2ptunnelmgr",
- title: "Hidden Services Manager",
- parentId: bookmarkToolbar[0].id
- });
- createBookmark.then(onCreated);
+ function bookMail(bookmarkItems) {
+ if (!bookmarkItems.length) {
+ function gotProxyInfo(info) {
+ let host = info.value.http.split(":")[0];
+ let port = info.value.http.split(":")[1];
+ if (port == "7644") {
+ var createBookmark = browser.bookmarks.create({
+ url: "http://localhost:7647/webmail",
+ title: "Web Mail",
+ parentId: bookmarkToolbar[0].id
+ });
+ createBookmark.then(onCreated);
+ } else {
+ var createBookmark = browser.bookmarks.create({
+ url: "http://localhost:7657/webmail",
+ title: "Web Mail",
+ parentId: bookmarkToolbar[0].id
+ });
+ createBookmark.then(onCreated);
+ }
+ console.log("(bookmarks) adding webmail bookmark");
+ }
+ console.log(
+ "(bookmarks) checking if we're running in an I2P Browser"
+ );
+ var gettingInfo = browser.proxy.settings.get({});
+ gettingInfo.then(gotProxyInfo);
}
- console.log("(bookmarks) adding i2ptunnel bookmark");
}
- console.log("(bookmarks) checking if we're running in an I2P Browser");
- var gettingInfo = browser.proxy.settings.get({});
- gettingInfo.then(gotProxyInfo);
+ function bookI2PTunnel(bookmarkItems) {
+ if (!bookmarkItems.length) {
+ function gotProxyInfo(info) {
+ let host = info.value.http.split(":")[0];
+ let port = info.value.http.split(":")[1];
+ if (port == "7644") {
+ var createBookmark = browser.bookmarks.create({
+ url: "http://localhost:7647/i2ptunnelmgr",
+ title: "Hidden Services Manager",
+ parentId: bookmarkToolbar[0].id
+ });
+ createBookmark.then(onCreated);
+ } else {
+ var createBookmark = browser.bookmarks.create({
+ url: "http://localhost:7657/i2ptunnelmgr",
+ title: "Hidden Services Manager",
+ parentId: bookmarkToolbar[0].id
+ });
+ createBookmark.then(onCreated);
+ }
+ console.log("(bookmarks) adding i2ptunnel bookmark");
+ }
+ console.log(
+ "(bookmarks) checking if we're running in an I2P Browser"
+ );
+ var gettingInfo = browser.proxy.settings.get({});
+ gettingInfo.then(gotProxyInfo);
+ }
+ }
+
+ function onRejected(error) {
+ console.log(`An error: ${error}`);
+ }
+ function onCreated(node) {
+ console.log("Bookmarked", node);
+ }
+
+ var b0 = browser.bookmarks.search({
+ title: "I2P Home Page"
+ });
+ b0.then(bookHome, onRejected);
+
+ var b1 = browser.bookmarks.search({
+ title: "Bittorrent"
+ });
+ b1.then(bookTorrent, onRejected);
+
+ var b2 = browser.bookmarks.search({
+ title: "Hidden Services Manager"
+ });
+ b2.then(bookI2PTunnel, onRejected);
+
+ var b3 = browser.bookmarks.search({
+ title: "Web Mail"
+ });
+ b3.then(bookMail, onRejected);
}
+
+ var bt = browser.bookmarks.search({
+ query: "Toolbar"
+ });
+
+ bt.then(bookmarks);
+
+ function handleCreated(id, bookmarkInfo) {
+ var propValue;
+ for (var propName in bookmarkInfo) {
+ propValue = bookmarkInfo[propName];
+ console.log(propName, propValue);
+ }
+ }
+
+ browser.bookmarks.onCreated.addListener(handleCreated);
}
-
- function onRejected(error) {
- console.log(`An error: ${error}`);
- }
- function onCreated(node) {
- console.log("Bookmarked", node);
- }
-
- var b0 = browser.bookmarks.search({
- title: "I2P Home Page"
- });
- b0.then(bookHome, onRejected);
-
- var b1 = browser.bookmarks.search({
- title: "Bittorrent"
- });
- b1.then(bookTorrent, onRejected);
-
- var b2 = browser.bookmarks.search({
- title: "Hidden Services Manager"
- });
- b2.then(bookI2PTunnel, onRejected);
-
- var b3 = browser.bookmarks.search({
- title: "Web Mail"
- });
- b3.then(bookMail, onRejected);
-}
-
-var bt = browser.bookmarks.search({
- query: "Toolbar"
});
-
-bt.then(bookmarks);
-
-function handleCreated(id, bookmarkInfo) {
- var propValue;
- for (var propName in bookmarkInfo) {
- propValue = bookmarkInfo[propName];
- console.log(propName, propValue);
- }
-}
-
-browser.bookmarks.onCreated.addListener(handleCreated);
diff --git a/context.js b/context.js
index ad4a8b0..b1712dc 100644
--- a/context.js
+++ b/context.js
@@ -1,19 +1,19 @@
//var windowIds = []
-
-function onCreated(windowInfo) {
- console.log(`Created window: ${windowInfo.id}`);
- browser.tabs.create({
- windowId: windowInfo.id,
- url: "about:blank",
- cookieStoreId: event.target.dataset.identity
- });
-}
+var titlepref = chrome.i18n.getMessage("titlePreface");
function onError(error) {
console.log(`Error: ${error}`);
}
function eventHandler(event) {
+ function onCreated(windowInfo) {
+ console.log(`Created window: ${windowInfo.id}`);
+ browser.tabs.create({
+ windowId: windowInfo.id,
+ url: "about:blank",
+ cookieStoreId: event.target.dataset.identity
+ });
+ }
if (event.target.dataset.action == "create") {
var creating = browser.tabs.create({
cookieStoreId: event.target.dataset.identity
@@ -52,7 +52,7 @@ if (browser.contextualIdentities === undefined) {
} else {
browser.contextualIdentities
.query({
- name: "I2P Browser"
+ name: titlepref
})
.then(identities => {
if (!identities.length) {
diff --git a/debian/changelog b/debian/changelog
index 11b6f36..b2e9217 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+i2psetproxy.js (0.49-1) UNRELEASED; urgency=low
+
+ * fix tabs
+
+ -- idk I2P Browser allows you to surf the internet using the private and secure I2P network. When using it, you are protected against tracking, surveillance, and censorship as a first-class participant in the I2P network. I2P Browser isolates cookies and deletes your browser history after your session. These modifications ensure your privacy and security are protected in the browser. We also provide you with additional settings for bumping up your browser security. Our Security Settings allow you to block elements that could be used to attack your computer. Click below to see what the different options do. Note: By default, NoScript and HTTPS Everywhere are not included on the toolbar, but you can customize your toolbar to add them. With all the security and privacy features provided by I2P, your experience while browsing the internet may be a little different. Things may be a bit slower, and depending on your security level, some elements may not work or load. You may also be asked to prove you are a human and not a robot. I2P is capable of using peer-to-peer applications like BitTorrent, protecting your identity when you share files. Our anonymous bittorrent client is available in the browser. There is also an anonymous e-mail service available inside of I2P, which is accessible from our browser via the menu directly below. With all the security and privacy features provided by I2P, your experience while browsing the internet may be a little different. Things may be a bit slower, and depending on your security level, some elements may not work or load. You may also be asked to prove you are a human and not a robot. These applications use I2P to provide them with security and privacy.New to I2P? Learn more here.
-
+
Applications
-
+
If you want to get more information about I2P, you can visit these links.
diff --git a/home.js b/home.js
index 5d1e8fb..d77c141 100644
--- a/home.js
+++ b/home.js
@@ -1,3 +1,19 @@
+document.addEventListener("click", e => {
+ if (e.target.id === "onboardingButtonZero") {
+ flipVisibility("onboardingContentZero");
+ } else if (e.target.id === "onboardingButtonOne") {
+ flipVisibility("onboardingContentOne");
+ } else if (e.target.id === "onboardingButtonTwo") {
+ flipVisibility("onboardingContentTwo");
+ } else if (e.target.id === "onboardingButtonThree") {
+ flipVisibility("onboardingContentThree");
+ } else if (e.target.id === "onboardingButtonFour") {
+ flipVisibility("onboardingContentFour");
+ } else if (e.target.id === "fliplinks") {
+ flipVisibility("info-content");
+ }
+});
+
function flipVisibility(div) {
var x = document.getElementById(div);
if (x.style.display === "none") {
diff --git a/host.js b/host.js
index b2f7318..6a1ca9d 100644
--- a/host.js
+++ b/host.js
@@ -28,6 +28,12 @@ function localHost(url) {
return false;
}
+function extensionHost(url) {
+ var res = url.startsWith(browser.runtime.getURL(""));
+ console.log("Extension URL?", res, url, browser.runtime.getURL(""));
+ return res;
+}
+
function i2pHostName(url) {
let hostname = "";
if (url.indexOf("://") > -1) {
diff --git a/info.js b/info.js
index 6f54122..86eed14 100644
--- a/info.js
+++ b/info.js
@@ -1,8 +1,26 @@
-document.addEventListener("click", e => {
- function getCurrentWindow() {
- return chrome.windows.getCurrent();
- }
+function checkPeerConnection() {
+ var getting = browser.privacy.network.peerConnectionEnabled.get({});
+ getting.then(got => {
+ webrtc = got.value;
+ console.log("checking webrtc", webrtc);
+ document.getElementById("enable-web-rtc").checked = webrtc;
+ });
+}
+checkPeerConnection();
+
+function checkHistory() {
+ var getting = browser.storage.local.get("disable_history");
+ getting.then(got => {
+ disable_history = got.disable_history;
+ console.log("checking history", disable_history);
+ document.getElementById("disable-history").checked = disable_history;
+ });
+}
+
+checkHistory();
+
+document.addEventListener("click", e => {
if (e.target.id === "window-create-help-panel") {
let createData = {
type: "panel",
@@ -34,12 +52,6 @@ document.addEventListener("click", e => {
}
RefreshIdentity();
} else if (e.target.id === "window-preface-title") {
- getCurrentWindow().then(currentWindow => {
- let updateInfo = {
- titlePreface: "I2P Help | "
- };
- chrome.windows.update(currentWindow.id, updateInfo);
- });
} else if (e.target.id === "window-visit-homepage") {
console.log("attempting to create homepage tab");
goHome();
@@ -62,6 +74,15 @@ document.addEventListener("click", e => {
} else {
browser.runtime.sendMessage({ rtc: "disableWebRTC" });
}
+ //checkPeerConnection()
+ return;
+ } else if (e.target.id === "disable-history") {
+ if (e.target.checked) {
+ browser.runtime.sendMessage({ history: "disableHistory" });
+ } else {
+ browser.runtime.sendMessage({ history: "enableHistory" });
+ }
+ //checkHistory()
return;
}
@@ -72,6 +93,8 @@ function proxyReadiness() {
console.log(this.responseText);
}
+browser.history.onVisited.addListener(onVisited);
+
function goHome() {
function gotProxyInfo(info) {
let host = info.value.http.split(":")[0];
@@ -119,44 +142,26 @@ function goSnark() {
console.log("visiting homepage");
let creating = browser.tabs.create(createData);
}
-/*
-//document.addEventListener("onpageshow", e => {
-console.log("(Check) Checking Proxy Readiness");
-const Http = new XMLHttpRequest();
-Http.addEventListener("load", proxyReadiness);
-const url = "http://proxy.i2p"; ///themes/console/images/favicon.ico";
-Http.open("GET", url);
-Http.send();
-//});
-function transferComplete(evt) {
- console.log(
- "The transfer is complete.",
- this.status,
- this.statusText,
- this.responseText
- );
+function onVisited(historyItem) {
+ function onCleaned(results) {
+ if (!results.length) {
+ console.log(" was removed");
+ } else {
+ console.log(" was not removed");
+ }
+ }
+
+ function onRemoved() {
+ var searching = browser.history.search({
+ text: historyItem.url,
+ startTime: 0
+ });
+ searching.then(onCleaned);
+ }
+ if (!history) {
+ if (i2pHost(historyItem.url))
+ var deletingUrl = browser.history.deleteUrl(historyItem.url);
+ deletingUrl.then(onRemoved);
+ }
}
-
-function transferFailed(evt) {
- console.log(
- "An error occurred while transferring the file.",
- this.status,
- this.statusText,
- this.responseText
- );
-}
-
-function transferCanceled(evt) {
- console.log(
- "The transfer has been canceled by the user.",
- this.status,
- this.statusText,
- this.responseText
- );
-}
-
-Http.addEventListener("load", transferComplete);
-Http.addEventListener("error", transferFailed);
-Http.addEventListener("abort", transferCanceled);
-*/
diff --git a/manifest.json b/manifest.json
index 6341866..973556c 100644
--- a/manifest.json
+++ b/manifest.json
@@ -24,7 +24,7 @@
],
"manifest_version": 2,
"name": "__MSG_extensionName__",
- "version": "0.46",
+ "version": "0.48",
"description": "__MSG_extensionDescription__",
"homepage_url": "https://github.com/eyedeekay/i2psetproxy.js",
"icons": {
diff --git a/options/options.js b/options/options.js
index 55ac6a8..21b8ad5 100644
--- a/options/options.js
+++ b/options/options.js
@@ -1,14 +1,3 @@
-function isDroid() {
- var gettingInfo = browser.runtime.getPlatformInfo();
- gettingInfo.then(got => {
- if (got.os == "android") {
- return true;
- } else {
- return false;
- }
- });
-}
-
function SetHostText() {
var hostid = document.getElementById("hostText");
hostid.textContent = chrome.i18n.getMessage("hostText");
@@ -24,174 +13,6 @@ function SetControlHostText() {
controlhostid.textContent = chrome.i18n.getMessage("controlHostText");
}
-var handleContextProxyRequest = async function(requestDetails) {
- console.log("(proxy)Searching for proxy by context");
- try {
- var handleProxyRequest = function(context) {
- proxy = {
- failoverTimeout: 0,
- proxyDns: false
- };
- if (context != undefined) {
- if (context.name == "i2pbrowser") {
- proxy = {
- type: getScheme(),
- host: getHost(),
- port: getPort()
- };
- console.log(
- "(proxy)",
- context.name,
- "Using",
- proxy.type,
- "proxy ",
- proxy.host + ":" + proxy.port
- );
- return proxy;
- } else if (context.name == "routerconsole") {
- if (routerHost(requestDetails.url)) {
- return proxy;
- } else if (!routerHost(requestDetails.url)) {
- proxy = {
- type: "http",
- host: "localhost",
- port: "65535"
- };
- }
- proxy = {
- type: getScheme(),
- host: getHost(),
- port: getPort()
- };
- console.log(
- "(proxy)",
- context.name,
- "Using",
- proxy.type,
- "proxy ",
- proxy.host + ":" + proxy.port
- );
- return proxy;
- } else if (context.name == "fenced-default") {
- if (localHost(requestDetails.url)) {
- if (!routerHost(requestDetails.url)) {
- proxy = {
- type: "http",
- host: "localhost",
- port: "65535"
- };
- }
- }
- console.log(
- "(proxy)",
- context.name,
- "Using",
- proxy.type,
- "proxy ",
- proxy.host + ":" + proxy.port
- );
- return proxy;
- }
- }
- if (!routerHost(requestDetails.url)) {
- proxy = {
- type: "http",
- host: "localhost",
- port: "65535"
- };
- } else if (i2pHost(requestDetails.url)) {
- proxy = {
- type: getScheme(),
- host: getHost(),
- port: getPort()
- };
- }
- return proxy;
- };
- var contextGet = async function(tabInfo) {
- try {
- console.log("(proxy)Tab info from Function", tabInfo);
- context = await browser.contextualIdentities.get(tabInfo.cookieStoreId);
- return context;
- } catch (error) {
- console.log("(proxy)Context Error", error);
- }
- };
- var tabFind = async function(tabId) {
- try {
- context = await browser.contextualIdentities.query({
- name: "i2pbrowser"
- });
- tabId.cookieStoreId = context[0].cookieStoreId;
- console.log("(proxy) forcing context", tabId.cookieStoreId);
- return tabId;
- } catch (error) {
- console.log("(proxy)Context Error", error);
- }
- };
- var tabGet = async function(tabId) {
- try {
- console.log("(proxy)Tab ID from Request", tabId);
- let tabInfo = await browser.tabs.get(tabId);
- return tabInfo;
- } catch (error) {
- console.log("(proxy)Tab error", error);
- }
- };
-
- if (requestDetails.tabId > 0) {
- if (proxyHost(requestDetails.url)) {
- console.log("(Proxy)I2P Proxy test URL detected, ", requestDetails.url);
- return {
- type: getScheme(),
- host: getHost(),
- port: getPort()
- };
- } else if (i2pHost(requestDetails.url)) {
- console.log("(Proxy)I2P URL detected, ");
- var tab = tabGet(requestDetails.tabId);
- var mtab = tab.then(tabFind);
- requestDetails.tabId = mtab;
- var context = mtab.then(contextGet);
- var proxy = await context.then(handleProxyRequest);
- console.log("(proxy)Returning I2P Proxy", proxy);
- return proxy;
- } else {
- var tab = tabGet(requestDetails.tabId);
- var context = tab.then(contextGet);
- var proxy = await context.then(handleProxyRequest);
- console.log("(proxy)Returning I2P Proxy", proxy);
- return proxy;
- }
- proxy = {
- type: getScheme(),
- host: getHost(),
- port: getPort()
- };
- console.log("(proxy)Returning I2P Proxy", proxy);
- return proxy;
- }
- } catch (error) {
- console.log("(proxy)Not using I2P Proxy.", error);
- }
-};
-
-function setupProxy() {
- var controlHost = getControlHost();
- var controlPort = getControlPort();
- var Host = getHost();
- var Port = getPort();
- var Scheme = getScheme();
-
- /**/
- console.log("Setting up Firefox WebExtension proxy");
- browser.proxy.onRequest.addListener(handleContextProxyRequest, {
- urls: [" These applications use I2P to provide them with security and privacy.Applications
-