fix bookmark

This commit is contained in:
idk
2019-11-11 21:02:38 -05:00
parent 92ce8431a2
commit 4cde00c7de
4 changed files with 545 additions and 0 deletions

251
.eslintrc.js Normal file
View File

@ -0,0 +1,251 @@
module.exports = {
env: {
browser: true,
es6: true,
webextensions: true
},
extends: "eslint:recommended",
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly"
},
parserOptions: {
ecmaVersion: 2018
},
rules: {
"accessor-pairs": "error",
"array-bracket-newline": "error",
"array-bracket-spacing": ["error", "never"],
"array-callback-return": "error",
"array-element-newline": "error",
"arrow-body-style": "error",
"arrow-parens": ["error", "as-needed"],
"arrow-spacing": [
"error",
{
after: true,
before: true
}
],
"block-scoped-var": "off",
"block-spacing": "error",
"brace-style": ["error", "1tbs"],
"callback-return": "error",
camelcase: "off",
"capitalized-comments": "off",
"class-methods-use-this": "error",
"comma-dangle": "error",
"comma-spacing": [
"error",
{
after: true,
before: false
}
],
"comma-style": ["error", "last"],
complexity: "error",
"computed-property-spacing": ["error", "never"],
"consistent-return": "off",
"consistent-this": "error",
curly: "error",
"default-case": "error",
"default-param-last": "error",
"dot-location": "error",
"dot-notation": "off",
"eol-last": "error",
eqeqeq: "off",
"func-call-spacing": "error",
"func-name-matching": "error",
"func-names": "off",
"func-style": "off",
"function-call-argument-newline": ["error", "consistent"],
"function-paren-newline": "error",
"generator-star-spacing": "error",
"global-require": "error",
"guard-for-in": "error",
"handle-callback-err": "error",
"id-blacklist": "error",
"id-length": "error",
"id-match": "error",
"implicit-arrow-linebreak": ["error", "beside"],
indent: "off",
"indent-legacy": "off",
"init-declarations": "error",
"jsx-quotes": "error",
"key-spacing": "error",
"keyword-spacing": [
"error",
{
after: true,
before: true
}
],
"line-comment-position": "error",
"linebreak-style": ["error", "unix"],
"lines-around-comment": "off",
"lines-around-directive": "error",
"lines-between-class-members": "error",
"max-classes-per-file": "error",
"max-depth": "error",
"max-len": "error",
"max-lines": "error",
"max-lines-per-function": "off",
"max-nested-callbacks": "error",
"max-params": "error",
"max-statements": "off",
"max-statements-per-line": "error",
"multiline-comment-style": ["error", "bare-block"],
"multiline-ternary": "error",
"new-cap": "error",
"new-parens": "error",
"newline-after-var": "off",
"newline-before-return": "off",
"newline-per-chained-call": "error",
"no-alert": "error",
"no-array-constructor": "error",
"no-await-in-loop": "error",
"no-bitwise": "error",
"no-buffer-constructor": "error",
"no-caller": "error",
"no-catch-shadow": "error",
"no-confusing-arrow": "error",
"no-console": "off",
"no-continue": "error",
"no-div-regex": "error",
"no-duplicate-imports": "error",
"no-else-return": "off",
"no-empty-function": "error",
"no-eq-null": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-label": "error",
"no-extra-parens": "error",
"no-floating-decimal": "error",
"no-implicit-coercion": "error",
"no-implicit-globals": "off",
"no-implied-eval": "error",
"no-import-assign": "error",
"no-inline-comments": "error",
"no-inner-declarations": ["error", "functions"],
"no-invalid-this": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-lonely-if": "error",
"no-loop-func": "error",
"no-magic-numbers": "off",
"no-mixed-operators": "error",
"no-mixed-requires": "error",
"no-multi-assign": "error",
"no-multi-spaces": "error",
"no-multi-str": "error",
"no-multiple-empty-lines": "error",
"no-native-reassign": "error",
"no-negated-condition": "error",
"no-negated-in-lhs": "error",
"no-nested-ternary": "error",
"no-new": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-require": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-param-reassign": "error",
"no-path-concat": "error",
"no-plusplus": "error",
"no-process-env": "error",
"no-process-exit": "error",
"no-proto": "error",
"no-restricted-globals": "error",
"no-restricted-imports": "error",
"no-restricted-modules": "error",
"no-restricted-properties": "error",
"no-restricted-syntax": "error",
"no-return-assign": "error",
"no-return-await": "error",
"no-script-url": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-shadow": "error",
"no-spaced-func": "error",
"no-sync": "error",
"no-tabs": "error",
"no-template-curly-in-string": "error",
"no-ternary": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-undefined": "off",
"no-underscore-dangle": "error",
"no-unmodified-loop-condition": "error",
"no-unneeded-ternary": "error",
"no-unused-expressions": "error",
"no-use-before-define": "off",
"no-useless-call": "error",
"no-useless-computed-key": "error",
"no-useless-concat": "error",
"no-useless-constructor": "error",
"no-useless-rename": "error",
"no-useless-return": "error",
"no-var": "off",
"no-void": "error",
"no-warning-comments": "error",
"no-whitespace-before-property": "error",
"nonblock-statement-body-position": "error",
"object-curly-newline": "error",
"object-curly-spacing": "error",
"object-property-newline": "error",
"object-shorthand": "error",
"one-var": "off",
"one-var-declaration-per-line": "error",
"operator-assignment": "error",
"operator-linebreak": "error",
"padded-blocks": "off",
"padding-line-between-statements": "error",
"prefer-arrow-callback": "off",
"prefer-const": "off",
"prefer-destructuring": "off",
"prefer-named-capture-group": "error",
"prefer-numeric-literals": "error",
"prefer-object-spread": "error",
"prefer-promise-reject-errors": "error",
"prefer-reflect": "error",
"prefer-regex-literals": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "off",
"quote-props": "off",
quotes: ["error", "double"],
radix: "error",
"require-await": "error",
"require-jsdoc": "off",
"require-unicode-regexp": "error",
"rest-spread-spacing": "error",
semi: "error",
"semi-spacing": "error",
"semi-style": ["error", "last"],
"sort-imports": "error",
"sort-keys": "off",
"sort-vars": "error",
"space-before-blocks": "error",
"space-before-function-paren": "off",
"space-in-parens": ["error", "never"],
"space-infix-ops": "error",
"space-unary-ops": "error",
"spaced-comment": "off",
strict: ["error", "never"],
"switch-colon-spacing": "error",
"symbol-description": "error",
"template-curly-spacing": "error",
"template-tag-spacing": "error",
"unicode-bom": ["error", "never"],
"valid-jsdoc": "error",
"vars-on-top": "off",
"wrap-iife": "error",
"wrap-regex": "error",
"yield-star-spacing": "error",
yoda: ["error", "never"]
}
};

114
GOALS.md Normal file
View File

@ -0,0 +1,114 @@
These are the goals of the I2P Browser, and not really this plugin in-and-of-itself
===================================================================================
A
User Interface:
---------------
* Remove search engines
* Replace bookmarks
* Donate banner / UI
* Patch Firefox to have relative (from the binary) profile directory
* Start use the Firefox update process to update browser installations
* Mark .i2p cookies as secure
* Mark .i2p domains as secure connection
* Add tests for .i2p secure marking
* Improve the delay-the-user XUL dialogs to be more accurate in regards
of where the router is in its bootup progress
* Disable the WebIDE
* Disable GamePad API by default
* Disable Web Speech API by default
* Disable the Web Audio API by default
* UI redesign bootstrapping and configuration screens (delay-the-user dialogs)
* Default browser choose wining should de disabled like
browser.shell.checkDefaultBrowser, it can be default, but then
choosen by the user without any begging ahead
* Extend the firefox preferences UI for I2P router configuration thought
of as "must have" or "very nice to have"
* Shrink the BroadcastChannel API's boundaries of access or disable completely
* Make a API white/grey/black -list, in super paranoia mode we should
probably disable almost all, while in most cases the user probably want
to be as close to a normal browser/web experinence that
they are used to from before
Leak Avoidance:
---------------
* Stop web socket DNS leak
* If doable, slim down the CA store from unnecessary CAs
* Disable the microphone by default
* Ensure WebRTC is disabled in compile time
* Disable mDNS features
* Ensure links like sftp:// and smb:// ,
as well as \\samba-share is blocked/denied
* Dont allow IndexedDB storage for third party domains (likability issue)
* Patch the DNS service to prevent any browser or addon DNS resolution
* Restrict what MIME types that are exposed to content scripts
General Security:
-----------------
* Backport any security patches that might appear from Mozilla
* Dont allow XHR/Websockets requests towards 127.0.0.1/localhost
* Always use the most sane form of preferences defaults in context
of privacy and security.
Unnecessary Connections:
------------------------
* Disable getpocket.com features and alike
* Remove sync option from preferences
* Clear state when the app exits, by default
* Disable updater telemetry
* Make firefox stop call home to mozilla for different reasons
* Prevent non-Necko network connections
* Figure out how to approach prerender, preconnect, and prefetch link tags
Disk Avoidance:
---------------
* Dont allow SSL key logging
* Only cache media in memory
* Disable the password saving functionality to avoid such being written to disk
* Disable the Auto form-fill to keep as much as possible not written to disk
Platforms:
----------
* Support for Android?
* Support for iOS?
Anti-Fingerprinting:
--------------------
* Test for preferences which ensures a sane default and
something to tell when/if we break it
* Disable support for system adding
* Disable Firefox enterprise policies
* Disable NTLM authentication
* Disable SPNEGO authentication
* Handle privacy issues regarding window.name
* Test runner for I2P Browser test cases
* Block loading of plugins
* Disable OS spesific firefox features that can help fingerprint
the end user's operating system
* Block html5 canvas by default
* Block by default or disable WebGL completely?
* Never start fullscreen, always start with fixed width/height to
avoid expose screen resolution
* Report fake system uptime to content scripts
* Spoof Accept-Language and Accept-Charset headers no matter browser language
* Spoof timezone to always be UTC
* Develop methods to reduce the accuracy of JavaScript
performance fingerprinting
* Always report only one CPU core (dom.maxHardwareConcurrencys)
* Avoid Keystroke fingerprinting by messing with the event resolution
* Disable GeoIP-based search results
???
---
* SVG drawing
* MathML drawing
* I2Pd flavor

74
bookmarks.js Normal file
View File

@ -0,0 +1,74 @@
function bookmarks(bookmarkToolbar) {
console.log("Setting up bookmark toolbar", bookmarkToolbar);
function bookHome(bookmarkItems) {
if (!bookmarkItems.length) {
function checkIBBookmarks(storedSettings) {
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: "Landing Page",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
}
}
var gettingInfo = browser.proxy.settings.get({});
gettingInfo.then(gotProxyInfo);
}
}
}
function bookTorrent(bookmarkItems) {
if (!bookmarkItems.length) {
var createBookmark = browser.bookmarks.create({
url: "http://localhost:7657/torrents",
title: "Torrents",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
}
}
function bookMail(bookmarkItems) {
if (!bookmarkItems.length) {
var createBookmark = browser.bookmarks.create({
url: "http://localhost:7657/webmail",
title: "E-Mail",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
}
}
function onRejected(error) {
console.log(`An error: ${error}`);
}
function onCreated(node) {
console.log("Bookmarked", node);
}
var b0 = browser.bookmarks.search({
title: "Landing Page"
});
b0.then(bookHome, onRejected);
var b1 = browser.bookmarks.search({
url: "http://localhost:7657/torrents",
title: "Torrents"
});
b1.then(bookTorrent, onRejected);
var b2 = browser.bookmarks.search({
url: "http://localhost:7657/webmail",
title: "E-Mail"
});
b2.then(bookMail, onRejected);
}
var bt = browser.bookmarks.search({
query: "Toolbar"
});
bt.then(bookmarks);

106
index.html Normal file
View File

@ -0,0 +1,106 @@
<strong>i2psetproxy.js</strong>
WebExtension that does extended configuration of a dedicated I2P browser. While
<strong>experimental</strong>, it's capable of enforcing the use of the I2P Proxy without
needing to touch about:config and disables several
fingerprinting/de-anonymization vectors on it's own. It is also the easiest way
to configure an I2P browser on Android without requiring the user to root their
device.
<strong>The Old Version</strong>
New versions of this extension create an I2P in Private Browsing mode instead.
Since this is a drastic change to the behavior of the old plugin, a new entry
for the new plugin has been made at a new location on addons.mozilla.org.
<ul>
<li>This is the new version: <a href="https://addons.mozilla.org/en-US/firefox/addon/i2p-in-private-browsing/">[link]</a></li>
<li>This is the old version: <a href="https://addons.mozilla.org/en-US/firefox/addon/I2P-Proxy/">[link]</a></li>
</ul>
<strong>Android usage:</strong>
Open the following link
<a href="https://github.com/eyedeekay/i2psetproxy.js/releases/">Github Releases Version</a>
in the browser you want to use for I2P. Firefox will warn you that it is about
to install an extension and indicate the permissions required. Read them over
and when you're ready, accept them. That's all it should take, your browser is
now configured to use I2P.
<strong>addons.mozilla.org</strong>
If you would prefer to recieve automatic updates from AMO, the correct product
page for this plugin is
<a href="https://addons.mozilla.org/en-US/firefox/addon/i2p-in-private-browsing/">I2P In Private Browsing</a>.
This absolutely requires a working outproxy. If you want to avoid the use of AMO
for updates, you can download the identical plugin from this repository's
releases page. The latest AMO Plugin will always be identical to the latest
github release, except for the version number, which must be incremented for
submission to AMO.
<strong>Features</strong>
<ul>
<li>[done] <strong>Provide</strong> a way to launch into an I2P-Specific contextual identity
(container). Intercept requests to .i2p domains and automatically route them
to the I2P container. Isolate the router console from other local
applications by automatically intercepting requests to the router console to
another container.</li>
<li>[done/wip] <strong>Indicate</strong> the I2P browser is in use visually. Find an
acceptable way to indicate it on Android.</li>
<li>[done] <strong>Set</strong> the http proxy to use the local I2P proxy automatically.
Provide specific configuration for other types of I2P proxies(SOCKS,
isolating HTTP)</li>
<li>[done/wip] <strong>Disable</strong> risky webRTC features/offer the option to re-enable
them with the proxy enforced.</li>
<li>[done] <strong>Change</strong> the color of the browser window to indicate that I2P is in
use</li>
<li>[done-ish] <strong>Reset</strong> the HTTP Proxy tunnel to generate a new destination
on-demand
<ul>
<li>it does this by working in conjunction with this
<a href="https://github.com/eyedeekay/httptunnel">standalone HTTP proxy</a>, currently
disabled*.</li>
</ul></li>
<li>[ready] <strong>Provide</strong> help in a variety of languages.</li>
<li>[wip] <strong>Monitor</strong> the health and readiness of the I2P router it is
instructed to use.</li>
<li>[1/2] <strong>Handle</strong> 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.</li>
<li>[not started] <strong>Handle Torrents</strong> by talking to i2psnark-rpc plugin and then
adding them directly into the Firefox downloads drop-downs, menus, etc. If I
can.</li>
</ul>
<strong>Screenshot</strong>
<strong>Super Extra Important Background Info:</strong>
This plugin's viability is directly related to the viability of Mozilla and
Tor's work on hardening Firefox itself and of particular interest are the
"Uplift" and "Fusion(Firefox Using Onions)" projects.
<strong>Links about Project Uplift</strong>
<ul>
<li>https://wiki.mozilla.org/Security/Tor_Uplift</li>
<li>https://wiki.mozilla.org/Security/FirstPartyIsolation</li>
<li>https://wiki.mozilla.org/Security/Fingerprinting</li>
<li>https://wiki.mozilla.org/Security/Fennec%2BTor_Project</li>
<li>https://wiki.mozilla.org/Security/Tor_Uplift/Tracking</li>
</ul>
Project uplift seems to have largely been accomplished?
<strong>Links about Project Fusion</strong>
<ul>
<li>https://wiki.mozilla.org/Security/Fusion</li>
<li>https://trac.torproject.org/projects/tor/wiki/org/meetings/2018Rome/Notes/FusionProject</li>
<li>https://blog.torproject.org/tor-heart-firefox</li>
</ul>