update usage section

This commit is contained in:
idk
2019-12-24 16:51:38 -05:00
parent ff9ba99476
commit 9e015c51ef
9 changed files with 100 additions and 98 deletions

View File

@@ -19,58 +19,58 @@ function onContextsGot(contexts) {
}
console.log("Checking new contexts");
if (ids.indexOf(titlepref) == -1) {
browser.contextualIdentities.
create({
browser.contextualIdentities
.create({
name: titlepref,
color: "orange",
icon: "fingerprint"
}).
then(onCreated, onError);
})
.then(onCreated, onError);
}
if (ids.indexOf(webpref) == -1) {
browser.contextualIdentities.
create({
browser.contextualIdentities
.create({
name: webpref,
color: "red",
icon: "circle"
}).
then(onCreated, onError);
})
.then(onCreated, onError);
}
if (ids.indexOf(routerpref) == -1) {
browser.contextualIdentities.
create({
browser.contextualIdentities
.create({
name: routerpref,
color: "blue",
icon: "briefcase"
}).
then(onCreated, onError);
})
.then(onCreated, onError);
}
if (ids.indexOf(tunnelpref) == -1) {
browser.contextualIdentities.
create({
browser.contextualIdentities
.create({
name: tunnelpref,
color: "green",
icon: "tree"
}).
then(onCreated, onError);
})
.then(onCreated, onError);
}
if (ids.indexOf(mailpref) == -1) {
browser.contextualIdentities.
create({
browser.contextualIdentities
.create({
name: mailpref,
color: "yellow",
icon: "briefcase"
}).
then(onCreated, onError);
})
.then(onCreated, onError);
}
if (ids.indexOf(torrentpref) == -1) {
browser.contextualIdentities.
create({
browser.contextualIdentities
.create({
name: torrentpref,
color: "purple",
icon: "chill"
}).
then(onCreated, onError);
})
.then(onCreated, onError);
}
}
@@ -211,9 +211,9 @@ function themeWindow(window) {
tabInfo[0].cookieStoreId != "firefox-default" &&
tabInfo[0].cookieStoreId != "firefox-private"
) {
browser.contextualIdentities.
get(tabInfo[0].cookieStoreId).
then(onContextGotTheme, onError);
browser.contextualIdentities
.get(tabInfo[0].cookieStoreId)
.then(onContextGotTheme, onError);
} else {
browser.theme.reset(window.id);
}
@@ -308,18 +308,18 @@ function setTitle(window) {
tabInfo[0].cookieStoreId != "firefox-default" &&
tabInfo[0].cookieStoreId != "firefox-private"
) {
browser.contextualIdentities.
get(tabInfo[0].cookieStoreId).
then(onContextGotTitle, onError);
browser.contextualIdentities
.get(tabInfo[0].cookieStoreId)
.then(onContextGotTitle, onError);
} else if (window.incognito) {
browser.windows.update(window.id, {
titlePreface: ""
});
} else {
browser.windows.update(window.id, {
titlePreface: ""
});
}
browser.windows.update(window.id, {
titlePreface: ""
});
} else {
browser.windows.update(window.id, {
titlePreface: ""
});
}
}
var querying = browser.tabs.query({

View File

@@ -25,7 +25,9 @@ gettingInfo.then(got => {
}
console.log("(bookmarks) adding home page bookmark");
}
console.log("(bookmarks) checking if we're running in an I2P Browser");
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
var gettingInfo = browser.proxy.settings.get({});
gettingInfo.then(gotProxyInfo);
}
@@ -52,7 +54,9 @@ gettingInfo.then(got => {
createBookmark.then(onCreated);
}
}
console.log("(bookmarks) checking if we're running in an I2P Browser");
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
var gettingInfo = browser.proxy.settings.get({});
gettingInfo.then(gotProxyInfo);
}
@@ -79,7 +83,9 @@ gettingInfo.then(got => {
}
console.log("(bookmarks) adding webmail bookmark");
}
console.log("(bookmarks) checking if we're running in an I2P Browser");
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
var gettingInfo = browser.proxy.settings.get({});
gettingInfo.then(gotProxyInfo);
}
@@ -111,7 +117,9 @@ gettingInfo.then(got => {
}
console.log("(bookmarks) adding i2ptunnel bookmark");
}
console.log("(bookmarks) checking if we're running in an I2P Browser");
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
var gettingInfo = browser.proxy.settings.get({});
gettingInfo.then(gotProxyInfo);
}

View File

@@ -21,11 +21,11 @@ function eventHandler(event) {
creating.then(onCreated, onError);
}
if (event.target.dataset.action == "close-all") {
browser.tabs.
query({
browser.tabs
.query({
cookieStoreId: event.target.dataset.identity
}).
then(tabs => {
})
.then(tabs => {
browser.tabs.remove(tabs.map(i => i.id));
});
}
@@ -33,10 +33,7 @@ function eventHandler(event) {
}
function createOptions(node, identity) {
for (let option of [
"Create",
"Close All"
]) {
for (let option of ["Create", "Close All"]) {
let a = document.createElement("a");
a.href = "#";
a.innerText = option;
@@ -53,11 +50,11 @@ if (browser.contextualIdentities === undefined) {
div.innerText =
"browser.contextualIdentities not available. Check that the privacy.userContext.enabled pref is set to true, and reload the add-on.";
} else {
browser.contextualIdentities.
query({
browser.contextualIdentities
.query({
name: titlepref
}).
then(identities => {
})
.then(identities => {
if (!identities.length) {
div.innerText = "No identities returned from the API.";
return;

View File

@@ -40,6 +40,6 @@ var handlerSetup = async function(requestDetails) {
browser.webRequest.onBeforeRequest.addListener(
handlerSetup,
{urls: ["<all_urls>"]},
{ urls: ["<all_urls>"] },
["blocking"]
);

View File

@@ -276,7 +276,7 @@ li {
opacity: 1
}
img {
max-width: 100%;
max-width: 100%
}
img.readyness {
height: 100%;

16
info.js
View File

@@ -14,8 +14,8 @@ function checkHistory() {
getting.then(got => {
disable_history = got.disable_history;
if (disable_history == undefined) {
disable_history = false;
}
disable_history = false;
}
console.log("checking history", disable_history);
document.getElementById("disable-history").checked = disable_history;
});
@@ -73,17 +73,17 @@ document.addEventListener("click", e => {
echo("I2P Router Detected", "panel-section-i2pcontrol-check");
} else if (e.target.id === "enable-web-rtc") {
if (e.target.checked) {
browser.runtime.sendMessage({rtc: "enableWebRTC"});
browser.runtime.sendMessage({ rtc: "enableWebRTC" });
} else {
browser.runtime.sendMessage({rtc: "disableWebRTC"});
browser.runtime.sendMessage({ rtc: "disableWebRTC" });
}
//checkPeerConnection()
return;
} else if (e.target.id === "disable-history") {
if (e.target.checked) {
browser.runtime.sendMessage({history: "disableHistory"});
browser.runtime.sendMessage({ history: "disableHistory" });
} else {
browser.runtime.sendMessage({history: "enableHistory"});
browser.runtime.sendMessage({ history: "enableHistory" });
}
//checkHistory()
return;
@@ -169,8 +169,8 @@ function onVisited(historyItem) {
}
if (!history) {
if (i2pHost(historyItem.url)) {
var deletingUrl = browser.history.deleteUrl(historyItem.url);
}
var deletingUrl = browser.history.deleteUrl(historyItem.url);
}
deletingUrl.then(onRemoved);
}
}

View File

@@ -208,13 +208,7 @@ function EnableSavePasswords() {
var defaultSettings = {
since: "forever",
dataTypes: [
"downloads",
"passwords",
"formData",
"localStorage",
"history"
]
dataTypes: ["downloads", "passwords", "formData", "localStorage", "history"]
};
var appSettings = {
@@ -274,33 +268,33 @@ function forgetBrowsingData(storedSettings) {
});
browser.browsingData.removeCache({});
console.log("cleared Cache");
browser.browsingData.
removePasswords({
browser.browsingData
.removePasswords({
hostnames: [i2pHostName(item.url)],
since
}).
then(onContextGotLog);
})
.then(onContextGotLog);
console.log("cleared Passwords");
browser.browsingData.
removeDownloads({
browser.browsingData
.removeDownloads({
hostnames: [i2pHostName(item.url)],
since
}).
then(onContextGotLog);
})
.then(onContextGotLog);
console.log("cleared Downloads");
browser.browsingData.
removeFormData({
browser.browsingData
.removeFormData({
hostnames: [i2pHostName(item.url)],
since
}).
then(onContextGotLog);
})
.then(onContextGotLog);
console.log("cleared Form Data");
browser.browsingData.
removeLocalStorage({
browser.browsingData
.removeLocalStorage({
hostnames: [i2pHostName(item.url)],
since
}).
then(onContextGotLog);
})
.then(onContextGotLog);
console.log("cleared Local Storage");
contexts = browser.contextualIdentities.query({

View File

@@ -235,7 +235,9 @@ function SetupSettings() {
console.log("Initialising Control Host", storedSettings.control_host);
setupProxy();
}
var gettingControlHostStoredSettings = browser.storage.local.get("control_host");
var gettingControlHostStoredSettings = browser.storage.local.get(
"control_host"
);
gettingControlHostStoredSettings.then(
checkControlHostStoredSettings,
onError
@@ -252,7 +254,9 @@ function SetupSettings() {
console.log("Initialising Control Port", storedSettings.control_port);
setupProxy();
}
var gettingControlPortStoredSettings = browser.storage.local.get("control_port");
var gettingControlPortStoredSettings = browser.storage.local.get(
"control_port"
);
gettingControlPortStoredSettings.then(
checkControlPortStoredSettings,
onError
@@ -272,7 +276,9 @@ function SetupSettings() {
);
setupProxy();
}
var gettingHistoryStoredSettings = browser.storage.local.get("disable_history");
var gettingHistoryStoredSettings = browser.storage.local.get(
"disable_history"
);
gettingHistoryStoredSettings.then(checkHistoryStoredSettings, onError);
}

View File

@@ -60,8 +60,8 @@ var contextScrub = async function(requestDetails) {
console.log("(scrub)Tab ID from Request", tabId);
let ostype = await browser.runtime.getPlatformInfo();
if (ostype == android) {
tabId += 1;
}
tabId += 1;
}
let tabInfo = await browser.tabs.get(tabId);
return tabInfo;
} catch (error) {
@@ -352,15 +352,12 @@ var contextSetup = async function(requestDetails) {
browser.webRequest.onBeforeRequest.addListener(
contextSetup,
{urls: ["<all_urls>"]},
{ urls: ["<all_urls>"] },
["blocking"]
);
browser.webRequest.onBeforeSendHeaders.addListener(
contextScrub,
{urls: ["<all_urls>"]},
[
"blocking",
"requestHeaders"
]
{ urls: ["<all_urls>"] },
["blocking", "requestHeaders"]
);