releasey goodness

This commit is contained in:
idk
2019-10-08 19:10:13 -04:00
parent 14b246fc00
commit c4a2fa6ec0
3 changed files with 106 additions and 51 deletions

View File

@@ -31,12 +31,16 @@ ls:
clean:
rm -f ../i2psetproxy.js.zip ../i2p_proxy*.xpi
VERSION=0.31
## EVEN RELEASES are AMO RELEASES
## ODD RELEASES are SELFHOSTED RELEASES
MOZ_VERSION=0.30
VERSION=0.30
#VERSION=1.27
xpi:
wget -O i2ppb@eyedeekay.github.io.xpi \
https://addons.mozilla.org/firefox/downloads/file/3420119/i2p_in_private_browsing-$(VERSION)-an+fx.xpi
wget -O ../i2ppb@eyedeekay.github.io.xpi \
https://addons.mozilla.org/firefox/downloads/file/3419789/i2psetproxyjs-$(MOZ_VERSION)-an+fx.xpi
cp ../i2ppb@eyedeekay.github.io.xpi ./i2ppb@eyedeekay.github.io.xpi
version:
@@ -47,26 +51,18 @@ zip: version
--exclude="./i2psetproxy.js.png" \
--exclude="./.git" -r -FS ../i2psetproxy.js.zip *
define DESC
I2P in Private Browsing Mode
============================
A simple plugin for configuring a Firefox based web browser to isolate I2P
Browsing to a single contextual identity, thus creating an I2P in Private
Browsing mode. It requires the use of a pre-installed I2P Router.
endef
export DESC
release:
gothub release -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n $(VERSION) -d $(DESC)
cat desc | gothub release -p -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n $(VERSION) -d -
delete-release:
gothub delete -u eyedeekay -r i2psetproxy.js -t $(VERSION); true
recreate-release: delete-release release upload
upload: upload-xpi upload-deb
upload-xpi:
gothub upload -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2ppb@eyedeekay.github.io.xpi" -f "../i2ppb@eyedeekay.github.io.xpi"
gothub upload -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2ppb@eyedeekay.github.io.xpi" -f "./i2ppb@eyedeekay.github.io.xpi"
upload-deb:
gothub upload -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.deb" -f "../i2psetproxy.js_$(VERSION)-1_amd64.deb"

View File

@@ -55,8 +55,8 @@ var titlepref = chrome.i18n.getMessage("titlePreface");
var titleprefpriv = chrome.i18n.getMessage("titlePrefacePrivate");
function themeWindowByTab(tab) {
getwindow = browser.windows.get(tab.windowId)
getwindow.then(themeWindow)
getwindow = browser.windows.get(tab.windowId);
getwindow.then(themeWindow);
}
function themeWindow(window) {
@@ -82,6 +82,23 @@ function themeWindow(window) {
}
});
}
} else if (context.name == "routerconsole") {
console.log("Active in I2P window");
if (window.incognito) {
chrome.theme.update(window.id, {
colors: {
frame: "#00CED1",
toolbar: "#00CED1"
}
});
} else {
chrome.theme.update(window.id, {
colors: {
frame: "#40E0D0",
toolbar: "#40E0D0"
}
});
}
} else {
console.log("Not active in I2P window");
}
@@ -92,10 +109,10 @@ function themeWindow(window) {
}
if (tabInfo[0].cookieStoreId != "firefox-default") {
browser.contextualIdentities
.get(tabInfo[0].cookieStoreId)
.then(onGot, onError);
}else{
chrome.theme.reset(window.id);
.get(tabInfo[0].cookieStoreId)
.then(onGot, onError);
} else {
chrome.theme.reset(window.id);
}
}

View File

@@ -50,25 +50,7 @@ var contextScrub = async function(requestDetails) {
}
};
if (requestDetails.tabId > 0) {
if (requestDetails.url.endsWith(".i2p")) {
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 req = await context.then(headerScrub);
console.log("(scrub)Scrubbing I2P Request", req);
return req;
} else if (requestDetails.url.endsWith(".b32.i2p")) {
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 req = await context.then(headerScrub);
console.log("(scrub)Scrubbing I2P Request", req);
return req;
} else if (requestDetails.url.includes(".i2p/")) {
if (i2pHost(requestDetails.url)) {
console.log("(Proxy)I2P URL detected, ");
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(tabFind);
@@ -110,7 +92,45 @@ var contextSetup = async function(requestDetails) {
function onCreated(tab) {
console.log("(isolate) Closing old, un-isolated tab");
browser.tabs.remove(tabId.id);
browser.tabs.remove(window.tabs[0].id)
browser.tabs.remove(window.tabs[0].id);
}
function onError(error) {
console.log(`Error: ${error}`);
}
created = browser.tabs.create({
active: true,
cookieStoreId: context[0].cookieStoreId,
url: requestDetails.url,
windowId: window.id
});
created.then(onCreated, onError);
}
getting = browser.windows.create();
getting.then(Create);
return tabId;
}
} catch (error) {
console.log("(isolate)Context Error", error);
}
};
var routerTabFind = async function(tabId) {
try {
context = await browser.contextualIdentities.query({
name: "routerconsole"
});
if (tabId.cookieStoreId != context[0].cookieStoreId) {
console.log(
"(isolate) forcing",
requestDetails.url,
" context",
tabId.cookieStoreId,
context[0].cookieStoreId
);
function Create(window) {
function onCreated(tab) {
console.log("(isolate) Closing old, un-isolated tab");
browser.tabs.remove(tabId.id);
browser.tabs.remove(window.tabs[0].id);
}
function onError(error) {
console.log(`Error: ${error}`);
@@ -141,17 +161,14 @@ var contextSetup = async function(requestDetails) {
}
};
if (requestDetails.tabId > 0) {
if (requestDetails.url.endsWith(".i2p")) {
if (i2pHost(requestDetails.url)) {
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(tabFind);
return requestDetails;
} else if (requestDetails.url.endsWith(".b32.i2p")) {
}
if (routerHost(requestDetails.url)) {
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(tabFind);
return requestDetails;
} else if (requestDetails.url.includes(".i2p/")) {
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(tabFind);
var mtab = tab.then(routerTabFind);
return requestDetails;
}
}
@@ -163,6 +180,31 @@ var contextSetup = async function(requestDetails) {
}
};
function i2pHost(url) {
let hostname = "";
if (url.indexOf("://") > -1) {
hostname = url.split("/")[2];
} else {
hostname = url.split("/")[0];
}
return hostname.endsWith(".i2p");
}
function routerHost(url) {
let hostname = "";
if (url.indexOf("://") > -1) {
hostname = url.split("/")[2];
} else {
hostname = url.split("/")[0];
}
if (hostname === "127.0.0.1:7657") {
return true;
} else if (hostname === "localhost:7657") {
return true;
}
return false;
}
browser.webRequest.onBeforeRequest.addListener(
contextSetup,
{ urls: ["<all_urls>"] },