apply default URLs on initial isolations
This commit is contained in:
56
Makefile
56
Makefile
@@ -132,13 +132,13 @@ rc:
|
||||
rtest: rc index torrenthelp
|
||||
|
||||
release: rc index torrenthelp
|
||||
cat desc debian/changelog | grep -B 10 "$(LAST_VERSION)" | gothub release -p -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n $(VERSION) -d -; true
|
||||
cat desc debian/changelog | grep -B 10 "$(LAST_VERSION)" | github-release release -p -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n $(VERSION) -d -; true
|
||||
|
||||
update-release:
|
||||
cat desc debian/changelog | grep -B 10 "$(LAST_VERSION)" | gothub edit -p -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n $(VERSION) -d -; true
|
||||
cat desc debian/changelog | grep -B 10 "$(LAST_VERSION)" | github-release edit -p -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n $(VERSION) -d -; true
|
||||
|
||||
delete-release:
|
||||
gothub delete -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION); true
|
||||
github-release delete -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION); true
|
||||
|
||||
recreate-release: delete-release release upload
|
||||
|
||||
@@ -168,7 +168,7 @@ moz-sign: version clean-artifacts
|
||||
@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."
|
||||
$(HOME)/node_modules/.bin/web-ext sign --channel unlisted --config-discovery false --api-key $(WEB_EXT_API_KEY) --api-secret $(WEB_EXT_API_SECRET) --timeout 900000 #--api-url-prefix http://localhost:3000/api/v4
|
||||
$(PWD)/node_modules/.bin/web-ext sign --channel unlisted --config-discovery false --api-key $(WEB_EXT_API_KEY) --api-secret $(WEB_EXT_API_SECRET) --timeout 900000 #--api-url-prefix http://localhost:3000/api/v4
|
||||
make copyss
|
||||
sleep 5
|
||||
|
||||
@@ -182,7 +182,7 @@ moz-submit: moz-version
|
||||
@echo "to the Makefile under the variables WEB_EXT_API_KEY and WEB_EXT_API_SECRET."
|
||||
mv manifest.json .manifest.json
|
||||
grep -v update_url .manifest.json > manifest.json
|
||||
$(HOME)/node_modules/.bin/web-ext sign --channel listed --config-discovery false --api-key $(WEB_EXT_API_KEY) --api-secret $(WEB_EXT_API_SECRET) --timeout 900000 --verbose; true #--api-url-prefix http://localhost:3000/api/v4
|
||||
$(PWD)/node_modules/.bin/web-ext sign --channel listed --config-discovery false --api-key $(WEB_EXT_API_KEY) --api-secret $(WEB_EXT_API_SECRET) --timeout 900000 --verbose; true #--api-url-prefix http://localhost:3000/api/v4
|
||||
sleep 5
|
||||
mv .manifest.json manifest.json
|
||||
|
||||
@@ -191,11 +191,11 @@ rhz-submit: rhz-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."
|
||||
#$HOME/node_modules/web-ext-submit/extender.sh --channel unlisted --config-discovery false --api-key $(WEB_EXT_API_KEY) --api-secret $(WEB_EXT_API_SECRET); true
|
||||
#$PWD/node_modules/web-ext-submit/extender.sh --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
|
||||
|
||||
getxpi:
|
||||
gothub download -t $(VERSION) -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -n i2ppb@eyedeekay.github.io.xpi
|
||||
github-release download -t $(VERSION) -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -n i2ppb@eyedeekay.github.io.xpi
|
||||
mv ./i2ppb@eyedeekay.github.io.xpi ../i2ppb-$(VERSION)@eyedeekay.github.io.xpi
|
||||
cp ../i2ppb-$(VERSION)@eyedeekay.github.io.xpi ../i2ppb@eyedeekay.github.io.xpi
|
||||
|
||||
@@ -243,23 +243,23 @@ torrent: getxpi
|
||||
make index
|
||||
|
||||
upload-torrent:
|
||||
gothub upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2ppb@eyedeekay.github.io.xpi.torrent" -f "./i2ppb-$(VERSION)@eyedeekay.github.io.xpi.torrent"
|
||||
github-release upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2ppb@eyedeekay.github.io.xpi.torrent" -f "./i2ppb-$(VERSION)@eyedeekay.github.io.xpi.torrent"
|
||||
|
||||
upload-xpi:
|
||||
gothub upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2ppb@eyedeekay.github.io.xpi" -f "../i2ppb@eyedeekay.github.io.xpi"
|
||||
github-release upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2ppb@eyedeekay.github.io.xpi" -f "../i2ppb@eyedeekay.github.io.xpi"
|
||||
|
||||
upload-deb:
|
||||
gothub upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.deb" -f "../i2psetproxy.js_$(VERSION)-1_amd64.deb"
|
||||
gothub upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psetproxy.js_$(VERSION).orig.tar.gz" -f "../i2psetproxy.js_$(VERSION).orig.tar.gz"
|
||||
gothub upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1.debian.tar.xz" -f "../i2psetproxy.js_$(VERSION)-1.debian.tar.xz"
|
||||
gothub upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1.dsc" -f "../i2psetproxy.js_$(VERSION)-1.dsc"
|
||||
gothub upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.changes" -f "../i2psetproxy.js_$(VERSION)-1_amd64.changes"
|
||||
gothub upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.buildinfo" -f "../i2psetproxy.js_$(VERSION)-1_amd64.buildinfo"
|
||||
github-release upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.deb" -f "../i2psetproxy.js_$(VERSION)-1_amd64.deb"
|
||||
github-release upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psetproxy.js_$(VERSION).orig.tar.gz" -f "../i2psetproxy.js_$(VERSION).orig.tar.gz"
|
||||
github-release upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1.debian.tar.xz" -f "../i2psetproxy.js_$(VERSION)-1.debian.tar.xz"
|
||||
github-release upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1.dsc" -f "../i2psetproxy.js_$(VERSION)-1.dsc"
|
||||
github-release upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.changes" -f "../i2psetproxy.js_$(VERSION)-1_amd64.changes"
|
||||
github-release upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.buildinfo" -f "../i2psetproxy.js_$(VERSION)-1_amd64.buildinfo"
|
||||
|
||||
upload-docs:
|
||||
gothub release -p -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t docs -n "Documentation" -d "PDF's and text about the extension"; true
|
||||
gothub upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t docs -n "Landing Page Documentation.pdf" -f ../smartlander.pdf
|
||||
gothub upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t docs -n "Browser Design Documentation.pdf" -f ../browser.pdf
|
||||
github-release release -p -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t docs -n "Documentation" -d "PDF's and text about the extension"; true
|
||||
github-release upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t docs -n "Landing Page Documentation.pdf" -f ../smartlander.pdf
|
||||
github-release upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t docs -n "Browser Design Documentation.pdf" -f ../browser.pdf
|
||||
|
||||
fmt: fmt-css fmt-html fmt-js
|
||||
|
||||
@@ -289,10 +289,10 @@ fmt-js:
|
||||
#find . -path ./node_modules -prune -o -name '*.json' -exec fixjsstyle --write {} \;
|
||||
|
||||
fmt-locales:
|
||||
find _locales -name '*.js*' -exec $(HOME)/node_modules/.bin/prettier -w {} \;
|
||||
find _locales -name '*.js*' -exec $(PWD)/node_modules/.bin/prettier -w {} \;
|
||||
|
||||
fmt-prettier:
|
||||
find . -name '*.js*' -exec $(HOME)/node_modules/.bin/prettier -w {} \;
|
||||
find . -name '*.js*' -exec $(PWD)/node_modules/.bin/prettier -w {} \;
|
||||
|
||||
lint:
|
||||
|
||||
@@ -327,27 +327,27 @@ rss: torrent
|
||||
sed -i "s|<title>$(VERSION)</title>|<title>$(VERSION)</title>\n <enclosure url=\"$(MAGNET)\" type=\"application/x-bittorrent\" />|g" releases.atom
|
||||
|
||||
upload-rss: rss
|
||||
gothub upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t docs -n "releases.atom" -f releases.atom
|
||||
github-release upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t docs -n "releases.atom" -f releases.atom
|
||||
|
||||
upload-updatemanifest:
|
||||
gothub upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t docs -n "updateManifest.json" -f updateManifest.json
|
||||
github-release upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t docs -n "updateManifest.json" -f updateManifest.json
|
||||
|
||||
webext:
|
||||
mkdir -p profile
|
||||
$(HOME)/node_modules/.bin/web-ext run --firefox /usr/bin/firefox --firefox-profile ./profile -u "about:devtools-toolbox?type=extension&id=i2ppb%40eyedeekay.github.io"
|
||||
$(PWD)/node_modules/.bin/web-ext run --firefox /usr/bin/firefox --firefox-profile ./profile -u "about:devtools-toolbox?type=extension&id=i2ppb%40eyedeekay.github.io"
|
||||
|
||||
snark-mirror:
|
||||
http_proxy=http://127.0.0.1:4444 wget -c -O ../i2psnark-rpc.su3 http://stats.i2p/i2p/plugins/i2psnark-rpc.su3
|
||||
gothub upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psnark-rpc.su3" -f ../i2psnark-rpc.su3
|
||||
github-release upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psnark-rpc.su3" -f ../i2psnark-rpc.su3
|
||||
http_proxy=http://127.0.0.1:4444 wget -c -O ../i2psnark-rpc-update.su3 http://stats.i2p/i2p/plugins/i2psnark-rpc-update.su3
|
||||
gothub upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psnark-rpc-update.su3" -f ../i2psnark-rpc-update.su3
|
||||
github-release upload -R -u eyedeekay -r I2P-in-Private-Browsing-Mode-Firefox -t $(VERSION) -n "i2psnark-rpc-update.su3" -f ../i2psnark-rpc-update.su3
|
||||
|
||||
seed:
|
||||
cp -v "./i2ppb-$(VERSION)@eyedeekay.github.io.xpi.torrent" "$(HOME)/.i2p/i2psnark"
|
||||
cp -v "../i2ppb-$(VERSION)@eyedeekay.github.io.xpi" "$(HOME)/.i2p/i2psnark"
|
||||
cp -v "./i2ppb-$(VERSION)@eyedeekay.github.io.xpi.torrent" "$(PWD)/.i2p/i2psnark"
|
||||
cp -v "../i2ppb-$(VERSION)@eyedeekay.github.io.xpi" "$(PWD)/.i2p/i2psnark"
|
||||
|
||||
android:
|
||||
$(HOME)/node_modules/.bin/web-ext run \
|
||||
$(PWD)/node_modules/.bin/web-ext run \
|
||||
--target firefox-android \
|
||||
--android-device HT78N1A00453 \
|
||||
--firefox-apk org.mozilla.fenix
|
||||
|
113
background.js
113
background.js
@@ -37,43 +37,21 @@ function logContexts(contexts) {
|
||||
|
||||
function onContextsGot(contexts) {
|
||||
const prefList = [
|
||||
{ name: titlepref,
|
||||
color: "orange",
|
||||
icon: "fingerprint" },
|
||||
{ name: blogpref,
|
||||
color: "pink",
|
||||
icon: "pet" },
|
||||
{ name: webpref,
|
||||
color: "red",
|
||||
icon: "circle" },
|
||||
{ name: routerpref,
|
||||
color: "blue",
|
||||
icon: "briefcase" },
|
||||
{ name: tunnelpref,
|
||||
color: "green",
|
||||
icon: "tree" },
|
||||
{ name: mailpref,
|
||||
color: "yellow",
|
||||
icon: "briefcase" },
|
||||
{ name: torrentpref,
|
||||
color: "purple",
|
||||
icon: "chill" },
|
||||
{ name: ircpref,
|
||||
color: "red",
|
||||
icon: "vacation" },
|
||||
{ name: torpref,
|
||||
color: "purple",
|
||||
icon: "circle" },
|
||||
{ name: muwirepref,
|
||||
color: "turquoise",
|
||||
icon: "gift" },
|
||||
{ name: botepref,
|
||||
color: "blue",
|
||||
icon: "fence" }
|
||||
{ name: titlepref, color: "orange", icon: "fingerprint" },
|
||||
{ name: blogpref, color: "pink", icon: "pet" },
|
||||
{ name: webpref, color: "red", icon: "circle" },
|
||||
{ name: routerpref, color: "blue", icon: "briefcase" },
|
||||
{ name: tunnelpref, color: "green", icon: "tree" },
|
||||
{ name: mailpref, color: "yellow", icon: "briefcase" },
|
||||
{ name: torrentpref, color: "purple", icon: "chill" },
|
||||
{ name: ircpref, color: "red", icon: "vacation" },
|
||||
{ name: torpref, color: "purple", icon: "circle" },
|
||||
{ name: muwirepref, color: "turquoise", icon: "gift" },
|
||||
{ name: botepref, color: "blue", icon: "fence" },
|
||||
];
|
||||
const ids = contexts.map(context => context.name);
|
||||
const ids = contexts.map((context) => context.name);
|
||||
console.log("Checking new contexts");
|
||||
prefList.forEach(pref => {
|
||||
prefList.forEach((pref) => {
|
||||
if (ids.indexOf(pref.name) === -1) {
|
||||
browser.contextualIdentities.create(pref).then(onCreated, onNotCreated);
|
||||
}
|
||||
@@ -95,7 +73,7 @@ function onNotCreated(context) {
|
||||
browser.contextualIdentities.query({}).then(onContextsGot, onContextsError);
|
||||
|
||||
var gettingInfo = browser.runtime.getPlatformInfo();
|
||||
gettingInfo.then(got => {
|
||||
gettingInfo.then((got) => {
|
||||
if (got.os != "android") {
|
||||
browser.windows.onCreated.addListener(themeWindow);
|
||||
browser.windows.onFocusChanged.addListener(themeWindow);
|
||||
@@ -190,7 +168,7 @@ function themeWindow(window) {
|
||||
|
||||
var querying = browser.tabs.query({
|
||||
currentWindow: true,
|
||||
active: true
|
||||
active: true,
|
||||
});
|
||||
querying.then(logTabs, onThemeError);
|
||||
}
|
||||
@@ -202,9 +180,7 @@ function queryTitle(window) {
|
||||
}
|
||||
|
||||
function setTitle(title, privTitle) {
|
||||
const titlePreface = window.incognito
|
||||
? privTitle
|
||||
: title;
|
||||
const titlePreface = window.incognito ? privTitle : title;
|
||||
browser.windows.update(window.id, { titlePreface });
|
||||
}
|
||||
|
||||
@@ -219,7 +195,7 @@ function queryTitle(window) {
|
||||
blogpref: "Active in I2P Blog window",
|
||||
torrentpref: "Active in I2P Torrent window",
|
||||
ircpref: "Active in IRC window",
|
||||
torpref: "Active in Tor Manager window"
|
||||
torpref: "Active in Tor Manager window",
|
||||
};
|
||||
const { name } = context;
|
||||
console.log(titleMap[name]);
|
||||
@@ -228,7 +204,10 @@ function queryTitle(window) {
|
||||
|
||||
function logTabs(tabInfo) {
|
||||
const { cookieStoreId } = tabInfo[0];
|
||||
if (cookieStoreId === "firefox-default" || cookieStoreId === "firefox-private") {
|
||||
if (
|
||||
cookieStoreId === "firefox-default" ||
|
||||
cookieStoreId === "firefox-private"
|
||||
) {
|
||||
setTitle("", "");
|
||||
} else {
|
||||
browser.contextualIdentities
|
||||
@@ -237,27 +216,25 @@ function queryTitle(window) {
|
||||
}
|
||||
}
|
||||
|
||||
const querying = browser.tabs.query({ currentWindow: true,
|
||||
active: true });
|
||||
const querying = browser.tabs.query({ currentWindow: true, active: true });
|
||||
querying.then(logTabs, onContextError);
|
||||
}
|
||||
|
||||
|
||||
var gettingListenerInfo = browser.runtime.getPlatformInfo();
|
||||
gettingListenerInfo.then(got => {
|
||||
gettingListenerInfo.then((got) => {
|
||||
function onPlatformError() {
|
||||
console.log("Error finding platform info");
|
||||
}
|
||||
if (got.os != "android") {
|
||||
browser.tabs.onCreated.addListener(() => {
|
||||
var getting = browser.windows.getCurrent({
|
||||
populate: true
|
||||
populate: true,
|
||||
});
|
||||
getting.then(queryTitle, onPlatformError);
|
||||
});
|
||||
browser.tabs.onActivated.addListener(() => {
|
||||
var getting = browser.windows.getCurrent({
|
||||
populate: true
|
||||
populate: true,
|
||||
});
|
||||
getting.then(queryTitle, onPlatformError);
|
||||
});
|
||||
@@ -299,20 +276,18 @@ async function checkCertificate(details) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Listen for onHeaderReceived for the target page.
|
||||
Set "blocking" and "responseHeaders". */
|
||||
browser.webRequest.onHeadersReceived.addListener(
|
||||
checkCertificate,
|
||||
{ urls: ["<all_urls>"] },
|
||||
[
|
||||
"blocking",
|
||||
"responseHeaders"
|
||||
]
|
||||
["blocking", "responseHeaders"]
|
||||
);
|
||||
|
||||
function onClosedWindowCheck() {
|
||||
const contextQuery = browser.contextualIdentities.query({ name: "titlepref" });
|
||||
const contextQuery = browser.contextualIdentities.query({
|
||||
name: "titlepref",
|
||||
});
|
||||
|
||||
function checkTabs(context) {
|
||||
for (let ctx of context) {
|
||||
@@ -329,9 +304,10 @@ function onClosedWindowCheck() {
|
||||
contextQuery.then(checkTabs, onError);
|
||||
}
|
||||
|
||||
|
||||
async function onOpenedWindowCheck() {
|
||||
const contexts = await browser.contextualIdentities.query({ name: titlepref });
|
||||
const contexts = await browser.contextualIdentities.query({
|
||||
name: titlepref,
|
||||
});
|
||||
|
||||
function deleteContextIfNoTabs(tabs, context) {
|
||||
if (tabs.length == 0 && context != 0) {
|
||||
@@ -340,7 +316,9 @@ async function onOpenedWindowCheck() {
|
||||
}
|
||||
|
||||
async function checkTabs(context) {
|
||||
const tabs = await browser.tabs.query({ cookieStoreId: context.cookieStoreId });
|
||||
const tabs = await browser.tabs.query({
|
||||
cookieStoreId: context.cookieStoreId,
|
||||
});
|
||||
await deleteContextIfNoTabs(tabs, context);
|
||||
}
|
||||
|
||||
@@ -372,8 +350,7 @@ function putCurrentThemeInLocalStorage() {
|
||||
currentTheme.then(storeTheme, themeStoreError);
|
||||
function storeTheme(theme) {
|
||||
console.debug("(theme) stored the current theme:", theme);
|
||||
browser.storage.local.set({name: "theme",
|
||||
theme});
|
||||
browser.storage.local.set({ name: "theme", theme });
|
||||
}
|
||||
}
|
||||
function themeStoreError(err) {
|
||||
@@ -392,7 +369,7 @@ function putLatestThemeIDInLocalStorage(extensionInfo) {
|
||||
console.debug("(theme) storing theme by ID", extensionInfo.id);
|
||||
if (extensionInfo.type === "theme") {
|
||||
let themeID = extensionInfo.id;
|
||||
browser.storage.local.set({themeID});
|
||||
browser.storage.local.set({ themeID });
|
||||
}
|
||||
}
|
||||
function themeStoreError(err) {
|
||||
@@ -406,7 +383,7 @@ function restoreLatestThemeIDInLocalStorage() {
|
||||
function restoreTheme(theme) {
|
||||
if (theme.themeID) {
|
||||
let dis = browser.management.setEnabled(theme.themeID, false);
|
||||
dis.then(function() {
|
||||
dis.then(function () {
|
||||
console.debug("(theme) theme restored by ID", theme.themeID);
|
||||
browser.management.setEnabled(theme.themeID, true);
|
||||
});
|
||||
@@ -449,16 +426,16 @@ let btheme = {
|
||||
colors: {
|
||||
frame: "#363A68",
|
||||
toolbar: "#363A68",
|
||||
tab_text: "#ECF3FF"
|
||||
}
|
||||
tab_text: "#ECF3FF",
|
||||
},
|
||||
};
|
||||
|
||||
let dtheme = {
|
||||
colors: {
|
||||
frame: "#4456B7",
|
||||
toolbar: "#4456B7",
|
||||
tab_text: "#ECF3FF"
|
||||
}
|
||||
tab_text: "#ECF3FF",
|
||||
},
|
||||
};
|
||||
|
||||
async function isMyTheme() {
|
||||
@@ -467,7 +444,11 @@ async function isMyTheme() {
|
||||
if (theme.colors === null || targetColors.colors === null) {
|
||||
return false;
|
||||
}
|
||||
return theme.colors.frame == targetColors.colors.frame && theme.colors.toolbar == targetColors.colors.toolbar && theme.colors.tab_text == targetColors.colors.tab_text;
|
||||
return (
|
||||
theme.colors.frame == targetColors.colors.frame &&
|
||||
theme.colors.toolbar == targetColors.colors.toolbar &&
|
||||
theme.colors.tab_text == targetColors.colors.tab_text
|
||||
);
|
||||
}
|
||||
|
||||
const currentTheme = await browser.theme.getCurrent();
|
||||
|
36
bookmarks.js
36
bookmarks.js
@@ -1,6 +1,6 @@
|
||||
function bookmarksSetup() {
|
||||
var gettingInfo = browser.runtime.getPlatformInfo();
|
||||
gettingInfo.then(got => {
|
||||
gettingInfo.then((got) => {
|
||||
if (got.os != "android") {
|
||||
function bookmarks(bookmarkToolbar) {
|
||||
console.log("(bookmarks)", bookmarkToolbar);
|
||||
@@ -13,14 +13,14 @@ function bookmarksSetup() {
|
||||
let createRhizomeBookmark = browser.bookmarks.create({
|
||||
url: "about:I2p",
|
||||
title: "I2P Extension Home Page",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
parentId: bookmarkToolbar[0].id,
|
||||
});
|
||||
createRhizomeBookmark.then(onCreated);
|
||||
} else {
|
||||
let createBookmark = browser.bookmarks.create({
|
||||
url: browser.runtime.getURL("home.html"),
|
||||
title: "I2P Extension Home Page",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
parentId: bookmarkToolbar[0].id,
|
||||
});
|
||||
createBookmark.then(onCreated);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ function bookmarksSetup() {
|
||||
let createBookmark = browser.bookmarks.create({
|
||||
url: "http://localhost:7657/i2psnark",
|
||||
title: "Bittorrent",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
parentId: bookmarkToolbar[0].id,
|
||||
});
|
||||
createBookmark.then(onCreated);
|
||||
} else {
|
||||
@@ -53,7 +53,7 @@ function bookmarksSetup() {
|
||||
control_port() +
|
||||
"/i2psnark",
|
||||
title: "Bittorrent",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
parentId: bookmarkToolbar[0].id,
|
||||
});
|
||||
createRhizomeBookmark.then(onCreated);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ function bookmarksSetup() {
|
||||
let createBookmark = browser.bookmarks.create({
|
||||
url: "http://localhost:7657/home",
|
||||
title: "I2P Console",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
parentId: bookmarkToolbar[0].id,
|
||||
});
|
||||
createBookmark.then(onCreated);
|
||||
} else {
|
||||
@@ -81,7 +81,7 @@ function bookmarksSetup() {
|
||||
url:
|
||||
"http://" + control_host() + ":" + control_port() + "/home",
|
||||
title: "I2P Console",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
parentId: bookmarkToolbar[0].id,
|
||||
});
|
||||
createRhizomeBookmark.then(onCreated);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ function bookmarksSetup() {
|
||||
let createBookmark = browser.bookmarks.create({
|
||||
url: "http://localhost:7657/webmail",
|
||||
title: "Web Mail",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
parentId: bookmarkToolbar[0].id,
|
||||
});
|
||||
createBookmark.then(onCreated);
|
||||
} else {
|
||||
@@ -113,7 +113,7 @@ function bookmarksSetup() {
|
||||
control_port() +
|
||||
"/webmail",
|
||||
title: "Web Mail",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
parentId: bookmarkToolbar[0].id,
|
||||
});
|
||||
createRhizomeBookmark.then(onCreated);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ function bookmarksSetup() {
|
||||
var createBookmark = browser.bookmarks.create({
|
||||
url: "http://localhost:7657/i2ptunnel",
|
||||
title: "Hidden Services Manager",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
parentId: bookmarkToolbar[0].id,
|
||||
});
|
||||
createBookmark.then(onCreated);
|
||||
} else {
|
||||
@@ -146,7 +146,7 @@ function bookmarksSetup() {
|
||||
control_port() +
|
||||
"/i2ptunnel",
|
||||
title: "Hidden Services Manager",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
parentId: bookmarkToolbar[0].id,
|
||||
});
|
||||
createRhizomeBookmark.then(onCreated);
|
||||
}
|
||||
@@ -168,34 +168,34 @@ function bookmarksSetup() {
|
||||
}
|
||||
|
||||
var b0 = browser.bookmarks.search({
|
||||
title: "I2P Extension Home Page"
|
||||
title: "I2P Extension Home Page",
|
||||
});
|
||||
b0.then(bookHome, onRejected);
|
||||
|
||||
var b1 = browser.bookmarks.search({
|
||||
title: "Bittorrent"
|
||||
title: "Bittorrent",
|
||||
});
|
||||
b1.then(bookTorrent, onRejected);
|
||||
|
||||
var b2 = browser.bookmarks.search({
|
||||
title: "Hidden Services Manager"
|
||||
title: "Hidden Services Manager",
|
||||
});
|
||||
b2.then(bookI2PTunnel, onRejected);
|
||||
|
||||
var b3 = browser.bookmarks.search({
|
||||
title: "Web Mail"
|
||||
title: "Web Mail",
|
||||
});
|
||||
b3.then(bookMail, onRejected);
|
||||
|
||||
var b4 = browser.bookmarks.search({
|
||||
title: "I2P Console"
|
||||
title: "I2P Console",
|
||||
});
|
||||
b4.then(bookConsole, onRejected);
|
||||
defaultSettings["bookmarks_state"] = true;
|
||||
}
|
||||
|
||||
var bt = browser.bookmarks.search({
|
||||
query: "Toolbar"
|
||||
query: "Toolbar",
|
||||
});
|
||||
|
||||
function toolDir(bookmarkToolbar) {
|
||||
@@ -211,7 +211,7 @@ function bookmarksSetup() {
|
||||
if (ibbt[0] == null) {
|
||||
let createBookmark = browser.bookmarks.create({
|
||||
title: "I2P Toolbar",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
parentId: bookmarkToolbar[0].id,
|
||||
});
|
||||
createBookmark.then(onToolbarCreated);
|
||||
}
|
||||
|
2
host.js
2
host.js
@@ -22,7 +22,7 @@ function isProxyHost(requestDetails) {
|
||||
}
|
||||
|
||||
function isLocalHost(url) {
|
||||
console.error("(host) checking local host", url);
|
||||
console.log("(host) checking local host", url);
|
||||
const urlPath = url.toString().split("/")[2].split(":")[0];
|
||||
if (urlPath === "127.0.0.1" || urlPath === "localhost") {
|
||||
if (url.includes(":8084")) {
|
||||
|
40
proxy.js
40
proxy.js
@@ -14,14 +14,14 @@ var torpref = chrome.i18n.getMessage("torPreface");
|
||||
var torprefpriv = chrome.i18n.getMessage("torPreface");
|
||||
|
||||
browser.privacy.network.peerConnectionEnabled.set({
|
||||
value: true
|
||||
value: true,
|
||||
});
|
||||
|
||||
chrome.privacy.network.networkPredictionEnabled.set({
|
||||
value: false
|
||||
value: false,
|
||||
});
|
||||
chrome.privacy.network.webRTCIPHandlingPolicy.set({
|
||||
value: "disable_non_proxied_udp"
|
||||
value: "disable_non_proxied_udp",
|
||||
});
|
||||
console.log("Disabled unproxied UDP.");
|
||||
|
||||
@@ -34,7 +34,7 @@ var handleContextProxyRequest = async function (requestDetails) {
|
||||
proxy = {
|
||||
type: proxy_scheme(),
|
||||
host: proxy_host(),
|
||||
port: proxy_port()
|
||||
port: proxy_port(),
|
||||
};
|
||||
console.warn("(proxy) is proxy check");
|
||||
return proxy;
|
||||
@@ -45,7 +45,7 @@ var handleContextProxyRequest = async function (requestDetails) {
|
||||
proxy = {
|
||||
type: proxy_scheme(),
|
||||
host: proxy_host(),
|
||||
port: proxy_port()
|
||||
port: proxy_port(),
|
||||
};
|
||||
return proxy;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ var handleContextProxyRequest = async function (requestDetails) {
|
||||
proxy = {
|
||||
type: proxy_scheme(),
|
||||
host: proxy_host(),
|
||||
port: proxy_port()
|
||||
port: proxy_port(),
|
||||
};
|
||||
return proxy;
|
||||
}
|
||||
@@ -77,7 +77,7 @@ var handleContextProxyRequest = async function (requestDetails) {
|
||||
proxy = {
|
||||
type: proxy_scheme(),
|
||||
host: proxy_host(),
|
||||
port: proxy_port()
|
||||
port: proxy_port(),
|
||||
};
|
||||
return proxy;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ var handleContextProxyRequest = async function (requestDetails) {
|
||||
proxy = {
|
||||
type: proxy_scheme(),
|
||||
host: proxy_host(),
|
||||
port: proxy_port()
|
||||
port: proxy_port(),
|
||||
};
|
||||
let url = new URL(requestDetails.url);
|
||||
if (
|
||||
@@ -125,7 +125,7 @@ var handleContextProxyRequest = async function (requestDetails) {
|
||||
proxy = {
|
||||
type: proxy_scheme(),
|
||||
host: proxy_host(),
|
||||
port: proxy_port()
|
||||
port: proxy_port(),
|
||||
};
|
||||
return proxy;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ var handleContextProxyRequest = async function (requestDetails) {
|
||||
proxy = {
|
||||
type: proxy_scheme(),
|
||||
host: proxy_host(),
|
||||
port: proxy_port()
|
||||
port: proxy_port(),
|
||||
};
|
||||
|
||||
if (context == "firefox-default" || context == "firefox-private") {
|
||||
@@ -198,13 +198,13 @@ var handleContextProxyRequest = async function (requestDetails) {
|
||||
proxy = {
|
||||
type: proxy_scheme(),
|
||||
host: proxy_host(),
|
||||
port: proxy_port()
|
||||
port: proxy_port(),
|
||||
};
|
||||
} else if (isProxyHost(requestDetails)) {
|
||||
proxy = {
|
||||
type: proxy_scheme(),
|
||||
host: proxy_host(),
|
||||
port: proxy_port()
|
||||
port: proxy_port(),
|
||||
};
|
||||
} else {
|
||||
proxy = null;
|
||||
@@ -238,7 +238,7 @@ var handleContextProxyRequest = async function (requestDetails) {
|
||||
proxy = {
|
||||
type: proxy_scheme(),
|
||||
host: proxy_host(),
|
||||
port: proxy_port()
|
||||
port: proxy_port(),
|
||||
};
|
||||
return proxy;
|
||||
}
|
||||
@@ -246,7 +246,7 @@ var handleContextProxyRequest = async function (requestDetails) {
|
||||
proxy = {
|
||||
type: proxy_scheme(),
|
||||
host: proxy_host(),
|
||||
port: proxy_port()
|
||||
port: proxy_port(),
|
||||
};
|
||||
return proxy;
|
||||
}
|
||||
@@ -266,7 +266,7 @@ var handleContextProxyRequest = async function (requestDetails) {
|
||||
proxy = {
|
||||
type: proxy_scheme(),
|
||||
host: proxy_host(),
|
||||
port: proxy_port()
|
||||
port: proxy_port(),
|
||||
};
|
||||
return proxy;
|
||||
} else if (i2pHost(requestDetails)) {
|
||||
@@ -292,7 +292,7 @@ var handleContextProxyRequest = async function (requestDetails) {
|
||||
proxy = {
|
||||
type: proxy_scheme(),
|
||||
host: proxy_host(),
|
||||
port: proxy_port()
|
||||
port: proxy_port(),
|
||||
};
|
||||
//console.log('(proxy for rpc url)', rpc);
|
||||
return proxy;
|
||||
@@ -309,7 +309,7 @@ function SetupSettings() {
|
||||
function setupProxy() {
|
||||
console.log("Setting up Firefox WebExtension proxy");
|
||||
browser.proxy.onRequest.addListener(handleContextProxyRequest, {
|
||||
urls: ["<all_urls>"]
|
||||
urls: ["<all_urls>"],
|
||||
});
|
||||
console.log("i2p settings created for WebExtension Proxy");
|
||||
browser.proxy.onError.addListener(handleContextProxyError);
|
||||
@@ -320,7 +320,7 @@ function handleContextProxyError(err) {
|
||||
console.error(`(proxy) Error : ${error}`);
|
||||
}
|
||||
console.warn("(proxy) Error:", err);
|
||||
if (err.message = "ProxyInfoData: Invalid proxy server type: \"undefined\"") {
|
||||
if ((err.message = 'ProxyInfoData: Invalid proxy server type: "undefined"')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ function handleContextProxyError(err) {
|
||||
console.error(`(proxy) Error : ${error}`);
|
||||
}
|
||||
let createData = {
|
||||
url: "proxyerr.html"
|
||||
url: "proxyerr.html",
|
||||
};
|
||||
let creating = browser.tabs.update(tab.id, createData);
|
||||
creating.then(onProxyErrorUpdated, onProxyError);
|
||||
@@ -386,7 +386,7 @@ SetupSettings();
|
||||
setupProxy();
|
||||
|
||||
var gettingListenerInfo = browser.runtime.getPlatformInfo();
|
||||
gettingListenerInfo.then(got => {
|
||||
gettingListenerInfo.then((got) => {
|
||||
if (browser.windows != undefined) {
|
||||
browser.windows.onCreated.addListener(() => {
|
||||
chrome.storage.local.get(function () {
|
||||
|
111
scrub.js
111
scrub.js
@@ -136,12 +136,44 @@ function blogTabFind(tabId) {
|
||||
}
|
||||
}
|
||||
|
||||
function fixURL(contextidentifier, url) {
|
||||
routerHost = control_host();
|
||||
routerPort = control_port();
|
||||
routerURL = new URL("http://" + routerHost + ":" + routerPort + "/");
|
||||
if (url.startsWith("moz-extension://")) {
|
||||
switch (contextidentifier) {
|
||||
case titlepref:
|
||||
return "http://proxy.i2p";
|
||||
case routerpref:
|
||||
return routerURL + "console";
|
||||
case tunnelpref:
|
||||
return routerURL + "i2ptunnel";
|
||||
case muwirepref:
|
||||
return routerURL + "MuWire";
|
||||
case botepref:
|
||||
return routerURL + "i2pbote";
|
||||
case mailpref:
|
||||
return routerURL + "webmail";
|
||||
case ircpref:
|
||||
return "127.0.0.1:7669";
|
||||
case torpref:
|
||||
return "127.0.0.1:7695";
|
||||
case blogpref:
|
||||
return "127.0.0.1:8084";
|
||||
default:
|
||||
return "http://proxy.i2p";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function forceIntoIsolation(tabId, contextidentifier, pin = true) {
|
||||
console.info("(isolate) forcing context for", tabId, contextidentifier, pin);
|
||||
try {
|
||||
var context = await browser.contextualIdentities.query({
|
||||
name: contextidentifier
|
||||
name: contextidentifier,
|
||||
});
|
||||
console.log("(scrub) tabId URL", tabId.url);
|
||||
let newURL = fixURL(contextidentifier, tabId.url);
|
||||
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
||||
function Create(beforeTab) {
|
||||
console.info("(isolate) isolating before tab:", beforeTab);
|
||||
@@ -168,12 +200,12 @@ async function forceIntoIsolation(tabId, contextidentifier, pin = true) {
|
||||
}
|
||||
browser.pageAction.setPopup({
|
||||
tabId: tabId.id,
|
||||
popup: "security.html"
|
||||
popup: "security.html",
|
||||
});
|
||||
browser.pageAction.show(tabId.id);
|
||||
}
|
||||
var pins = browser.tabs.query({
|
||||
cookieStoreId: context[0].cookieStoreId
|
||||
cookieStoreId: context[0].cookieStoreId,
|
||||
});
|
||||
pins.then(closeOldTab, onScrubError);
|
||||
return afterTab;
|
||||
@@ -181,8 +213,8 @@ async function forceIntoIsolation(tabId, contextidentifier, pin = true) {
|
||||
var created = browser.tabs.create({
|
||||
active: true,
|
||||
cookieStoreId: context[0].cookieStoreId,
|
||||
url: beforeTab.url,
|
||||
pinned: pin
|
||||
url: newURL,
|
||||
pinned: pin,
|
||||
});
|
||||
return created.then(onCreated, onContextError);
|
||||
}
|
||||
@@ -206,15 +238,16 @@ async function findOtherContexts() {
|
||||
"muwirepref",
|
||||
"botepref",
|
||||
"blogpref",
|
||||
"torpref"
|
||||
"torpref",
|
||||
];
|
||||
const contexts = await browser.contextualIdentities.query({});
|
||||
const myContexts = await Promise.all(
|
||||
prefs.map(pref => browser.contextualIdentities.query({ name: pref }))
|
||||
prefs.map((pref) => browser.contextualIdentities.query({ name: pref }))
|
||||
);
|
||||
const otherContexts = contexts.filter(
|
||||
context => !myContexts.some(
|
||||
myContext => myContext[0].cookieStoreId === context.cookieStoreId
|
||||
(context) =>
|
||||
!myContexts.some(
|
||||
(myContext) => myContext[0].cookieStoreId === context.cookieStoreId
|
||||
)
|
||||
);
|
||||
return otherContexts;
|
||||
@@ -228,12 +261,12 @@ function contextSetup(requestDetails) {
|
||||
}
|
||||
try {
|
||||
var context = await browser.contextualIdentities.query({
|
||||
name: torrentpref
|
||||
name: torrentpref,
|
||||
});
|
||||
if (tabId) {
|
||||
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
||||
var exemptContext = await browser.contextualIdentities.query({
|
||||
name: titlepref
|
||||
name: titlepref,
|
||||
});
|
||||
let tmp = new URL(tabId.url);
|
||||
console.log("(isolate) torrent tabid host", tmp.host, exemptContext);
|
||||
@@ -249,7 +282,7 @@ function contextSetup(requestDetails) {
|
||||
browser.tabs.move(currentTab.id, { index: 0 });
|
||||
}
|
||||
const pins = browser.tabs.query({
|
||||
cookieStoreId: context[0].cookieStoreId
|
||||
cookieStoreId: context[0].cookieStoreId,
|
||||
});
|
||||
pins.then(closeOldTabs, onScrubError);
|
||||
}
|
||||
@@ -265,7 +298,7 @@ function contextSetup(requestDetails) {
|
||||
active: true,
|
||||
pinned: true,
|
||||
cookieStoreId: context[0].cookieStoreId,
|
||||
url: requestDetails.url
|
||||
url: requestDetails.url,
|
||||
});
|
||||
created.then(onCreated, onContextError);
|
||||
}
|
||||
@@ -296,7 +329,7 @@ function contextSetup(requestDetails) {
|
||||
let setcookie = browser.cookies.set({
|
||||
firstPartyDomain: i2pHostName(requestDetails.url),
|
||||
url: requestDetails.url,
|
||||
secure: true
|
||||
secure: true,
|
||||
});
|
||||
setcookie.then(onContextGotLog, onContextError);
|
||||
return requestDetails;
|
||||
@@ -385,7 +418,7 @@ function contextSetup(requestDetails) {
|
||||
const setcookie = browser.cookies.set({
|
||||
firstPartyDomain: i2pHostName(url),
|
||||
url,
|
||||
secure: true
|
||||
secure: true,
|
||||
});
|
||||
setcookie.then(onContextGotLog, onContextError);
|
||||
const i2ptab = tab.then(i2pTabFind, onContextError);
|
||||
@@ -406,7 +439,7 @@ function coolheadersSetup(incomingHeaders) {
|
||||
window.setTimeout(() => {
|
||||
if (incomingHeaders.tabId != undefined) {
|
||||
let popup = browser.pageAction.getPopup({
|
||||
tabId: incomingHeaders.tabId
|
||||
tabId: incomingHeaders.tabId,
|
||||
});
|
||||
popup.then(gotPopup);
|
||||
}
|
||||
@@ -443,32 +476,32 @@ function gotPopup(pageTest, tab) {
|
||||
if (isI2p) {
|
||||
browser.pageAction.setPopup({
|
||||
tabId: tab.id,
|
||||
popup: "security.html"
|
||||
popup: "security.html",
|
||||
});
|
||||
browser.pageAction.setIcon({
|
||||
path: "icons/infotoopies.png",
|
||||
tabId: tab.id
|
||||
tabId: tab.id,
|
||||
});
|
||||
|
||||
try {
|
||||
browser.tabs
|
||||
.sendMessage(tab.id, { req: "i2p-torrentlocation" })
|
||||
.then(response => {
|
||||
.then((response) => {
|
||||
if (
|
||||
response &&
|
||||
response.content.toUpperCase() !== "NO-ALT-LOCATION"
|
||||
) {
|
||||
browser.pageAction.setPopup({
|
||||
tabId: tab.id,
|
||||
popup: "torrent.html"
|
||||
popup: "torrent.html",
|
||||
});
|
||||
browser.pageAction.setIcon({
|
||||
path: "icons/infotoopiesbt.png",
|
||||
tabId: tab.id
|
||||
tabId: tab.id,
|
||||
});
|
||||
browser.pageAction.setTitle({
|
||||
tabId: tab.id,
|
||||
title: response.content
|
||||
title: response.content,
|
||||
});
|
||||
browser.pageAction.show(tab.id);
|
||||
}
|
||||
@@ -480,22 +513,22 @@ function gotPopup(pageTest, tab) {
|
||||
try {
|
||||
browser.tabs
|
||||
.sendMessage(tab.id, { req: "i2p-location" })
|
||||
.then(response => {
|
||||
.then((response) => {
|
||||
if (
|
||||
response &&
|
||||
response.content.toUpperCase() !== "NO-ALT-LOCATION"
|
||||
) {
|
||||
browser.pageAction.setPopup({
|
||||
tabId: tab.id,
|
||||
popup: "location.html"
|
||||
popup: "location.html",
|
||||
});
|
||||
browser.pageAction.setIcon({
|
||||
path: "icons/i2plogo.png",
|
||||
tabId: tab.id
|
||||
tabId: tab.id,
|
||||
});
|
||||
browser.pageAction.setTitle({
|
||||
tabId: tab.id,
|
||||
title: response.content
|
||||
title: response.content,
|
||||
});
|
||||
browser.pageAction.show(tab.id);
|
||||
}
|
||||
@@ -508,33 +541,33 @@ function gotPopup(pageTest, tab) {
|
||||
if (isI2p) {
|
||||
browser.pageAction.setPopup({
|
||||
tabId: tab.id,
|
||||
popup: "security.html"
|
||||
popup: "security.html",
|
||||
});
|
||||
browser.pageAction.setIcon({
|
||||
path: "icons/infotoopie.png",
|
||||
tabId: tab.id
|
||||
tabId: tab.id,
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
browser.tabs
|
||||
.sendMessage(tab.id, { req: "i2p-torrentlocation" })
|
||||
.then(response => {
|
||||
.then((response) => {
|
||||
if (
|
||||
response &&
|
||||
response.content.toUpperCase() !== "NO-ALT-LOCATION"
|
||||
) {
|
||||
browser.pageAction.setPopup({
|
||||
tabId: tab.id,
|
||||
popup: "torrent.html"
|
||||
popup: "torrent.html",
|
||||
});
|
||||
browser.pageAction.setIcon({
|
||||
path: "icons/infotoopiebt.png",
|
||||
tabId: tab.id
|
||||
tabId: tab.id,
|
||||
});
|
||||
browser.pageAction.setTitle({
|
||||
tabId: tab.id,
|
||||
title: response.content
|
||||
title: response.content,
|
||||
});
|
||||
browser.pageAction.show(tab.id);
|
||||
}
|
||||
@@ -565,7 +598,7 @@ function getClearTab(tab) {
|
||||
}
|
||||
|
||||
const filter = {
|
||||
url: [{ hostContains: ".i2p" }]
|
||||
url: [{ hostContains: ".i2p" }],
|
||||
};
|
||||
|
||||
function logOnDOMContentLoaded(details) {
|
||||
@@ -599,10 +632,7 @@ querying.then(reloadTabs, onScrubError);
|
||||
Set "blocking" and "responseHeaders". */
|
||||
browser.webRequest.onHeadersReceived.addListener(
|
||||
coolheadersSetup,
|
||||
{ urls: [
|
||||
"*://*.i2p/*",
|
||||
"https://*/*"
|
||||
] },
|
||||
{ urls: ["*://*.i2p/*", "https://*/*"] },
|
||||
["responseHeaders"]
|
||||
);
|
||||
|
||||
@@ -613,12 +643,7 @@ browser.webNavigation.onDOMContentLoaded.addListener(
|
||||
);
|
||||
|
||||
browser.webRequest.onBeforeRequest.addListener(contextSetup, {
|
||||
urls: [
|
||||
"*://*.i2p/*",
|
||||
"*://localhost/*",
|
||||
"*://127.0.0.1/*",
|
||||
"*://*/*i2p*"
|
||||
]
|
||||
urls: ["*://*.i2p/*", "*://localhost/*", "*://127.0.0.1/*", "*://*/*i2p*"],
|
||||
});
|
||||
|
||||
browser.webRequest.onBeforeSendHeaders.addListener(
|
||||
|
@@ -7,7 +7,7 @@ function rpcCall(meth, args) {
|
||||
return browser.storage.local.get(function (server) {
|
||||
const myHeaders = {
|
||||
"Content-Type": "application/json",
|
||||
"x-transmission-session-id": server.session
|
||||
"x-transmission-session-id": server.session,
|
||||
};
|
||||
//console.log("(torrent)", server.session)
|
||||
if (server.username !== "" || server.btrpcpass !== "") {
|
||||
@@ -21,9 +21,9 @@ function rpcCall(meth, args) {
|
||||
headers: myHeaders,
|
||||
body: JSON.stringify({
|
||||
method: meth,
|
||||
arguments: args
|
||||
arguments: args,
|
||||
}),
|
||||
credentials: "include" // allows HTTPS client certs!
|
||||
credentials: "include", // allows HTTPS client certs!
|
||||
})
|
||||
.then(function (response) {
|
||||
const session = response.headers.get("x-transmission-session-id");
|
||||
|
Reference in New Issue
Block a user