87 Commits
0.79 ... 0.89

Author SHA1 Message Date
idk
ac09b72be3 change the url for the MuWire test 2020-12-13 14:07:10 -05:00
idk
d901711c7b Merge branch 'slightly-better-popup' into 'master'
Slightly better popup

See merge request idk/I2P-in-Private-Browsing-Mode-Firefox!18
2020-12-13 04:37:06 +00:00
idk
88517a7b52 bail out when the header has already been detected and the pageaction is already set 2020-12-12 23:33:25 -05:00
idk
39eb695522 fmt 2020-12-12 00:08:27 -05:00
idk
009bac364c fmt 2020-12-11 20:49:16 -05:00
idk
9741b21def fmt 2020-12-11 20:48:35 -05:00
idk
df7bc109ed update popup css 2020-12-11 20:47:49 -05:00
idk
8cd9b53be3 update popup css 2020-12-11 20:18:58 -05:00
idk
9db61be253 Merge branch 'do-less' into 'master'
Be less Interruptive in non-essential ways

Closes #29 and #30

See merge request idk/I2P-in-Private-Browsing-Mode-Firefox!17
2020-12-12 01:16:18 +00:00
idk
78a1794568 fix sanity check on torrent proxy 2020-12-11 16:30:22 -05:00
idk
aa9805e107 Fix torrent-proxy sanity check 2020-12-11 15:42:28 -05:00
idk
a992553ffb make embedding torrents in pages faster 2020-12-10 10:15:48 -05:00
idk
3a30961cd1 fix btProxy 2020-12-09 21:58:58 -05:00
idk
a6aba7b5f7 fix btProxy 2020-12-09 20:55:57 -05:00
idk
26c4152bf6 fix btProxy 2020-12-09 20:55:04 -05:00
idk
8230fe92a7 uninstall process 2020-12-09 20:53:15 -05:00
idk
6d0cda9e67 get ready to clean up after the extension when it uninstalls 2020-12-09 20:51:08 -05:00
idk
12992c461b get ready to clean up after the extension when it uninstalls 2020-12-09 20:45:49 -05:00
idk
531963c1c0 filter the headers before we search them 2020-12-09 20:13:20 -05:00
idk
8bfb7cdd27 search the headers backward and break on the first one since the non-standard header is usually near the end 2020-12-09 18:20:48 -05:00
idk
40899889a0 correct promise resolution on scripts.js 2020-12-09 17:59:53 -05:00
idk
bc88ca80fd re-enable tab-to-tab isolation 2020-12-09 17:53:31 -05:00
idk
3b3744ffff Cheat at excluding MuWire from ! 2020-12-09 17:49:36 -05:00
idk
9cd6ce888e Try and bail out of all proxy-setting in the Wire Web App 2020-12-09 17:09:54 -05:00
idk
7b2216a12f Nix timed x-i2p-torrentlocation stuff entirely 2020-12-09 16:43:08 -05:00
idk
1946669b82 pre-filter URL's for so we don't try to run isolator checks on domains that have no chance of needing isolation 2020-12-09 14:36:59 -05:00
idk
bb14021bc0 make it so we only launch containers out of firefox-default, rather than re-checking every single request 2020-12-09 14:19:59 -05:00
idk
51510abaed Merge branch 'torrent-3' into 'master'
Torrent 3

See merge request idk/I2P-in-Private-Browsing-Mode-Firefox!16
2020-12-06 18:35:18 +00:00
idk
f837eb18d5 Make it so clicking the pageaction also triggers the torrent check as a manual approach 2020-12-06 13:32:43 -05:00
idk
bf4b160dcd fmt 2020-12-06 13:01:02 -05:00
idk
7bd08ab6e0 Check whether it's a torrent-enabled site much more often. It's still not quite right but it's much better now. Update priorities when it comes as a header instead of as a meta tag 2020-12-06 13:00:11 -05:00
idk
647c0523e8 Merge branch 'torrent-3' into 'master'
Retain much tighter control of x-i2p-torrentlocation priorities

See merge request idk/I2P-in-Private-Browsing-Mode-Firefox!15
2020-12-06 17:13:52 +00:00
idk
58b874d17f Merge branch 'fix-the-search-thing' into 'master'
Fix the search thing

See merge request idk/I2P-in-Private-Browsing-Mode-Firefox!14
2020-12-06 17:11:22 +00:00
idk
969d2769fd Merge branch 'irc-integration' into 'master'
Irc integration

See merge request idk/I2P-in-Private-Browsing-Mode-Firefox!13
2020-12-06 17:07:47 +00:00
idk
d88d6b2f61 Merge branch 'bookmarks-one-time' into 'master'
Bookmarks one time

See merge request idk/I2P-in-Private-Browsing-Mode-Firefox!12
2020-12-06 17:07:04 +00:00
idk
b420dc0a28 Merge branch 'master' into 'bookmarks-one-time'
# Conflicts:
#   bookmarks.js
#   options/options.js
#   proxy.js
2020-12-06 17:06:47 +00:00
idk
0489a2774f Merge branch 'i2pbote' into 'master'
add a bote context, and when there are no more I2P browsing tabs, delete and...

See merge request idk/I2P-in-Private-Browsing-Mode-Firefox!11
2020-12-06 17:04:33 +00:00
idk
49f394acca resolve merge conflicts in proxy.js 2020-12-06 12:01:27 -05:00
idk
dd788b15ca Merge branch 'dispatch' into 'master'
Dispatch

See merge request idk/I2P-in-Private-Browsing-Mode-Firefox!10
2020-12-06 16:45:35 +00:00
idk
84981fa801 fmt 2020-12-06 11:39:50 -05:00
idk
d328dd1ca0 use an onerror event to set the fallback http url for alt torrents 2020-12-06 11:39:14 -05:00
idk
590f2c7cd8 use an onerror event to set the fallback http url for alt torrents 2020-12-06 02:31:36 -05:00
idk
e93ad94c89 Don't preload resources if we think they could be torrents 2020-12-06 02:12:01 -05:00
idk
203decf121 fix the search thing 2020-12-05 23:53:24 -05:00
idk
5ab871b51f fix the search thing 2020-12-05 23:43:37 -05:00
idk
858d03fa2b fix the search thing 2020-12-05 22:06:15 -05:00
idk
374ce51eff fmt 2020-12-03 13:17:06 -05:00
idk
cd3dafe9c8 fmt 2020-12-03 12:20:43 -05:00
idk
8c256241cb only create bookmarks on the initial run, provide option to re-create them in preferences menu 2020-12-03 12:19:58 -05:00
idk
18cc8eb962 add a bote context, and when there are no more I2P browsing tabs, delete and recreate the context to assure privacy 2020-12-01 18:07:25 -05:00
idk
f1fd2f6fb6 Fix a bug I just created 2020-11-11 01:44:09 -05:00
idk
691dff77a0 fmt 2020-11-10 22:57:33 -05:00
idk
0910986d52 add a tab layer of granularity to isolator 2020-11-10 22:56:27 -05:00
idk
8d4e38ccdf Merge branch 'dispatch' into 'master'
disable proxy on requests to self for dispatch

See merge request idk/I2P-in-Private-Browsing-Mode-Firefox!9
2020-11-11 03:03:56 +00:00
idk
e67c266ce0 disable proxy on requests to self for dispatch 2020-11-10 22:02:17 -05:00
idk
9c12df60d2 Merge branch 'dispatch' into 'master'
Dispatch

See merge request idk/I2P-in-Private-Browsing-Mode-Firefox!8
2020-11-11 02:58:10 +00:00
idk
5fb224fdfa add a prettier target 2020-11-10 21:48:08 -05:00
idk
9a0daa480d add container tab for dispatch IRC 2020-11-10 21:42:52 -05:00
idk
b041f7f8c7 add container tab for dispatch IRC 2020-11-10 21:41:13 -05:00
idk
42cb2aae64 add container tab for dispatch IRC 2020-11-10 21:04:49 -05:00
idk
449e3dbee6 add container tab for dispatch IRC 2020-11-10 20:59:25 -05:00
idk
422bfa6c18 add container tab for dispatch IRC 2020-11-10 20:59:04 -05:00
idk
f1909ec923 update release 2020-11-07 22:23:45 -05:00
idk
a3bb8a6fe9 update pages 2020-11-07 21:44:07 -05:00
idk
3596a7e6fd Merge branch 'styles' into 'master'
Styles

See merge request idk/I2P-in-Private-Browsing-Mode-Firefox!7
2020-11-08 02:41:13 +00:00
idk
1d9b3b5001 Update changelog 2020-11-07 21:37:10 -05:00
idk
cf99bde088 change font colors on search boxes 2020-11-07 02:19:37 -05:00
idk
c3d73649a0 Switch back to a simpler light theme 2020-10-30 23:50:23 -04:00
idk
a4336b105f update the css a bit 2020-10-30 22:13:42 -04:00
idk
a56bf3101d update the css a bit 2020-10-30 22:13:29 -04:00
idk
7822c7b9fe Merge branch 'i2p-torrent-location-header' into 'master'
I2p torrent location header

See merge request idk/I2P-in-Private-Browsing-Mode-Firefox!5
2020-10-31 01:40:24 +00:00
idk
15fffd25dc make the css slightly better 2020-10-30 21:31:36 -04:00
idk
1c7ec493cb make the css slightly better 2020-10-30 21:30:55 -04:00
idk
11fd9efd31 make the css slightly better 2020-10-30 20:08:11 -04:00
idk
08a1e73008 disable localhost isolator for non-routerconsole pages, I am fairly sure it's safe now 2020-10-25 02:29:15 -04:00
idk
e09546d6bb fixup the screenshot 2020-10-12 17:59:41 -04:00
idk
fa0aedda92 fixup the links replacer 2020-10-12 01:19:50 -04:00
idk
105aaed014 update fix the case for onUpdated listeners 2020-10-11 23:43:28 -04:00
idk
fff55eadd6 update fix the case for onUpdated listeners 2020-10-11 23:43:14 -04:00
idk
db43f2760a trigger meta http-equiv when tabs are updated, instantly 2020-10-09 01:03:27 -04:00
idk
ba0d4abc53 add images and videos to the content replacer script for the bittorrent-as-cdn thing 2020-10-08 23:14:48 -04:00
idk
65636c2b5e add images and videos to the content replacer script for the bittorrent-as-cdn thing 2020-10-08 22:53:18 -04:00
idk
4c2a7978f2 add images and videos to the content replacer script for the bittorrent-as-cdn thing 2020-10-08 22:51:02 -04:00
idk
7e97ab766a undo broken check 2020-10-08 00:25:38 -04:00
idk
16b1990bd9 Only excempt snark URL's from proxy if they end do not end in a backslash, and contain /snark/ 2020-10-07 20:27:43 -04:00
idk
2c7b092376 x-i2p-torrentlocation working prototype, both Header-based and meta http-equiv based 2020-10-07 16:47:22 -04:00
idk
100f27b4be fix up some flow issues, should be OK this way 2020-10-07 12:55:26 -04:00
42 changed files with 2018 additions and 1539 deletions

View File

@@ -2,251 +2,251 @@ module.exports = {
env: {
browser: true,
es6: true,
webextensions: true
webextensions: true,
},
extends: 'eslint:recommended',
extends: "eslint:recommended",
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
Atomics: "readonly",
SharedArrayBuffer: "readonly",
},
parserOptions: {
ecmaVersion: 2018
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',
"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
}
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',
"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
}
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': 'off',
'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': 'off',
'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',
"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": "off",
"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": "off",
"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
}
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': 'off',
'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': 'off',
'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': 'off',
'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-unused-vars': 'off',
'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': 'off',
'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']
}
"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": "off",
"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": "off",
"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": "off",
"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-unused-vars": "off",
"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": "off",
"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"],
},
};

View File

@@ -32,16 +32,16 @@ ls:
ls -lah $(PREFIX)/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}
clean: rc clean-artifacts
rm -fr ../i2psetproxy.js.zip ../i2p_proxy*.xpi ../i2p*.xpi *.torrent #../i2psetproxy.js_*.*
rm -fr ../i2psetproxy.js.zip ../i2p_proxy*.xpi *.torrent #../i2psetproxy.js_*.*
## EVEN RELEASES are AMO RELEASES
## ODD RELEASES are SELFHOSTED RELEASES
MOZ_VERSION=0.80
VERSION=0.79
MOZ_VERSION=0.90
VERSION=0.89
## INCREMENT THIS EVERY TIME YOU DO A RELEASE
LAST_VERSION=0.77
LAST_VERSION=0.87
YELLOW=F7E59A
ORANGE=FFC56D
@@ -201,10 +201,10 @@ getxpi:
torrent: getxpi
rm -f "./i2ppb-$(VERSION)@eyedeekay.github.io.xpi.torrent"
mktorrent -a http://zviyq72xcmjupynn5y2f5qa3u7bxyu34jnqmwt6czte2l7idxm7q.b32.i2p/announce \
mktorrent -a http://w7tpbzncbcocrqtwwm3nezhnnsw4ozadvi2hmvzdhrqzfxfum7wa.b32.i2p/a \
-a http://zviyq72xcmjupynn5y2f5qa3u7bxyu34jnqmwt6czte2l7idxm7q.b32.i2p/announce \
-a http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a \
-a http://uajd4nctepxpac4c4bdyrdw7qvja2a5u3x25otfhkptcjgd53ioq.b32.i2p/announce \
-a http://w7tpbzncbcocrqtwwm3nezhnnsw4ozadvi2hmvzdhrqzfxfum7wa.b32.i2p/a \
-a http://explodie.org:6969/announce \
-a http://tracker.opentrackr.org:1337/announce \
-a http://tracker.kamigami.org:2710/announce \
@@ -286,6 +286,9 @@ fmt-js:
fixjsstyle manifest.json
#find . -path ./node_modules -prune -o -name '*.json' -exec fixjsstyle --write {} \;
fmt-prettier:
find . -name '*.js*' -exec $(HOME)/node_modules/.bin/prettier -w {} \;
lint:
gjslint *.js; true
@@ -336,7 +339,29 @@ snark-mirror:
seed:
cp -v "./i2ppb-$(VERSION)@eyedeekay.github.io.xpi.torrent" "$(HOME)/.i2p/i2psnark"
cp -v "../i2ppb-$(VERSION)@eyedeekay.github.io.xpi" "$(HOME)/.i2p/i2psnark"
wire:
cp -v "./i2ppb-$(VERSION)@eyedeekay.github.io.xpi.torrent" "$(HOME)/i2p/MuWireDownloads/"
cp -v "../i2ppb-$(VERSION)@eyedeekay.github.io.xpi" "$(HOME)/i2p/MuWireDownloads/"
test:
web-ext run -u about:debugging \
-u http://127.0.0.1:7657/home \
-u http://127.0.0.1:7657/i2ptunnel \
-u http://127.0.0.1:7657/i2psnark \
-u http://127.0.0.1:7657/webmail \
-u http://127.0.0.1:7657/MuWire \
-u http://idk.i2p/video.html \
-u http://idk.i2p \
-u http://stats.i2p \
-u https://ramble.pw \
-u https://ramble.pw/f/i2p \
lht-test:
web-ext run -u about:debugging \
-u http://localhost:7657/home \
-u http://localhost:7657/i2ptunnel \
-u http://localhost:7657/i2psnark \
-u http://localhost:7657/webmail \
-u http://localhost:7657/MuWire/ \
-u http://idk.i2p

View File

@@ -10,6 +10,20 @@ user requests them. It also adds convenience and management features, like an
embedded I2P console and Bittorrent integration with clients using the
transmission-rpc API.
Privacy Policy
--------------
This browser extension does not collect any personal information. It requires
access to local storage and browsing data permissions in order to delete them
when directed to by the user. This browser extension does not transmit any
information to any third party, nor will it, ever.
This browser extension cannot influence telemetry carried out by browser vendors
to determine performance in their distribution channels, nor can it mitigate any
other browser vendor telemetry.
This browser extension is entirely Free, Open-Source software.
Installation(Cross-Platform):
-----------------------------
@@ -97,10 +111,11 @@ Usage:
console URL's and placing applications under their own origin.
* ![Visiting routerconsole](routerconsole.png)
* [Done] **Handle Torrents** by talking to i2psnark-rpc plugin and then
adding them directly into the Firefox downloads drop-downs, menus, etc. If I
can.
adding them directly into the Firefox downloads drop-downs, menus, etc. Enable
the use of I2PSnark as a peer-to-peer delivery mechanism for media files.
* ![Visiting i2psnark](i2psnark.png)
* ![Monitoring torrents](transmissionrpc.png)
* ![Distribute your site as a torrent.](x-i2p-torrentlocation.png)
* [Started] **Indicate** the level of authenticity provided by TLS. TLS is
optional on I2P for now, but some sites offer it anyway. TLS support is
experimental and in the works.
@@ -178,11 +193,14 @@ Project uplift seems to have largely been accomplished?
* [Tor at the Heart: Firefox](https://blog.torproject.org/tor-heart-firefox) is
a blog about Tor and the relationship they have to Firefox re: TBB, Fusion.
The Old Version
---------------
The **Other** Version
---------------------
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
New versions of this extension create an I2P in Private Browsing mode instead,
using container tabs.
Since this is a drastic change to the behavior of the old plugin, and since there
is no UI a new entry
for the new plugin has been made at a new location on addons.mozilla.org.
* This is the new version: [[link]](https://addons.mozilla.org/en-US/firefox/addon/i2p-in-private-browsing/)
@@ -192,20 +210,6 @@ for the new plugin has been made at a new location on addons.mozilla.org.
Android usage:
--------------
Open the following link
[Github Releases Version](https://github.com/eyedeekay/i2psetproxy.js/releases/)
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.
Use the old version, on either an old version of Firefox(pre-68) or by enabling
this custom collection: [Recommended Plugins] https://addons.mozilla.org/en-US/firefox/collections/14614396/I2P-Browser-Fork/
### Android addons.mozilla.org(Temporarily Disabled)
If you would prefer to recieve automatic updates from AMO, the correct product
page for this plugin is
[I2P In Private Browsing](https://addons.mozilla.org/en-US/firefox/addon/i2p-in-private-browsing/).
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.

View File

@@ -159,12 +159,20 @@
"message": "Web Browser (Private)",
"description": "Preface for the browser titlebar"
},
"localPreface": {
"message": "Localhost Browser",
"ircPreface": {
"message": "Dispatch IRC",
"description": "Preface for the browser titlebar"
},
"localPrefacePrivate": {
"message": "Localhost Browser (Private)",
"ircPrefacePrivate": {
"message": "Dispatch IRC (Private)",
"description": "Preface for the browser titlebar"
},
"botePreface": {
"message": "I2P-Bote Mail",
"description": "Preface for the browser titlebar"
},
"botePrefacePrivate": {
"message": "I2P-Bote Mail (Private)",
"description": "Preface for the browser titlebar"
},
"routerPreface": {

View File

@@ -10,10 +10,22 @@ var torrentpref = chrome.i18n.getMessage('torrentPreface');
var torrentprefpriv = chrome.i18n.getMessage('torrentPrefacePrivate');
var tunnelpref = chrome.i18n.getMessage('i2ptunnelPreface');
var tunnelprefpriv = chrome.i18n.getMessage('i2ptunnelPrefacePrivate');
var localpref = chrome.i18n.getMessage('localPreface');
var localprefpriv = chrome.i18n.getMessage('localPrefacePrivate');
var ircpref = chrome.i18n.getMessage('ircPreface');
var ircprefpriv = chrome.i18n.getMessage('ircPrefacePrivate');
var extensionpref = chrome.i18n.getMessage('extensionPreface');
var muwirepref = chrome.i18n.getMessage('muwirePreface');
var muwireprefpriv = chrome.i18n.getMessage('muwirePrefacePrivate');
var botepref = chrome.i18n.getMessage('botePreface');
function onError(err) {
console.log('(background)', err);
}
function onContextGotLog(contexts) {
if (contexts != null) {
console.log(contexts);
}
}
function onContextsGot(contexts) {
var ids = [];
@@ -27,7 +39,7 @@ function onContextsGot(contexts) {
.create({
name: titlepref,
color: 'orange',
icon: 'fingerprint'
icon: 'fingerprint',
})
.then(onCreated, onNotCreated);
}
@@ -36,7 +48,7 @@ function onContextsGot(contexts) {
.create({
name: webpref,
color: 'red',
icon: 'circle'
icon: 'circle',
})
.then(onCreated, onNotCreated);
}
@@ -45,7 +57,7 @@ function onContextsGot(contexts) {
.create({
name: routerpref,
color: 'blue',
icon: 'briefcase'
icon: 'briefcase',
})
.then(onCreated, onNotCreated);
}
@@ -54,7 +66,7 @@ function onContextsGot(contexts) {
.create({
name: tunnelpref,
color: 'green',
icon: 'tree'
icon: 'tree',
})
.then(onCreated, onNotCreated);
}
@@ -63,7 +75,7 @@ function onContextsGot(contexts) {
.create({
name: mailpref,
color: 'yellow',
icon: 'briefcase'
icon: 'briefcase',
})
.then(onCreated, onNotCreated);
}
@@ -72,25 +84,34 @@ function onContextsGot(contexts) {
.create({
name: torrentpref,
color: 'purple',
icon: 'chill'
icon: 'chill',
})
.then(onCreated, onNotCreated);
}
if (ids.indexOf(localpref) == -1) {
if (ids.indexOf(ircpref) == -1) {
browser.contextualIdentities
.create({
name: localpref,
name: ircpref,
color: 'red',
icon: 'fence'
icon: 'vacation',
})
.then(onCreated, onNotCreated);
}
if (ids.indexOf(localpref) == -1) {
if (ids.indexOf(muwirepref) == -1) {
browser.contextualIdentities
.create({
name: muwirepref,
color: 'turquoise',
icon: 'gift'
icon: 'gift',
})
.then(onCreated, onNotCreated);
}
if (ids.indexOf(botepref) == -1) {
browser.contextualIdentities
.create({
name: botepref,
color: 'blue',
icon: 'fence',
})
.then(onCreated, onNotCreated);
}
@@ -111,7 +132,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);
@@ -124,7 +145,7 @@ gettingInfo.then(got => {
function themeWindowByTab(tabId) {
function tabWindow(tab) {
var gettingPlatformInfo = browser.runtime.getPlatformInfo();
gettingPlatformInfo.then(got => {
gettingPlatformInfo.then((got) => {
if (got.os == 'android') {
let getwindow = browser.tabs.get(tab.tabId);
getwindow.then(themeWindow);
@@ -159,99 +180,76 @@ function themeWindow(window) {
function onThemeError() {
console.log('theme color set error');
}
function dynamicTheme() {
if (window.incognito) {
browser.theme.update(window.id, {
colors: {
frame: '#4456B7',
toolbar: '#4456B7',
},
});
} else {
browser.theme.update(window.id, {
colors: {
frame: '#4456B7',
toolbar: '#4456B7',
},
});
}
}
function browserTheme() {
console.log('Active in I2P window');
if (window.incognito) {
browser.theme.update(window.id, {
colors: {
frame: '#363A68',
toolbar: '#363A68',
},
});
} else {
browser.theme.update(window.id, {
colors: {
frame: '#363A68',
toolbar: '#363A68',
},
});
}
}
function logTabs(tabInfo) {
function onContextGotTheme(context) {
if (context.name == titlepref) {
console.log('Active in I2P window');
if (window.incognito) {
browser.theme.update(window.id, {
colors: {
frame: '#363A68',
toolbar: '#363A68'
}
browserTheme();
if (tabInfo[0].url.startsWith('https://')) {
browser.pageAction.setPopup({
tabId: tabInfo[0].id,
popup: 'security.html',
});
//console.log("(background) tabinfo", tabInfo[0].id)
browser.pageAction.show(tabInfo[0].id);
} else {
browser.theme.update(window.id, {
colors: {
frame: '#363A68',
toolbar: '#363A68'
}
});
//browser.pageAction.hide(tabInfo[0].id);
}
browser.pageAction.setPopup({
tabId: tabInfo[0].id,
popup: 'security.html'
});
//console.log("(background) tabinfo", tabInfo[0].id)
browser.pageAction.show(tabInfo[0].id);
} else if (context.name == routerpref) {
console.log('Active in Router Console window');
if (window.incognito) {
browser.theme.update(window.id, {
colors: {
frame: '#4456B7',
toolbar: '#4456B7'
}
});
} else {
browser.theme.update(window.id, {
colors: {
frame: '#4456B7',
toolbar: '#4456B7'
}
});
}
dynamicTheme();
} else if (context.name == tunnelpref) {
console.log('Active in Hidden Services Manager window');
if (window.incognito) {
browser.theme.update(window.id, {
colors: {
frame: '#4456B7',
toolbar: '#4456B7'
}
});
} else {
browser.theme.update(window.id, {
colors: {
frame: '#4456B7',
toolbar: '#4456B7'
}
});
}
dynamicTheme();
} else if (context.name == mailpref) {
console.log('Active in Web Mail window');
if (window.incognito) {
browser.theme.update(window.id, {
colors: {
frame: '#4456B7',
toolbar: '#4456B7'
}
});
} else {
browser.theme.update(window.id, {
colors: {
frame: '#4456B7',
toolbar: '#4456B7'
}
});
}
dynamicTheme();
} else if (context.name == torrentpref) {
console.log('Active in Bittorrent window');
if (window.incognito) {
browser.theme.update(window.id, {
colors: {
frame: '#4456B7',
toolbar: '#4456B7'
}
});
} else {
browser.theme.update(window.id, {
colors: {
frame: '#4456B7',
toolbar: '#4456B7'
}
});
}
dynamicTheme();
} else if (context.name == botepref) {
console.log('Active in Bote window');
dynamicTheme();
} else if (context.name == ircpref) {
console.log('Active in IRC window');
dynamicTheme();
} else if (context.name == muwirepref) {
console.log('Active in MuWire window');
dynamicTheme();
}
}
if (
@@ -261,13 +259,13 @@ function themeWindow(window) {
browser.contextualIdentities
.get(tabInfo[0].cookieStoreId)
.then(onContextGotTheme, onThemeError);
}else {
} else {
console.log('Not active in I2P window');
function unSetTheme(them) {
console.log('unsetting theme', them);
if (Object.keys(them).length > 0) {
browser.theme.update(window.id, them.originalTheme);
}else {
} else {
browser.theme.update(window.id, { colors: null });
}
}
@@ -277,7 +275,7 @@ function themeWindow(window) {
var querying = browser.tabs.query({
currentWindow: true,
active: true
active: true,
});
querying.then(logTabs, onThemeError);
}
@@ -287,90 +285,43 @@ function setTitle(window) {
function onContextError() {
console.log('Context Error');
}
function setTitle(title, privtitle) {
if (window.incognito) {
browser.windows.update(window.id, {
titlePreface: privtitle + ': ',
});
} else {
browser.windows.update(window.id, {
titlePreface: title + ': ',
});
}
}
function logTabs(tabInfo) {
function onContextGotTitle(context) {
if (context.name == titlepref) {
console.log('Active in I2P window');
if (window.incognito) {
browser.windows.update(window.id, {
titlePreface: titleprefpriv + ': '
});
} else {
browser.windows.update(window.id, {
titlePreface: titlepref + ': '
});
}
} else if (context.name == webpref) {
console.log('Active in Web window');
if (window.incognito) {
browser.windows.update(window.id, {
titlePreface: webprefpriv + ' - '
});
} else {
browser.windows.update(window.id, {
titlePreface: webpref + ' - '
});
}
setTitle(titlepref, titleprefpriv);
} else if (context.name == muwirepref) {
console.log('Active in MuWire window');
setTitle(muwirepref, muwireprefpriv);
} else if (context.name == routerpref) {
console.log('Active in Router Console window');
if (window.incognito) {
browser.windows.update(window.id, {
titlePreface: titleprefpriv + ' - ' + routerprefpriv + ': '
});
} else {
browser.windows.update(window.id, {
titlePreface: titlepref + ' - ' + routerpref + ': '
});
}
setTitle(routerpref, routerprefpriv);
} else if (context.name == botepref) {
console.log('Active in Bote window');
setTitle(botepref, boteprefpriv);
} else if (context.name == tunnelpref) {
console.log('Active in Hidden Services Manager window');
if (window.incognito) {
browser.windows.update(window.id, {
titlePreface: titleprefpriv + ' - ' + tunnelprefpriv + ': '
});
} else {
browser.windows.update(window.id, {
titlePreface: titlepref + ' - ' + tunnelpref + ': '
});
}
setTitle(tunnelpref, tunnelprefpriv);
} else if (context.name == mailpref) {
console.log('Active in I2P Web Mail window');
if (window.incognito) {
browser.windows.update(window.id, {
titlePreface: titleprefpriv + ' - ' + mailprefpriv + ': '
});
} else {
browser.windows.update(window.id, {
titlePreface: titlepref + ' - ' + mailpref + ': '
});
}
setTitle(mailpref, mailprefpriv);
} else if (context.name == torrentpref) {
console.log('Active in I2P Torrent window');
if (window.incognito) {
browser.windows.update(window.id, {
titlePreface: titleprefpriv + ' - ' + torrentprefpriv + ': '
});
} else {
browser.windows.update(window.id, {
titlePreface: titlepref + ' - ' + torrentpref + ': '
});
}
} else if (context.name == localpref) {
console.log('Active in Localhost window');
if (window.incognito) {
browser.windows.update(window.id, {
titlePreface: localprefpriv + ' - ' + localprefpriv + ': '
});
} else {
browser.windows.update(window.id, {
titlePreface: localpref + ' - ' + localpref + ': '
});
}
setTitle(torrentpref, torrentprefpriv);
} else if (context.name == ircpref) {
console.log('Active in IRC window');
setTitle(ircpref, ircprefpriv);
}
}
@@ -383,37 +334,37 @@ function setTitle(window) {
.then(onContextGotTitle, onContextError);
} else if (window.incognito) {
browser.windows.update(window.id, {
titlePreface: ''
titlePreface: '',
});
} else {
browser.windows.update(window.id, {
titlePreface: ''
titlePreface: '',
});
}
}
var querying = browser.tabs.query({
currentWindow: true,
active: 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(setTitle, onPlatformError);
});
browser.tabs.onActivated.addListener(() => {
var getting = browser.windows.getCurrent({
populate: true
populate: true,
});
getting.then(setTitle, onPlatformError);
});
@@ -421,24 +372,40 @@ gettingListenerInfo.then(got => {
});
function handleUpdated(updateInfo) {
function maybeSet(them){
console.log("original theme found:", them, Object.keys(them).length)
try{
if ((Object.keys(them).length == 0) || them.originalTheme.colors == null && them.originalTheme.images == null && them.originalTheme.properties == null) {
if (updateInfo.theme.colors.frame != '#4456B7' && updateInfo.theme.colors.frame != '#363A68') {
function onSet(){
console.log("stored theme:", updateInfo.theme)
}
if (updateInfo.theme.colors != null || updateInfo.theme.images != null || updateInfo.theme.properties != null ) {
console.log("storing theme:", updateInfo.theme)
browser.storage.local.set({"originalTheme": updateInfo.theme}).then(onSet, onError)
function maybeSet(them) {
console.log("original theme found:", them, Object.keys(them).length);
try {
if (
Object.keys(them).length == 0 ||
(them.originalTheme.colors == null &&
them.originalTheme.images == null &&
them.originalTheme.properties == null)
) {
if (updateInfo.theme.colors != null) {
if (
updateInfo.theme.colors.frame != "#4456B7" &&
updateInfo.theme.colors.frame != "#363A68"
) {
function onSet() {
console.log("stored theme:", updateInfo.theme);
}
if (
updateInfo.theme.colors != null &&
updateInfo.theme.images != null &&
updateInfo.theme.properties != null
) {
console.log("storing theme:", updateInfo.theme);
browser.storage.local
.set({ originalTheme: updateInfo.theme })
.then(onSet, onError);
}
}
}
} else {
console.log("keeping stored theme:", them);
}
}else{
console.log("keeping stored theme:", them)
}
}catch{
console.log("theme storage error")
} catch (e) {
console.log("theme storage error", e);
}
}
browser.storage.local.get("originalTheme").then(maybeSet, onError);
@@ -495,3 +462,24 @@ browser.webRequest.onHeadersReceived.addListener(
{ urls: ["<all_urls>"] },
["blocking", "responseHeaders"]
);
function onClosedWindowCheck() {
var getContext = browser.contextualIdentities.query({ name: titlepref });
function checkTabs(ctx) {
function conditionallyDelete(tabs) {
if (tabs.length == 0) {
browser.contextualIdentities.remove(ctx[0].cookieStoreId);
browser.contextualIdentities
.query({})
.then(onContextsGot, onContextsError);
}
}
var tabs = browser.tabs.query({ cookieStoreId: ctx[0].cookieStoreId });
tabs.then(conditionallyDelete, onError);
}
getContext.then(checkTabs, onError);
}
browser.tabs.onRemoved.addListener(onClosedWindowCheck);
browser.windows.onRemoved.addListener(onClosedWindowCheck);
browser.windows.onCreated.addListener(onClosedWindowCheck);

View File

@@ -1,213 +1,245 @@
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 port = info.value.http.split(':')[1];
if (port == '7644') {
let createRhizomeBookmark = browser.bookmarks.create({
url: 'about:I2p',
title: 'I2P Extension Home Page',
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
});
createBookmark.then(onCreated);
function bookmarksSetup() {
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then((got) => {
if (got.os != 'android') {
function bookmarks(bookmarkToolbar) {
console.log('(bookmarks)', bookmarkToolbar);
console.log('Setting up bookmark toolbar', bookmarkToolbar);
function bookHome(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let port = info.value.http.split(':')[1];
if (port == '7644') {
let createRhizomeBookmark = browser.bookmarks.create({
url: 'about:I2p',
title: 'I2P Extension Home Page',
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,
});
createBookmark.then(onCreated);
}
console.log('(bookmarks) adding home page bookmark');
}
console.log('(bookmarks) adding home page bookmark');
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
let gettingProxyInfo = browser.proxy.settings.get({});
gettingProxyInfo.then(gotProxyInfo);
}
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
let gettingProxyInfo = browser.proxy.settings.get({});
gettingProxyInfo.then(gotProxyInfo);
}
}
function bookTorrent(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let port = info.value.http.split(':')[1];
if (port == '7644') {
let createBookmark = browser.bookmarks.create({
url: 'http://localhost:7657/i2psnark',
title: 'Bittorrent',
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
} else {
let createRhizomeBookmark = browser.bookmarks.create({
url:
'http://' + control_host + ':' + control_port + '/i2psnark',
title: 'Bittorrent',
parentId: bookmarkToolbar[0].id
});
createRhizomeBookmark.then(onCreated);
function bookTorrent(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let port = info.value.http.split(':')[1];
if (port == '7644') {
let createBookmark = browser.bookmarks.create({
url: 'http://localhost:7657/i2psnark',
title: 'Bittorrent',
parentId: bookmarkToolbar[0].id,
});
createBookmark.then(onCreated);
} else {
let createRhizomeBookmark = browser.bookmarks.create({
url:
'http://' + control_host + ':' + control_port + '/i2psnark',
title: 'Bittorrent',
parentId: bookmarkToolbar[0].id,
});
createRhizomeBookmark.then(onCreated);
}
}
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
let gettingProxyInfo = browser.proxy.settings.get({});
gettingProxyInfo.then(gotProxyInfo);
}
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
let gettingProxyInfo = browser.proxy.settings.get({});
gettingProxyInfo.then(gotProxyInfo);
}
}
function bookConsole(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let port = info.value.http.split(':')[1];
if (port == '7644') {
let createBookmark = browser.bookmarks.create({
url: 'http://localhost:7657/home',
title: 'I2P Console',
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
} else {
let createRhizomeBookmark = browser.bookmarks.create({
url: 'http://' + control_host + ':' + control_port + '/home',
title: 'I2P Console',
parentId: bookmarkToolbar[0].id
});
createRhizomeBookmark.then(onCreated);
function bookConsole(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let port = info.value.http.split(':')[1];
if (port == '7644') {
let createBookmark = browser.bookmarks.create({
url: 'http://localhost:7657/home',
title: 'I2P Console',
parentId: bookmarkToolbar[0].id,
});
createBookmark.then(onCreated);
} else {
let createRhizomeBookmark = browser.bookmarks.create({
url: 'http://' + control_host + ':' + control_port + '/home',
title: 'I2P Console',
parentId: bookmarkToolbar[0].id,
});
createRhizomeBookmark.then(onCreated);
}
}
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
let gettingProxyInfo = browser.proxy.settings.get({});
gettingProxyInfo.then(gotProxyInfo);
}
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
let gettingProxyInfo = browser.proxy.settings.get({});
gettingProxyInfo.then(gotProxyInfo);
}
}
function bookMail(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let port = info.value.http.split(':')[1];
if (port == '7644') {
let createBookmark = browser.bookmarks.create({
url: 'http://localhost:7657/webmail',
title: 'Web Mail',
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
} else {
let createRhizomeBookmark = browser.bookmarks.create({
url: 'http://' + control_host + ':' + control_port + '/webmail',
title: 'Web Mail',
parentId: bookmarkToolbar[0].id
});
createRhizomeBookmark.then(onCreated);
function bookMail(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let port = info.value.http.split(':')[1];
if (port == '7644') {
let createBookmark = browser.bookmarks.create({
url: 'http://localhost:7657/webmail',
title: 'Web Mail',
parentId: bookmarkToolbar[0].id,
});
createBookmark.then(onCreated);
} else {
let createRhizomeBookmark = browser.bookmarks.create({
url:
'http://' + control_host + ':' + control_port + '/webmail',
title: 'Web Mail',
parentId: bookmarkToolbar[0].id,
});
createRhizomeBookmark.then(onCreated);
}
console.log('(bookmarks) adding webmail bookmark');
}
console.log('(bookmarks) adding webmail bookmark');
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
let gettingProxyInfo = browser.proxy.settings.get({});
gettingProxyInfo.then(gotProxyInfo);
}
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
let gettingProxyInfo = browser.proxy.settings.get({});
gettingProxyInfo.then(gotProxyInfo);
}
}
function bookI2PTunnel(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let port = info.value.http.split(':')[1];
if (port == '7644') {
var createBookmark = browser.bookmarks.create({
url: 'http://localhost:7657/i2ptunnel',
title: 'Hidden Services Manager',
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
} else {
var createRhizomeBookmark = browser.bookmarks.create({
url:
'http://' + control_host + ':' + control_port + '/i2ptunnel',
title: 'Hidden Services Manager',
parentId: bookmarkToolbar[0].id
});
createRhizomeBookmark.then(onCreated);
function bookI2PTunnel(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let port = info.value.http.split(':')[1];
if (port == '7644') {
var createBookmark = browser.bookmarks.create({
url: 'http://localhost:7657/i2ptunnel',
title: 'Hidden Services Manager',
parentId: bookmarkToolbar[0].id,
});
createBookmark.then(onCreated);
} else {
var createRhizomeBookmark = browser.bookmarks.create({
url:
'http://' +
control_host +
':' +
control_port +
'/i2ptunnel',
title: 'Hidden Services Manager',
parentId: bookmarkToolbar[0].id,
});
createRhizomeBookmark.then(onCreated);
}
console.log('(bookmarks) adding i2ptunnel bookmark');
}
console.log('(bookmarks) adding i2ptunnel bookmark');
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
var gettingProxyInfo = browser.proxy.settings.get({});
gettingProxyInfo.then(gotProxyInfo);
}
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
var gettingProxyInfo = browser.proxy.settings.get({});
gettingProxyInfo.then(gotProxyInfo);
}
function onRejected(error) {
console.log(`An error : ${error}`);
}
function onCreated(node) {
console.log('Bookmarked', node);
}
var b0 = browser.bookmarks.search({
title: 'I2P Extension 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 b4 = browser.bookmarks.search({
title: 'I2P Console',
});
b4.then(bookConsole, onRejected);
defaultSettings['bookmarks_state'] = true;
}
var bt = browser.bookmarks.search({
query: 'Toolbar',
});
function toolDir(bookmarkToolbar) {
let defaultSettings = {};
chrome.storage.local.set(defaultSettings);
console.log('(bookmarks) created');
var ibbt = browser.bookmarks.search('I2P Toolbar');
function setupDir(ibbt) {
function onToolbarCreated(node) {
var ibt = browser.bookmarks.search('I2P Toolbar');
ibt.then(bookmarks);
}
if (ibbt[0] == null) {
let createBookmark = browser.bookmarks.create({
title: 'I2P Toolbar',
parentId: bookmarkToolbar[0].id,
});
createBookmark.then(onToolbarCreated);
}
}
ibbt.then(setupDir);
}
bt.then(toolDir);
function handleCreated(id, bookmarkInfo) {
//var propValue;
for (var propName in bookmarkInfo) {
let propValue = bookmarkInfo[propName];
console.log(propName, propValue);
}
}
function onRejected(error) {
console.log(`An error : ${error}`);
}
function onCreated(node) {
console.log('Bookmarked', node);
}
var b0 = browser.bookmarks.search({
title: 'I2P Extension 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 b4 = browser.bookmarks.search({
title: 'I2P Console'
});
b4.then(bookConsole, onRejected);
browser.bookmarks.onCreated.addListener(handleCreated);
}
});
}
var bt = browser.bookmarks.search({
query: 'Toolbar'
});
function toolDir(bookmarkToolbar) {
var ibbt = browser.bookmarks.search('I2P Toolbar');
function setupDir(ibbt) {
function onToolbarCreated(node) {
var ibt = browser.bookmarks.search('I2P Toolbar');
ibt.then(bookmarks);
}
if (ibbt[0] == null) {
let createBookmark = browser.bookmarks.create({
title: 'I2P Toolbar',
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onToolbarCreated);
}
}
ibbt.then(setupDir);
}
bt.then(toolDir);
function handleCreated(id, bookmarkInfo) {
//var propValue;
for (var propName in bookmarkInfo) {
let propValue = bookmarkInfo[propName];
console.log(propName, propValue);
}
}
browser.bookmarks.onCreated.addListener(handleCreated);
function conditionalBookmarksSetup(obj) {
console.log('(bookmarks) state', obj.bookmarks_state);
if (obj.bookmarks_state == false) {
bookmarksSetup();
}
});
if (obj.bookmarks_state == undefined) {
bookmarksSetup();
}
}
if (browser != null) {
let gettingStorage = browser.storage.local.get('bookmarks_state');
gettingStorage.then(conditionalBookmarksSetup, bookmarksSetup);
}
const bookmarksButton = document.getElementById('bookmarksButton');
if (bookmarksButton != null) {
bookmarksButton.addEventListener('click', bookmarksSetup);
}

View File

@@ -35,7 +35,7 @@ function tabCheck(tabInfo) {
if (host.startsWith('https')) {
contentUpdateById('AddressCertInfo', 'certPresent');
console.log('(cert) initiating request to check server cert');
fetch(host).then(response => {
fetch(host).then((response) => {
console.log('Updating cert information', response);
});
} else {

View File

@@ -48,7 +48,6 @@ contentUpdateById('sources', 'sources');
contentUpdateById('window-visit-releases', 'windowVisitReleases');
contentUpdateById('releases', 'releases');
fetch('http://proxy.i2p').then(myJson => {
console.log('FETCH RESULT', myJson);
fetch('http://proxy.i2p').then((myJson) => {
contentUpdateById('proxy-check', 'proxySuccessStatus');
});

View File

@@ -11,22 +11,22 @@ function eventHandler(event) {
browser.tabs.create({
windowId: windowInfo.id,
url: 'about:blank',
cookieStoreId: event.target.dataset.identity
cookieStoreId: event.target.dataset.identity,
});
}
if (event.target.dataset.action == 'create') {
var creating = browser.tabs.create({
cookieStoreId: event.target.dataset.identity
cookieStoreId: event.target.dataset.identity,
});
creating.then(onCreated, onError);
}
if (event.target.dataset.action == 'close-all') {
browser.tabs
.query({
cookieStoreId: event.target.dataset.identity
cookieStoreId: event.target.dataset.identity,
})
.then(tabs => {
browser.tabs.remove(tabs.map(rem => rem.id));
.then((tabs) => {
browser.tabs.remove(tabs.map((rem) => rem.id));
});
}
event.preventDefault();
@@ -52,9 +52,9 @@ if (browser.contextualIdentities === undefined) {
} else {
browser.contextualIdentities
.query({
name: titlepref
name: titlepref,
})
.then(identities => {
.then((identities) => {
if (!identities.length) {
div.innerText = "No identities returned from the API.";
return;
@@ -62,7 +62,7 @@ if (browser.contextualIdentities === undefined) {
for (let identity of identities) {
let row = document.createElement("div");
let span = document.createElement("span");
let span = document.createElement("div");
span.className = "identity";
span.innerText = identity.name;
span.style = `color: ${identity.color}`;

30
debian/changelog vendored
View File

@@ -1,3 +1,33 @@
i2psetproxy.js (0.87-1) UNRELEASED; urgency=low
* Disable searching for i2p sites in non-i2p search engines
* Add contexts for i2pbote and Dispatch
* Remain in tighter control of x-i2p-torrentlocation priority
-- idk <hankhill19580@gmail.com> Sat, 10 NOV 2020 1:33:50 -0400
i2psetproxy.js (0.85-1) UNRELEASED; urgency=low
* Fix a bug which was causing i2psnark to fail to isolate.
-- idk <hankhill19580@gmail.com> Sat, 10 NOV 2020 1:33:50 -0400
i2psetproxy.js (0.83-1) UNRELEASED; urgency=low
* Add a tab for I2P-Native Dispatch
-- idk <hankhill19580@gmail.com> Sat, 10 NOV 2020 22:00:01 -0400
i2psetproxy.js (0.81-1) UNRELEASED; urgency=low
* X-I2P-TorrentLocation header
* Visual tweaks
* Deprecate localhost browser container permanently
* Isolation rules improvements
-- idk <hankhill19580@gmail.com> Sat, 07 NOV 2020 21:34:25 -0400
i2psetproxy.js (0.79-1) UNRELEASED; urgency=low
* Pin application tabs to the front of the tab order

View File

@@ -1,7 +1,9 @@
function routerHost(url) {
// console.log("(urlcheck) HANDLER URL CHECK");
let hostname = '';
let path = '';
function pathcheck(str) {
// console.log("(urlcheck) HANDLER PATH CHECK", str);
if (str != undefined) {
let final = str.split('/')[0];
if (final === 'i2ptunnelmgr' || final === 'i2ptunnel') {
@@ -11,7 +13,8 @@ function routerHost(url) {
final === 'i2psnark' ||
final === 'torrents' ||
final.startsWith('transmission') ||
final.startsWith('tracker')
final.startsWith('tracker') ||
url.includes(':7662')
) {
console.log('(urlcheck) Torrent application path', final);
return 'i2psnark';
@@ -20,8 +23,13 @@ function routerHost(url) {
return 'webmail';
} else if (final.startsWith('MuWire')) {
if (!url.includes('.png')) {
console.log('(urlcheck) MuWire application path', final);
return 'muwire';
console.log('(urlcheck) MuWire application path', final);
return 'muwire';
}
} else if (final.startsWith('i2pbote')) {
if (!url.includes('.png')) {
console.log('(urlcheck) I2PBote application path', final);
return 'i2pbote';
}
} else if (
final === 'home' ||
@@ -101,9 +109,8 @@ var handlerSetup = function(requestDetails) {
}
return requestDetails;
};
browser.webRequest.onBeforeRequest.addListener(
handlerSetup,
{ urls: ['<all_urls>'] },
['blocking']
);
/*
browser.webRequest.onBeforeRequest.addListener(handlerSetup, {
urls: ['<all_urls>'],
});
*/

View File

@@ -1,23 +1,20 @@
* {
padding: 0;
background: #1f1a24;
color: #e6e6e7;
color: #1f1a24;
margin: 0
}
a,
button {
color: #3b6bbf;
color: #1f1a24;
text-decoration: none;
background: none;
font-weight: 700;
word-wrap: break-word;
outline: 0;
padding: 3px;
display: inline-block;
margin: auto
}
.applicationDesc {
color: #e6e6e7;
text-decoration: none;
font-weight: 700;
word-wrap: break-word;
@@ -39,7 +36,6 @@ button {
text-decoration: none;
font-weight: 700;
word-wrap: break-word;
width: 90%;
outline: 0
}
body {
@@ -48,14 +44,12 @@ body {
font-family: "Droid Sans","Noto Sans",Ubuntu,"Segoe UI","Lucida Grande",Verdana,Helvetica,sans-serif;
margin: 0 auto;
padding: 0;
color: #e6e6e7;
text-decoration: none;
font-weight: 700;
word-wrap: break-word;
outline: 0
}
.button-list {
display: inline-flex;
min-height: 230px;
min-width: 230px
}
@@ -67,7 +61,6 @@ p {
font-size: 17px;
font-family: "Droid Sans","Noto Sans",Ubuntu,"Segoe UI","Lucida Grande",Verdana,Helvetica,sans-serif;
text-decoration: none;
color: #e6e6e7;
font-weight: 700;
word-wrap: break-word;
outline: 0
@@ -78,7 +71,7 @@ p {
margin: 1.5rem;
display: block;
border-radius: 2px;
min-width: 95%
min-width: 100%
}
#header,
.application-info,
@@ -90,7 +83,7 @@ p {
margin-top: 1.5rem;
display: block;
border-radius: 2px;
min-width: 95%
min-width: 100%
}
h1 {
margin: auto;
@@ -98,6 +91,8 @@ h1 {
font-weight: 600;
font-size: 32px;
color: #e6e6e7;
background: #1f1a24;
width: 100%;
border-radius: 2px 2px 0 0
}
h2,
@@ -108,7 +103,8 @@ h3 {
font-size: 25px;
color: #e6e6e7;
border-radius: 2px 2px 0 0;
width: 90%;
background: #1f1a24;
width: 100%;
padding-left: 5%
}
h4 {
@@ -118,7 +114,8 @@ h4 {
font-size: 20px!important;
color: #41465f;
border-radius: 2px 2px 0 0;
width: 90%;
background: #1f1a24;
width: 100%;
padding-left: 5%
}
.showhider {
@@ -126,7 +123,6 @@ h4 {
font-family: "Droid Sans","Noto Sans",Ubuntu,"Segoe UI","Lucida Grande",Verdana,Helvetica,sans-serif;
border: none;
padding: 0!important;
width: 90%;
color: #3b6bbf;
text-decoration: none;
font-weight: 700;
@@ -144,12 +140,16 @@ h4 {
}
ul {
margin: auto;
width: 85vw;
border-radius: 2px
border-radius: 2px;
width: 100%;
margin: 0;
padding: 0
}
li {
display: block;
text-align: center
text-align: center;
margin: 0;
padding: 0
}
.center {
display: block;
@@ -264,20 +264,18 @@ button.applicationName {
}
img {
max-width: 100%;
width: 90%;
margin: 3%
}
img.readyness {
height: 100%;
width: auto
}
@media only screen and (max-width: 399px) {
.application-info {
display: none
}
input {
color: #1f1a24
}
@media only screen and (max-height: 399px) {
body {
flex-direction: row
}
#hidden {
display: none
}
.hidden {
display: none
}

View File

@@ -131,11 +131,11 @@
</li>
<li class="application">
<a href="http://gittest.i2p/idk/I2P-in-Private-Browsing-Mode-Firefox" id="window-visit-sources">Source Code:</a> <span class="applicationDesc" id="sources">Browse the source of this webextension or contribute here.</span>
<a href="http://git.idk.i2p/idk/I2P-in-Private-Browsing-Mode-Firefox" id="window-visit-sources">Source Code:</a> <span class="applicationDesc" id="sources">Browse the source of this webextension or contribute here.</span>
</li>
<li class="application">
<a href="http://gittest.i2p/idk/I2P-in-Private-Browsing-Mode-Firefox/-/releases" id="window-visit-releases">Releases:</a> <span class="applicationDesc" id="releases">Check for new releases here.</span>
<a href="http://git.idk.i2p/idk/I2P-in-Private-Browsing-Mode-Firefox/-/releases" id="window-visit-releases">Releases:</a> <span class="applicationDesc" id="releases">Check for new releases here.</span>
</li>
</ul>

View File

@@ -1,4 +1,4 @@
document.addEventListener('click', clickEvent => {
document.addEventListener('click', (clickEvent) => {
if (clickEvent.target.id === 'onboardingButtonZero') {
flipVisibility('onboardingContentZero');
} else if (clickEvent.target.id === 'onboardingButtonOne') {

41
host.js
View File

@@ -46,7 +46,24 @@ function extensionHost(url) {
function i2pHostName(url) {
let hostname = '';
if (url.indexOf('://') > -1) {
console.log('(hosts)', url);
if (url.includes('=')) {
if (url.includes('.i2p')) {
lsit = url.split('=');
for (let item in lsit) {
var items = lsit[item].split(`\ % `); //"\%")
for (let p in items) {
if (items[p].includes('.i2p')) {
hostname = items[p].replace('3D', 1);
}
break;
}
if (hostname != '') {
break;
}
}
}
} else if (url.indexOf('://') > -1) {
hostname = url.split('/')[2];
} else {
hostname = url.split('/')[0];
@@ -60,6 +77,7 @@ function i2pHost(url) {
}
function routerHost(url) {
// console.log("(urlcheck) HOST URL CHECK");
let hostname = '';
let path = '';
function pathcheck(str) {
@@ -72,7 +90,8 @@ function routerHost(url) {
final === 'i2psnark' ||
final === 'torrents' ||
final.startsWith('transmission') ||
final.startsWith('tracker')
final.startsWith('tracker') ||
url.includes(':7662')
) {
console.log('(urlcheck) Torrent application path', final);
return 'i2psnark';
@@ -81,8 +100,13 @@ function routerHost(url) {
return 'webmail';
} else if (final.startsWith('MuWire')) {
if (!url.includes('.png')) {
console.log('(urlcheck) MuWire application path', final);
return 'muwire';
console.log('(urlcheck) MuWire application path', final);
return 'muwire';
}
} else if (final.startsWith('i2pbote')) {
if (!url.includes('.png')) {
console.log('(urlcheck) I2PBote application path', final);
return 'i2pbote';
}
} else if (
final === 'home' ||
@@ -111,15 +135,6 @@ function routerHost(url) {
if (hostname === control_host + ':' + control_port) {
return pathcheck(path);
}
if (hostname === control_host + ':' + '7662') {
return pathcheck(path);
}
if (hostname === 'localhost' + ':' + '7662') {
return pathcheck(path);
}
if (hostname === '127.0.0.1' + ':' + '7662') {
return pathcheck(path);
}
if (hostname === 'localhost' + ':' + control_port) {
return pathcheck(path);
}

View File

@@ -27,11 +27,11 @@ function send(
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
},
redirect: 'follow', // manual, *follow, error
referrerPolicy: 'no-referrer', // no-referrer, *client
body: requestBody // body data type must match "Content-Type" header
body: requestBody, // body data type must match "Content-Type" header
};
const response = await fetch(url, opts);
return await response.json(); // parses JSON response into native JavaScript objects

View File

@@ -1,36 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>I2P in Private Browsing Mode</title>
<link rel="stylesheet" type="text/css" href="home.css" />
<link rel="stylesheet" type="text/css" href="sidebar.css" />
<title>I2P in Private Browsing Mode</title>
<link href="home.css" rel="stylesheet" type="text/css">
<link href="sidebar.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>I2P in Private Browsing Mode(Firefox-Only)</h1>
<h1>I2P in Private Browsing Mode(Firefox-Only)</h1>
<p>This is an webextension which introduces a set of new "Private Browsing" modes
to Firefox-based browsers(Supporting webextensions) that makes it easier to
configure a browser to use I2P securely and adds features for making I2P
applications easier to use. It does this by isolating I2P-specific settings to
Contextual Identities within Firefox, then loading them automatically when the
user requests them. It also adds convenience and management features, like an
embedded I2P console and Bittorrent integration with clients using the
transmission-rpc API.</p>
<p>This is an webextension which introduces a set of new "Private Browsing" modes to Firefox-based browsers(Supporting webextensions) that makes it easier to configure a browser to use I2P securely and adds features for making I2P applications easier to use. It does this by isolating I2P-specific settings to Contextual Identities within Firefox, then loading them automatically when the user requests them. It also adds convenience and management features, like an embedded I2P console and Bittorrent integration with clients using the transmission-rpc API.</p>
<h2>Installation(Cross-Platform):</h2>
<h2>Privacy Policy</h2>
<p>For desktop users this addon is available from addons.mozilla.org, where you
will be able to recive automatic updates:
<a href="https://addons.mozilla.org/en-US/firefox/addon/i2p-in-private-browsing/">I2P in Private Browsing</a>.</p>
<p>This browser extension does not collect any personal information. It requires access to local storage and browsing data permissions in order to delete them when directed to by the user. This browser extension does not transmit any information to any third party, nor will it, ever.</p>
<h2>Debian Installation:</h2>
<p>This browser extension cannot influence telemetry carried out by browser vendors to determine performance in their distribution channels, nor can it mitigate any other browser vendor telemetry.</p>
<p>Should you prefer, it is possible to install this extension system-wide by
side-loading it into Debian. You can generate your own deb file by running the
command:</p>
<p>This browser extension is entirely Free, Open-Source software.</p>
<pre><code> make deb
<h2>Installation(Cross-Platform):</h2>
<p>For desktop users this addon is available from addons.mozilla.org, where you will be able to recive automatic updates: <a href="https://addons.mozilla.org/en-US/firefox/addon/i2p-in-private-browsing/">I2P in Private Browsing</a>.</p>
<h2>Debian Installation:</h2>
<p>Should you prefer, it is possible to install this extension system-wide by side-loading it into Debian. You can generate your own deb file by running the command:</p>
<pre><code> make deb
</code></pre>
<p>and then you can install it with:</p>
<pre><code> sudo apt install ../i2psetproxy.js_*.deb
</code></pre>
@@ -40,7 +38,7 @@ command:</p>
<ul>
<li>
<a href="magnet:?xt=urn:btih:5f45673bc107ec42a8b4d02aa4d5d7487949fc66">Magnet Link</a>
<a href="magnet:?xt=urn:btih:517e97aeb8ad60357d693c37fbc5a3f4eb9ac224">Magnet Link</a>
</li>
<li>
@@ -107,7 +105,7 @@ command:</p>
<li><img alt="Visiting routerconsole" src="routerconsole.png" title="">
</li>
<li>[Done] <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>
<li>[Done] <strong>Handle Torrents</strong> by talking to i2psnark-rpc plugin and then adding them directly into the Firefox downloads drop-downs, menus, etc. Enable the use of I2PSnark as a peer-to-peer delivery mechanism for media files.</li>
<li><img alt="Visiting i2psnark" src="i2psnark.png" title="">
</li>
@@ -115,6 +113,9 @@ command:</p>
<li><img alt="Monitoring torrents" src="transmissionrpc.png" title="">
</li>
<li><img alt="Distribute your site as a torrent." src="x-i2p-torrentlocation.png" title="">
</li>
<li>[Started] <strong>Indicate</strong> the level of authenticity provided by TLS. TLS is optional on I2P for now, but some sites offer it anyway. TLS support is experimental and in the works.</li>
<li>[Started] <strong>Provide</strong> alternate, in-I2P destinations for web sites that want to mirror their content within I2P.</li>
@@ -198,9 +199,11 @@ command:</p>
</li>
</ul>
<h2>The Old Version</h2>
<h2>The <strong>Other</strong> Version</h2>
<p>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.</p>
<p>New versions of this extension create an I2P in Private Browsing mode instead, using container tabs.</p>
<p>Since this is a drastic change to the behavior of the old plugin, and since there is no UI a new entry for the new plugin has been made at a new location on addons.mozilla.org.</p>
<ul>
<li>
@@ -214,194 +217,6 @@ command:</p>
<h2>Android usage:</h2>
<p>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.</p>
<h3>Android addons.mozilla.org(Temporarily Disabled)</h3>
<h2>Bittorrent Download:</h2>
<p>The self-hosted plugin is available from bittorrent both within the I2P and
Clearnet Bittorrent network(With a web seed to support it in case one goes
dead).</p>
<ul>
<li><a href="magnet:?xt=urn:btih:61dcc15f0363cb027ed7d56a9dcff3408dfdf9c4">Magnet Link</a></li>
<li><a href="./i2ppb@eyedeekay.github.io.xpi.torrent">Get the .torrent file</a></li>
</ul>
<h2>Usage:</h2>
<ul>
<li>Basically, it "Just Works." After you install the plugin, browsing to an I2P
domain will automatically stop the current tab and re-open the I2P site in an
I2P Browser tab.</li>
<li>Besides that, four bookmarks are added to the "Bookmarks Toolbar," which
will take you to visit your Java I2P applications, or the "Simplified I2P
Landing Page" embedded in the plugin:</li>
<li><img src="lander.png" alt="Landing page" title="" /></li>
<li>Also, there's a menu for accessing I2P functionality while you're browsing.
It lets you control a few settings in a granular way.</li>
<li><img src="menu.png" alt="Menu" title="" /></li>
<li>You can re-enable WebRTC but force it to always use the proxy that is
enforced by the tab.</li>
<li>You can either force the browser to delete all history for I2P sites
immediately, or you can close all your I2P Browser tabs at once and delete
the history for I2P browsing when you're done.</li>
<li>That's all there is to it! Your browser is configured to safely use and
administer I2P.</li>
<li>Optionally, you can add I2PSnark-RPC and use Bittorrent-over-I2P via the
transmission-rpc interface. To do this, have a look at the torrent guide:
<a href="torrent/index.html">Torrent guide</a></li>
</ul>
<h3>Features</h3>
<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><img src="i2psetproxy.js.png" alt="Visiting i2p-projekt.i2p" title="" /></li>
<li>[done] <strong>Indicate</strong> the I2P browser is in use visually. Find an
acceptable way to indicate it on Android.</li>
<li><img src="susimail.png" alt="Visiting webmail" title="" /></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] <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><img src="i2ptunnel.png" alt="Visiting i2ptunnel" title="" /></li>
<li>[ready] <strong>Provide</strong> help in a variety of languages.</li>
<li>[done] <strong>Monitor</strong> 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.</li>
<li><img src="toopie.png" alt="Visiting toopie.html" title="" /></li>
<li>[Done] <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><img src="routerconsole.png" alt="Visiting routerconsole" title="" /></li>
<li>[Done] <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>
<li><img src="i2psnark.png" alt="Visiting i2psnark" title="" /></li>
<li><img src="transmissionrpc.png" alt="Monitoring torrents" title="" /></li>
<li>[Started] Indicate the level of authenticity provided by TLS. TLS is
optional on I2P for now, but some sites offer it anyway. TLS support is
experimental and in the works.</li>
<li>[barely started] <strong>Isolate</strong> traffic by contextual identity to it's own HTTP
Proxy tunnel, each reflecting it's own pseudonymous identity within I2P. The
contextual identities. For now, the contextual identities used to manage
browsing are "I2P Browsing" and "Web Browsing" where I2P Browsing is capable
of using an outproxy but in the case of traffic destined for the clearnet
does not do header rewriting, and Web Browsing falls back to the Proxy
configured in Firefox. The I2P Browsing will be expanded to
<ul>
<li>I2P Amnesiac Browsing: Use for General Browsing, stores no history and
uses an HTTP Proxy with a very short tunnel-close timeout and no key-reuse.</li>
<li>I2P Social Networking: Use this for logging into social network accounts,
forums, and other interactive asynchronous public communication platforms
where your identity is behaviorally linkable. This has a very long
tunnel-close timeout and key-reuse until specifically invoked.</li>
<li>I2P Blogging: Use this for posting content to the web interface of your
blog or to other similar websites that you create content on.</li>
</ul></li>
<li><img src="clearweb.png" alt="Visiting clearweb" title="" /></li>
</ul>
<h3>Video</h3>
<ul>
<li><img src="i2psetproxy.js.gif" alt="Video of the plugin in action" title="" /></li>
</ul>
<h2>Documents</h2>
<ul>
<li><strong><a href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases/download/docs/Browser.Design.Documentation.pdf">Browser Outline</a></strong>: This document is an outline of each of
the browser extension's feature panels in presentation form.</li>
<li><strong><a href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases/download/docs/Landing.Page.Documentation.pdf">Smart Lander Design</a></strong>: This is the original outline of
the smart landing page which became the I2P home page within the browser and
the drop-down control panel.</li>
<li><strong><a href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/wiki/Other-Extensions">Other extensions</a></strong>: and how they work with this one.</li>
</ul>
<h2>Super Extra Important Background Info:</h2>
<p>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.</p>
<h3>Links about Project Uplift</h3>
<ul>
<li><a href="https://wiki.mozilla.org/Security/Tor_Uplift">Tor Uplift</a> is a project which
brings important features of the Tor Browser to the mainstream of Firefox
users by including patches from Tor Browser Bundle into Firefox where it is
appropriate.</li>
<li><a href="https://wiki.mozilla.org/Security/FirstPartyIsolation">First Party Isolation</a>
is a feature in Firefox and other browsers which keeps information from
leaking across first-party domains.</li>
<li><a href="https://wiki.mozilla.org/Security/Fingerprinting">Fingerprinting</a> is a
technique where a tracker attempts to extract unique information about a user
from a side-channel in order to create an identifier that can be used to
correlate the user across many sites.</li>
<li><a href="https://wiki.mozilla.org/Security/Fennec%2BTor_Project">Fennec</a> is Firefox
for Android and this link has some analysis of the privacy consequences of the
Android platform.</li>
<li><a href="https://wiki.mozilla.org/Security/Tor_Uplift/Tracking">Tracking</a> in Firefox
is surveyed here.</li>
</ul>
<p>Project uplift seems to have largely been accomplished?</p>
<h3>Links about Project Fusion</h3>
<ul>
<li><a href="https://wiki.mozilla.org/Security/Fusion">Project Fusion</a> or Firefox using
Onions is a joint Mozilla/Tor effort to create an enhanced Private Browsing
mode for Firefox which uses Tor.</li>
<li><a href="https://trac.torproject.org/projects/tor/wiki/org/meetings/2018Rome/Notes/FusionProject">Notes</a>
from a meeting about Fusion.</li>
<li><a href="https://blog.torproject.org/tor-heart-firefox">Tor at the Heart: Firefox</a> is
a blog about Tor and the relationship they have to Firefox re: TBB, Fusion.</li>
</ul>
<h2>The Old Version</h2>
<p>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.</p>
<ul>
<li><p>This is the new version: <a href="https://addons.mozilla.org/en-US/firefox/addon/i2p-in-private-browsing/">[link]</a></p></li>
<li><p>This is the old version: <a href="https://addons.mozilla.org/en-US/firefox/addon/I2P-Proxy/">[link]</a></p></li>
</ul>
<h2>Android usage:</h2>
<p>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.</p>
<h3>Android addons.mozilla.org(Temporarily Disabled)</h3>
<p>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.</p>
<p>Use the old version, on either an old version of Firefox(pre-68) or by enabling this custom collection: [Recommended Plugins] https://addons.mozilla.org/en-US/firefox/collections/14614396/I2P-Browser-Fork/</p>
</body>
</html>

View File

@@ -1,12 +1,20 @@
body,
html {
width: 450px
}
.panel {
margin: 5px
margin: 5px;
width: 450px;
height: 450px
}
.panel-section-header {
width: 450px
}
#text-section-torrents-header {
width: 450px
}
span.identity {
width: 100px;
width: 450px;
display: block;
margin-left: 1em
}
@@ -51,5 +59,8 @@ img.readyness {
display: none
}
.torrent-progress {
width: 100%
width: 90%
}
.tabicon {
width: 32px
}

80
info.js
View File

@@ -1,6 +1,6 @@
function checkPeerConnection() {
let getting = browser.privacy.network.peerConnectionEnabled.get({});
getting.then(got => {
getting.then((got) => {
let webrtc = got.value;
console.log('checking webrtc', webrtc);
if (document.getElementById('enable-web-rtc') !== null)
@@ -14,7 +14,7 @@ function checkSnowflake() {
try {
function snowflake(snowflake) {
console.log("snowflake plugin found, leaving WebRTC alone", snowflake);
EnablePeerConnection();
AssurePeerConnection();
}
var snowflakeInfo = browser.management.get(
"{b11bea1f-a888-4332-8d8a-cec2be7d24b9}" // string
@@ -29,7 +29,7 @@ checkSnowflake();
function checkHistory() {
let getting = browser.storage.local.get("disable_history");
getting.then(got => {
getting.then((got) => {
let disable_history = got.disable_history;
if (disable_history == undefined) {
disable_history = false;
@@ -42,11 +42,11 @@ function checkHistory() {
checkHistory();
document.addEventListener("click", clickEvent => {
document.addEventListener("click", (clickEvent) => {
if (clickEvent.target.id === "window-create-help-panel") {
let createData = {
type: "panel",
incognito: true
incognito: true,
};
let creating = browser.tabs.create(createData);
creating.then(() => {
@@ -55,12 +55,15 @@ document.addEventListener("click", clickEvent => {
} else if (clickEvent.target.id === "window-create-news-panel") {
let createData = {
type: "panel",
incognito: true
incognito: true,
};
let creating = browser.tabs.create(createData);
creating.then(() => {
console.log("The news panel has been created");
});
} else if (clickEvent.target.id === "visit-irc") {
browser.sidebarAction.setPanel({ panel: "http://127.0.0.1:7669" });
browser.sidebarAction.open();
} else if (clickEvent.target.id === "generate-fresh-tunnel") {
function refreshIdentity() {
console.log("Generating new identity");
@@ -68,7 +71,7 @@ document.addEventListener("click", clickEvent => {
const url = "http://" + controlHost + ":" + controlPort;
Http.open("GET", url);
Http.send();
Http.onreadystatechange = event => {
Http.onreadystatechange = (event) => {
console.log(Http.responseText);
};
}
@@ -80,28 +83,30 @@ document.addEventListener("click", clickEvent => {
console.log("attempting to initiate graceful shutdown");
RouterManager("ShutdownGraceful");
} else if (clickEvent.target.id === "label-router-status") {
if (document.getElementById("label-status-list").style.display !== "none"){
if (document.getElementById("label-status-list").style.display !== "none") {
console.log("hiding label-status-list");
document.getElementById("label-status-list").style.display = "none"
}else{
document.getElementById("label-status-list").style.display = "none";
} else {
console.log("showing label-status-list");
document.getElementById("label-status-list").style.display = "block"
document.getElementById("label-status-list").style.display = "block";
}
} else if (clickEvent.target.id === "label-router-peers") {
if (document.getElementById("label-peers-list").style.display !== "none"){
if (document.getElementById("label-peers-list").style.display !== "none") {
console.log("hiding label-peers-list");
document.getElementById("label-peers-list").style.display = "none"
}else{
document.getElementById("label-peers-list").style.display = "none";
} else {
console.log("showing label-peers-list");
document.getElementById("label-peers-list").style.display = "block"
document.getElementById("label-peers-list").style.display = "block";
}
} else if (clickEvent.target.id === "label-router-bandwidth") {
if (document.getElementById("label-bandwidth-list").style.display !== "none"){
if (
document.getElementById("label-bandwidth-list").style.display !== "none"
) {
console.log("hiding label-bandwidth-list");
document.getElementById("label-bandwidth-list").style.display = "none"
}else{
document.getElementById("label-bandwidth-list").style.display = "none";
} else {
console.log("showing label-bandwidth-list");
document.getElementById("label-bandwidth-list").style.display = "block"
document.getElementById("label-bandwidth-list").style.display = "block";
}
} else if (clickEvent.target.id === "search-submit") {
console.log("attempting to create search tab");
@@ -157,21 +162,21 @@ document.addEventListener("click", clickEvent => {
clickEvent.preventDefault();
});
window.onload = function(e){
window.onload = function (e) {
if (document.getElementById("label-peers-list") != null) {
document.getElementById("label-peers-list").style.display = "none"
document.getElementById("label-peers-list").style.display = "none";
}
if (document.getElementById("label-bandwidth-list") != null) {
document.getElementById("label-bandwidth-list").style.display = "none"
document.getElementById("label-bandwidth-list").style.display = "none";
}
}
};
function proxyReadiness() {
console.log(this.responseText);
}
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
gettingInfo.then((got) => {
if (got.os != "android") {
browser.history.onVisited.addListener(onVisited);
}
@@ -196,14 +201,14 @@ function goHome() {
let port = info.value.http.split(":")[1];
if (port == "7644") {
let createRhizomeData = {
url: "about:I2p"
url: "about:I2p",
};
console.log("visiting homepage");
let creating = browser.tabs.create(createRhizomeData);
creating.then(onTabCreated, onTabError);
} else {
let createData = {
url: "home.html"
url: "home.html",
};
console.log("visiting homepage");
let creating = browser.tabs.create(createData);
@@ -221,7 +226,7 @@ function goIndex() {
console.log("Help tab created");
}
let createData = {
url: "index.html"
url: "index.html",
};
console.log("visiting help");
let creating = browser.tabs.create(createData);
@@ -249,7 +254,7 @@ function goSearch() {
url:
"http://yacy.idk.i2p/yacysearch.html?" +
"query=" +
document.getElementById("search-query").value
document.getElementById("search-query").value,
};
console.log("visiting legwork");
let creating = browser.tabs.create(createData);
@@ -267,7 +272,7 @@ function goTunnel() {
console.log("I2PTunnel tab created");
}
let createData = {
url: "http://" + routerAddr() + "/i2ptunnel"
url: "http://" + routerAddr() + "/i2ptunnel",
};
console.log("visiting i2ptunnel");
let creating = browser.tabs.create(createData);
@@ -279,7 +284,7 @@ function goMail() {
console.log("Mail tab created");
}
let createData = {
url: "http://" + routerAddr() + "/susimail"
url: "http://" + routerAddr() + "/susimail",
};
console.log("visiting mail");
let creating = browser.tabs.create(createData);
@@ -291,7 +296,7 @@ function goSnark() {
console.log("Snark tab created");
}
let createData = {
url: "http://" + routerAddr() + "/i2psnark"
url: "http://" + routerAddr() + "/i2psnark",
};
console.log("visiting snark");
let creating = browser.tabs.create(createData);
@@ -310,7 +315,7 @@ function onVisited(historyItem) {
function onRemoved() {
var searching = browser.history.search({
text: historyItem.url,
startTime: 0
startTime: 0,
});
searching.then(onCleaned);
}
@@ -327,6 +332,15 @@ if (UpdateContents !== undefined) UpdateContents();
const minutes = 0.2;
const interval = minutes * 60 * 1000;
setInterval(function() {
setInterval(function () {
if (UpdateContents !== undefined) UpdateContents();
}, interval);
fetch("http://127.0.0.1:7669").then((myJson) => {
if (myJson.status == 200) {
let irc = document.getElementById("visit-irc");
if (irc != null) {
irc.classList.remove("hidden");
}
}
});

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8">
<link href="search.css" rel="stylesheet">
<link href="home.css" rel="stylesheet">
<link href="info.css" rel="stylesheet"><!--<link href="torrent/popup.css" rel="stylesheet">-->
<!--<link href="info.css" rel="stylesheet">--><!--<link href="torrent/popup.css" rel="stylesheet">-->
<title>
</title>

View File

@@ -1,15 +1,14 @@
function gotCurrent(tab) {
function gotTitle(title) {
let addr = title;
document.getElementById('TypeInfo').innerHTML = '<div class=\"AddressInfo\"><a href=\"' + addr + '\">' + addr + '</a></div>';
document.getElementById('TypeInfo').innerHTML =
'<div class="AddressInfo"><a href="' + addr + '">' + addr + '</a></div>';
}
console.log(tab);
var gettingTitle = browser.pageAction.getTitle({
tabId: tab[0].id
tabId: tab[0].id,
});
gettingTitle.then(gotTitle);
}
function tabError(error) {

View File

@@ -16,6 +16,7 @@
"proxy",
"privacy",
"storage",
"webNavigation",
"webRequest",
"webRequestBlocking",
"contextualIdentities",
@@ -26,7 +27,7 @@
],
"manifest_version": 2,
"name": "__MSG_extensionName__",
"version": "0.77",
"version": "0.87",
"description": "__MSG_extensionDescription__",
"homepage_url": "https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox",
"icons": {

View File

@@ -1,5 +1,4 @@
body {
width: 25em;
font-family: "Open Sans Light",sans-serif;
font-size: 0.9em;
font-weight: 300
@@ -14,7 +13,7 @@ section.scheme-options {
#clear-button,
section.scheme-options input,
section.scheme-options>select {
float: right
}
label {
display: block;
@@ -25,27 +24,29 @@ label:hover {
}
.title {
font-size: 1.2em;
margin-bottom: 0.5em
margin-bottom: 0.5em;
width: 100%
}
body,
html {
width: 350px
width: 100%
}
a {
margin: 10px;
display: inline-block
margin: 10px
}
.panel {
margin: 5px
}
span.identity {
width: 100px;
display: inline-block;
margin-left: 1em
}
.identity-options {
display: none
}
input {
display: inline
}
div {
width: 100%!important
}

View File

@@ -19,16 +19,21 @@
</select>
</section>
<section class="scheme-options proxy-options" id="proxy-options">
<div class="title">
Proxy Options
</div>
<section class="scheme-options">
<span class="title">Bookmarks Status:</span> <input id="bookmarksState" name="bookmarksstate" type="checkbox" value="bookmarksstate"> <label for="bookmarksState">Bookmarks were created at install-time. <button id="bookmarksButton" type="submit">Re-Create Bookmarks</button></label>
</section>
<p id="proxyHelpText">
<section class="scheme-options proxy-options" id="proxy-options">
<label for="bookmarksState"></label>
<div class="title">
<label for="bookmarksState">Proxy Options</label>
</div>
<label for="bookmarksState"></label>
<p id="proxyHelpText"><label for="bookmarksState"></label>
</p>
<label id="portText">Host:</label> <input data="host" id="host" type="text" value="127.0.0.1">
<label for="bookmarksState"><label id="portText">Host:</label> <input data="host" id="host" type="text" value="127.0.0.1">
<br>
<label id="hostText">Port:</label> <input data="port" id="port" type="text" value="4444">
<label id="hostText">Port:</label> <input data="port" id="port" type="text" value="4444"></label>
</section>
<!--<section class="scheme-options identity-options">
<div class="panel">
@@ -83,7 +88,8 @@
</div>
</section>
<input id="save-button" type="button" value="Save preferences">
<script src="options.js"></script> <!--<script src="/torrent/browser-polyfill.min.js"></script>
<script src="options.js"></script>
<script src="/bookmarks.js"></script> <!--<script src="/torrent/browser-polyfill.min.js"></script>
<script src="/torrent/options.js"></script>-->
</body>
</html>

View File

@@ -1,3 +1,8 @@
function SetBookButton() {
// var bmid = document.getElementById("bookmark");
//bmid.textContent = chrome.i18n.getMessage("bookmarkButton");
}
function SetHostText() {
var hostid = document.getElementById('hostText');
hostid.textContent = chrome.i18n.getMessage('hostText');
@@ -28,6 +33,21 @@ function SetControlHelpText() {
portid.textContent = chrome.i18n.getMessage('controlHelpText');
}
function getBookmarksCreated() {
bookmarks_state = document.getElementById('bookmarks').value;
console.log('(options)Got i2p bookmarks state:', bookmarks_state);
if (bookmarks_state == undefined) {
return false;
}
if (bookmarks_state == 'false') {
return false;
}
if (bookmarks_state == 'true') {
return true;
}
return false;
}
function getScheme() {
const proxy_scheme = document.querySelector('#proxy_scheme');
console.log('(options)Got i2p proxy scheme:', proxy_scheme.value);
@@ -159,6 +179,9 @@ function checkStoredSettings(storedSettings) {
port = undefined;
}
console.log('(options)proxy', "'" + host + "'", ':', port);
if (!storedSettings['bookmarks_state'])
defaultSettings['bookmarks_state'] = false;
else defaultSettings['bookmarks_state'] = storedSettings['bookmarks_state'];
if (!storedSettings['proxy_scheme'])
defaultSettings['proxy_scheme'] = 'http';
else defaultSettings['proxy_scheme'] = storedSettings['proxy_scheme'];
@@ -245,6 +268,9 @@ function checkAndroidStoredSettings(storedSettings) {
let defaultSettings = {};
let host = '';
let port = '';
if (!storedSettings['bookmarks_state'])
defaultSettings['bookmarks_state'] = false;
else defaultSettings['bookmarks_state'] = storedSettings['bookmarks_state'];
if (!storedSettings['proxy_scheme']) defaultSettings['proxy_scheme'] = 'http';
else defaultSettings['proxy_scheme'] = storedSettings['proxy_scheme'];
if (!storedSettings['proxy_host']) {
@@ -320,6 +346,7 @@ function onError(e) {
function storeSettings() {
let storableSettings = {};
storableSettings['bookmarks_state'] = getBookmarksCreated();
storableSettings['proxy_scheme'] = getScheme();
storableSettings['proxy_host'] = getHost();
storableSettings['proxy_port'] = getPort();
@@ -341,15 +368,19 @@ function storeSettings() {
function updateUI(restoredSettings) {
const selectList = document.querySelector('#proxy_scheme');
if (selectList == undefined) selectList.value = restoredSettings.proxy_scheme;
if (selectList != undefined) selectList.value = restoredSettings.proxy_scheme;
//console.log("(options)showing proxy scheme:", selectList.value);
console.log(restoredSettings);
const bms = document.getElementById('bookmarksState');
if (bms != undefined) bms.checked = restoredSettings.bookmarks_state;
const hostitem = document.getElementById('host');
if (hostitem == undefined) hostitem.value = restoredSettings.proxy_host;
if (hostitem != undefined) hostitem.value = restoredSettings.proxy_host;
//console.log("(options)showing proxy host:", hostitem.value);
const portitem = document.getElementById('port');
if (portitem == undefined) portitem.value = restoredSettings.proxy_port;
if (portitem != undefined) portitem.value = restoredSettings.proxy_port;
//console.log("(options)showing proxy port:", portitem.value);
const controlhostitem = document.getElementById('controlhost');
@@ -363,41 +394,42 @@ function updateUI(restoredSettings) {
//console.log("(options)showing control port:", controlportitem.value);
const rpchostitem = document.getElementById('rpchost');
if (rpchostitem == undefined) rpchostitem.value = restoredSettings.rpc_host;
if (rpchostitem != undefined) rpchostitem.value = restoredSettings.rpc_host;
//console.log("(options)showing rpc host:", rpchostitem.value);
const rpcportitem = document.getElementById('rpcport');
if (rpcportitem == undefined) rpcportitem.value = restoredSettings.rpc_port;
if (rpcportitem != undefined) rpcportitem.value = restoredSettings.rpc_port;
//console.log("(options)showing rpc port:", rpcportitem.value);
const rpcpathitem = document.getElementById('rpcpath');
if (rpcpathitem == undefined) rpcpathitem.value = restoredSettings.rpc_path;
if (rpcpathitem != undefined) rpcpathitem.value = restoredSettings.rpc_path;
//console.log("(options)showing rpc path:", rpcpathitem.value);
const rpcpassitem = document.getElementById('rpcpass');
if (rpcpassitem == undefined) rpcpassitem.value = restoredSettings.rpc_pass;
if (rpcpassitem != undefined) rpcpassitem.value = restoredSettings.rpc_pass;
//console.log("(options)showing rpc pass:");
const btrpchostitem = document.getElementById('btrpchost');
if (btrpchostitem == undefined)
if (btrpchostitem != undefined)
btrpchostitem.value = restoredSettings.rpc_host;
//console.log("(options)showing bt rpc host:", btrpchostitem.value);
const btrpcportitem = document.getElementById('btrpcport');
if (btrpcportitem == undefined)
if (btrpcportitem != undefined)
btrpcportitem.value = restoredSettings.rpc_port;
//console.log("(options)showing rbt pc port:", rpcportitem.value);
const btrpcpathitem = document.getElementById('btrpcpath');
if (btrpcpathitem == undefined)
if (btrpcpathitem != undefined)
btrpcpathitem.value = restoredSettings.rpc_path;
//console.log("(options)showing bt rpc path:", btrpcpathitem.value);
const btrpcpassitem = document.getElementById('btrpcpass');
if (btrpcpassitem == undefined)
if (btrpcpassitem != undefined)
btrpcpassitem.value = restoredSettings.rpc_pass;
//console.log("(options)showing bt rpc pass:");
SetBookButton();
SetHostText();
SetPortText();
SetPortHelpText();
@@ -411,7 +443,7 @@ function onError(e) {
}
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
gettingInfo.then((got) => {
if (got.os != 'android') {
chrome.storage.local.get(function(got) {
let settings = checkStoredSettings(got);

View File

@@ -1,7 +1,7 @@
var android = false;
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
gettingInfo.then((got) => {
if (got.os == 'android') {
console.log('Running in Android detected');
android = true;

View File

@@ -12,10 +12,19 @@ function onSet(result) {
risky sites in your browser */
function disableHyperlinkAuditing() {
var setting = browser.privacy.websites.hyperlinkAuditingEnabled.set({
value: false
value: false,
});
console.log('Disabling hyperlink auditing/val=', {
value: false
value: false,
});
setting.then(onSet);
}
// UNINSTALL ONLY
function enableHyperlinkAuditing() {
var setting = browser.privacy.websites.hyperlinkAuditingEnabled.clear();
console.log('Disabling hyperlink auditing/val=', {
value: false,
});
setting.then(onSet);
}
@@ -23,10 +32,19 @@ function disableHyperlinkAuditing() {
// This enables first-party isolation
function enableFirstPartyIsolation() {
var setting = browser.privacy.websites.firstPartyIsolate.set({
value: true
value: true,
});
console.log('Enabling first party isolation/val=', {
value: true
value: true,
});
setting.then(onSet);
}
// UNINSTALL ONLY
function disableFirstPartyIsolation() {
var setting = browser.privacy.websites.firstPartyIsolate.clear();
console.log('Enabling first party isolation/val=', {
value: true,
});
setting.then(onSet);
}
@@ -36,23 +54,27 @@ function enableFirstPartyIsolation() {
interface for now */
function disableEvilCookies() {
var getting = browser.privacy.websites.cookieConfig.get({});
getting.then(got => {
getting.then((got) => {
var setting = browser.privacy.websites.cookieConfig.set({
value: {
behavior: 'reject_third_party',
nonPersistentCookies: got.value.nonPersistentCookies
}
nonPersistentCookies: got.value.nonPersistentCookies,
},
});
console.log('Setting cookie behavior/val=', {
value: {
behavior: 'reject_third_party',
nonPersistentCookies: got.value.nonPersistentCookies
}
nonPersistentCookies: got.value.nonPersistentCookies,
},
});
setting.then(onSet);
});
}
function enableEvilCookies() {
var getting = browser.privacy.websites.cookieConfig.clear();
}
// Make sure that they're gone
/*function disableBadCookies(){
var setting = browser.privacy.websites.thirdPartyCookiesAllowed.set({
@@ -67,10 +89,19 @@ function disableEvilCookies() {
// this disables the use of referrer headers
function disableReferrers() {
var setting = browser.privacy.websites.referrersEnabled.set({
value: false
value: false,
});
console.log("Disabling referrer headers/val=", {
value: false
value: false,
});
setting.then(onSet);
}
// UNINSATALL ONLY
function enableReferrers() {
var setting = browser.privacy.websites.referrersEnabled.clear();
console.log("Disabling referrer headers/val=", {
value: false,
});
setting.then(onSet);
}
@@ -78,10 +109,19 @@ function disableReferrers() {
// enable fingerprinting resistent features(letterboxing and stuff)
function enableResistFingerprinting() {
var setting = browser.privacy.websites.resistFingerprinting.set({
value: true
value: true,
});
console.log("Enabling resist fingerprinting/val=", {
value: true
value: true,
});
setting.then(onSet);
}
// UNINSTALL ONLY
function disableResistFingerprinting() {
var setting = browser.privacy.websites.resistFingerprinting.clear();
console.log("Enabling resist fingerprinting/val=", {
value: false,
});
setting.then(onSet);
}
@@ -89,10 +129,19 @@ function enableResistFingerprinting() {
// This is essentially a blocklist of clearnet web-sites known to do bad tracking
function enableTrackingProtection() {
var setting = browser.privacy.websites.trackingProtectionMode.set({
value: "always"
value: "always",
});
console.log("Enabling tracking protection/val=", {
value: "always"
value: "always",
});
setting.then(onSet);
}
// UNINSTALL ONLY
function disableTrackingProtection() {
var setting = browser.privacy.websites.trackingProtectionMode.clear();
console.log("Enabling tracking protection/val=", {
value: "always",
});
setting.then(onSet);
}
@@ -101,15 +150,15 @@ function enableTrackingProtection() {
management dependent on identifying information */
function disableDigitalRestrictionsManagement() {
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
gettingInfo.then((got) => {
if (got.os == "win") {
var setting = browser.privacy.websites.protectedContentEnabled.set({
value: false
value: false,
});
console.log(
"Setting Protected Content(Digital Restrictions Management) false/val=",
{
value: false
value: false,
}
);
setting.then(onSet);
@@ -117,6 +166,45 @@ function disableDigitalRestrictionsManagement() {
});
}
// UNINSTALL ONLY
function disableDigitalRestrictionsManagement() {
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then((got) => {
if (got.os == "win") {
var setting = browser.privacy.websites.protectedContentEnabled.clear();
console.log(
"Setting Protected Content(Digital Restrictions Management) false/val=",
{
value: true,
}
);
setting.then(onSet);
}
});
}
function unsetAllPrivacy() {
enableHyperlinkAuditing();
disableFirstPartyIsolation();
enableEvilCookies();
enableReferrers();
disableTrackingProtection();
disableResistFingerprinting();
enableDigitalRestrictionsManagement();
UnsetPeerConnection();
EnableSavePasswords();
}
browser.management.onUninstalled.addListener((info) => {
function gotSelf(selfinfo) {
if (info.name == selfinfo.name) {
unsetAllPrivacy();
}
}
var gettingSelf = browser.management.getSelf();
gettingSelf.then(gotSelf);
});
function setAllPrivacy() {
disableHyperlinkAuditing();
enableFirstPartyIsolation();
@@ -134,13 +222,13 @@ function ResetPeerConnection() {
var webrtc = true;
console.log("No snowflake plugin found, pre-disabled WebRTC");
var rtc = browser.privacy.network.peerConnectionEnabled.set({
value: webrtc
value: webrtc,
});
rtc.then(AssurePeerConnection);
}
function snowflake(snowflake) {
console.log("snowflake plugin found, leaving WebRTC alone", snowflake);
EnablePeerConnection();
AssurePeerConnection();
}
var snowflakeInfo = browser.management.get(
"{b11bea1f-a888-4332-8d8a-cec2be7d24b9}" // string
@@ -148,25 +236,27 @@ function ResetPeerConnection() {
snowflakeInfo.then(snowflake, reset);
}
function EnablePeerConnection() {
var webrtc = true;
var rtc = browser.privacy.network.peerConnectionEnabled.set({
value: webrtc
});
rtc.then(AssurePeerConnection);
console.log("Enabled WebRTC");
}
function AssurePeerConnection() {
function assure(webrtc) {
browser.privacy.network.peerConnectionEnabled.set({
value: true
});
browser.privacy.network.networkPredictionEnabled.set({
value: false
value: true,
});
chrome.privacy.network.webRTCIPHandlingPolicy.set({
value: "disable_non_proxied_udp"
value: "disable_non_proxied_udp",
});
}
let rtc = browser.privacy.network.peerConnectionEnabled.get({});
rtc.then(assure);
}
// UNINSTALL ONLY
function UnsetPeerConnection() {
function assure(webrtc) {
browser.privacy.network.peerConnectionEnabled.set({
value: true,
});
chrome.privacy.network.webRTCIPHandlingPolicy.set({
value: "default",
});
}
let rtc = browser.privacy.network.peerConnectionEnabled.get({});
@@ -174,7 +264,7 @@ function AssurePeerConnection() {
}
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
gettingInfo.then((got) => {
if (got.os == "android") {
browser.tabs.onCreated.addListener(ResetPeerConnection);
} else {
@@ -185,15 +275,13 @@ gettingInfo.then(got => {
function ResetDisableSavePasswords() {
browser.privacy.services.passwordSavingEnabled.set({
value: false
value: false,
});
console.log("Re-disabled saved passwords");
}
function EnableSavePasswords() {
browser.privacy.services.passwordSavingEnabled.set({
value: true
});
browser.privacy.services.passwordSavingEnabled.clear();
console.log("Enabled saved passwords");
}
@@ -201,7 +289,7 @@ function EnableSavePasswords() {
var defaultSettings = {
since: "forever",
dataTypes: ["downloads", "passwords", "formData", "localStorage", "history"]
dataTypes: ["downloads", "passwords", "formData", "localStorage", "history"],
};
function onError(therror) {
@@ -217,7 +305,7 @@ function forgetBrowsingData(storedSettings) {
const times = {
hour: () => 1000 * 60 * 60,
day: () => 1000 * 60 * 60 * 24,
week: () => 1000 * 60 * 60 * 24 * 7
week: () => 1000 * 60 * 60 * 24 * 7,
};
const sinceMilliseconds = times[selectedSince].call();
@@ -241,7 +329,7 @@ function forgetBrowsingData(storedSettings) {
browser.notifications.create({
type: "basic",
title: "Removed browsing data",
message: `Removed ${dataTypesString}\n for I2P Browsing`
message: `Removed ${dataTypesString}\n for I2P Browsing`,
});
}
@@ -250,41 +338,41 @@ function forgetBrowsingData(storedSettings) {
for (let item of historyItems) {
if (i2pHost(item.url)) {
browser.history.deleteUrl({
url: item.url
url: item.url,
});
browser.browsingData.removeCache({});
console.log("cleared Cache");
browser.browsingData
.removePasswords({
hostnames: [i2pHostName(item.url)],
since
since,
})
.then(onContextGotLog);
console.log("cleared Passwords");
browser.browsingData
.removeDownloads({
hostnames: [i2pHostName(item.url)],
since
since,
})
.then(onContextGotLog);
console.log("cleared Downloads");
browser.browsingData
.removeFormData({
hostnames: [i2pHostName(item.url)],
since
since,
})
.then(onContextGotLog);
console.log("cleared Form Data");
browser.browsingData
.removeLocalStorage({
hostnames: [i2pHostName(item.url)],
since
since,
})
.then(onContextGotLog);
console.log("cleared Local Storage");
let contexts = browser.contextualIdentities.query({
name: titlepref
name: titlepref,
});
function deepCleanCookies(cookies) {
@@ -292,7 +380,7 @@ function forgetBrowsingData(storedSettings) {
var removing = browser.cookies.remove({
firstPartyDomain: cookie.firstPartyDomain,
name: cookie.name,
url: item.url
url: item.url,
});
removing.then(onContextGotLog, onError);
}
@@ -303,7 +391,7 @@ function forgetBrowsingData(storedSettings) {
for (let cookieStoreId of cookieStoreIds) {
var removing = browser.cookies.getAll({
firstPartyDomain: null,
storeId: cookieStoreId.cookieStoreId
storeId: cookieStoreId.cookieStoreId,
});
removing.then(deepCleanCookies, onError);
}
@@ -317,7 +405,7 @@ function forgetBrowsingData(storedSettings) {
var searching = browser.history.search({
text: "i2p",
startTime: 0
startTime: 0,
});
searching.then(deepCleanHistory);
@@ -328,7 +416,24 @@ function forgetBrowsingData(storedSettings) {
function i2pHostName(url) {
let hostname = "";
if (url.indexOf("://") > -1) {
console.log("(hosts)", url);
if (url.includes("=")) {
if (url.includes(".i2p")) {
lsit = url.split("=");
for (let item in lsit) {
var items = lsit[item].split(`\%`); //"\%")
for (let p in items) {
if (items[p].includes(".i2p")) {
hostname = items[p].replace("3D", 1);
}
break;
}
if (hostname != "") {
break;
}
}
}
} else if (url.indexOf("://") > -1) {
hostname = url.split("/")[2];
} else {
hostname = url.split("/")[0];
@@ -338,6 +443,9 @@ function i2pHostName(url) {
function i2pHost(url) {
let hostname = i2pHostName(url);
if (hostname.endsWith(".i2p")) {
console.log("(hostname) i2p", hostname);
}
return hostname.endsWith(".i2p");
}
@@ -381,7 +489,7 @@ function message(recieved) {
console.log(recieved);
if (recieved.rtc === "enableWebRTC") {
console.log("enableWebRTC");
EnablePeerConnection();
AssurePeerConnection();
} else if (recieved.rtc === "disableWebRTC") {
console.log("disableWebRTC");
ResetPeerConnection();

189
proxy.js
View File

@@ -1,17 +1,20 @@
var titlepref = chrome.i18n.getMessage('titlePreface');
var webpref = chrome.i18n.getMessage('webPreface');
var ircpref = chrome.i18n.getMessage('ircPreface');
var torrentpref = chrome.i18n.getMessage('torrentPreface');
var routerpref = chrome.i18n.getMessage('routerPreface');
var routerprefpriv = chrome.i18n.getMessage('routerPrefacePrivate');
var ircpref = chrome.i18n.getMessage('ircPreface');
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.');
@@ -20,86 +23,117 @@ function shouldProxyRequest(requestInfo) {
}
var handleContextProxyRequest = async function(requestDetails) {
function ircProxy() {
if (!requestDetails.url.includes('7669')) {
proxy = {
type: getScheme(),
host: getHost(),
port: getPort(),
};
return proxy;
}
if (requestDetails.url.includes(':7669')) {
proxy = null;
return proxy;
}
}
function btProxy() {
proxy = routerProxy();
if (requestDetails.url.includes(':7662')) {
proxy = null;
return proxy;
}
console.log('(bt proxy)', proxy);
return proxy;
}
function mainProxy() {
console.log('(proxy) mainproxy 0');
proxy = {
type: getScheme(),
host: getHost(),
port: getPort(),
};
let url = new URL(requestDetails.url);
if (
requestDetails.url.startsWith(
'http://' + getHost() + ':' + getConsolePort() + '/i2psnark/'
)
) {
//+url.host)) {
console.log('(proxy) mainproxy 2', url);
proxy = null;
}
return proxy;
}
function routerProxy() {
if (routerHost(requestDetails.url)) {
proxy = null;
return proxy;
} else if (!routerHost(requestDetails.url)) {
proxy = {
type: getScheme(),
host: getHost(),
port: getPort(),
};
return proxy;
}
}
try {
var handleProxyRequest = function(context) {
proxy = {
failoverTimeout: 0,
proxyDns: false
proxyDns: false,
};
if (context == 'firefox-default' || context == 'firefox-private') {
proxy = null;
return proxy;
}
if (context != undefined) {
if (context.name == titlepref) {
proxy = {
type: getScheme(),
host: getHost(),
port: getPort()
};
/*console.log("(proxy)", context.name);
console.log("Using", proxy.type);
console.log("proxy ", proxy.host + ":" + proxy.port);*/
console.log('(proxy), context', context);
proxy = routerProxy();
if (context.name == ircpref) {
proxy = ircProxy();
return proxy;
} else if (context.name == titlepref) {
proxy = mainProxy();
return proxy;
} else if (context.name == routerpref) {
if (routerHost(requestDetails.url)) {
return proxy;
} else if (!routerHost(requestDetails.url)) {
proxy = {
type: 'http',
host: 'localhost',
port: '65535'
};
proxy = routerProxy();
return proxy;
} else if (context.name == torrentpref) {
proxy = btProxy();
return proxy;
}
return proxy;
} else {
if (!routerHost(requestDetails.url)) {
if (localHost(requestDetails.url)) {
if (requestDetails.url.includes(':7669')) {
proxy = null;
} else if (requestDetails.url.includes(':7662')) {
proxy = null;
} else {
console.log(
'(proxy) non-routerconsole localhost url, will not interfere',
requestDetails.url
);
}
}
} else if (i2pHost(requestDetails.url)) {
proxy = {
type: getScheme(),
host: getHost(),
port: getPort()
port: getPort(),
};
/*console.log("(proxy)", context.name);
console.log("Using", proxy.type);
console.log("proxy ", proxy.host + ":" + proxy.port);*/
return proxy;
} else if (context.name == webpref) {
if (localHost(requestDetails.url)) {
if (!routerHost(requestDetails.url)) {
proxy = {
type: 'http',
host: 'localhost',
port: '65535'
};
}
}
console.log('(proxy)', context.name);
console.log('Using', proxy.type);
console.log('proxy ', proxy.host + ':' + proxy.port);
return proxy;
}
//var tab = tabGet(requestDetails.tabId);
//tab.then(handleTabRequest,)
return proxy;
}
if (!routerHost(requestDetails.url)) {
if (localHost(requestDetails.url)) {
console.log(
'(proxy) non-routerconsole localhost url, will not interfere',
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) {
@@ -109,7 +143,6 @@ var handleContextProxyRequest = async function(requestDetails) {
};
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) {
@@ -120,19 +153,15 @@ var handleContextProxyRequest = async function(requestDetails) {
proxy = {
type: getScheme(),
host: getHost(),
port: getPort()
port: getPort(),
};
return proxy;
}
if (requestDetails.originUrl == browser.runtime.getURL('security.html')) {
console.log(
'(proxy) extension security URL',
browser.runtime.getURL('security.html')
);
proxy = {
type: getScheme(),
host: getHost(),
port: getPort()
port: getPort(),
};
return proxy;
}
@@ -143,11 +172,14 @@ var handleContextProxyRequest = async function(requestDetails) {
return browser.proxy.settings.get({});
}
if (requestDetails.tabId > 0) {
if (requestDetails.url.includes('MuWire')) {
return;
}
if (proxyHost(requestDetails.url)) {
proxy = {
type: getScheme(),
host: getHost(),
port: getPort()
port: getPort(),
};
return proxy;
} else if (extensionHost(requestDetails.url)) {
@@ -157,7 +189,7 @@ var handleContextProxyRequest = async function(requestDetails) {
requestDetails.tabId = tab;
var context = tab.then(contextGet);
var proxy = await context.then(handleProxyRequest);
console.log('(proxy)Returning I2P Proxy', proxy);
//console.log('(proxy)Returning I2P Proxy', proxy);
return proxy;
} else {
var tab = tabGet(requestDetails.tabId);
@@ -292,10 +324,19 @@ function getPort() {
return proxy_port;
}
function getConsolePort() {
if (control_port == undefined) {
var scheme = getScheme();
if (scheme == 'socks') proxy_port = '7657';
else control_port = '7657';
}
return control_port;
}
function setupProxy() {
console.log('Setting up Firefox WebExtension proxy');
browser.proxy.onRequest.addListener(handleContextProxyRequest, {
urls: ['<all_urls>']
urls: ['*://*.i2p/*', '*://localhost/*', '*://127.0.0.1/*', '*://*/*i2p*'],
});
console.log('i2p settings created for WebExtension Proxy');
}
@@ -316,9 +357,9 @@ function updateFromStorage() {
setupProxy();
});
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
gettingInfo.then((got) => {
if (got.os != 'android') {
browser.windows.getAll().then(wins => wins.forEach(themeWindow));
browser.windows.getAll().then((wins) => wins.forEach(themeWindow));
}
});
}
@@ -329,7 +370,7 @@ SetupSettings();
setupProxy();
var gettingListenerInfo = browser.runtime.getPlatformInfo();
gettingListenerInfo.then(got => {
gettingListenerInfo.then((got) => {
browser.windows.onCreated.addListener(() => {
chrome.storage.local.get(function() {
setupProxy();

View File

@@ -4,13 +4,111 @@
<link type="text/html" rel="alternate" href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases"/>
<link type="application/atom+xml" rel="self" href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases.atom"/>
<title>Release notes from I2P-in-Private-Browsing-Mode-Firefox</title>
<updated>2020-06-23T03:21:35Z</updated>
<updated>2020-12-06T17:13:52Z</updated>
<entry>
<id>tag:github.com,2008:Repository/169256012/0.87</id>
<updated>2020-12-06T18:37:57Z</updated>
<link rel="alternate" type="text/html" href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases/tag/0.87"/>
<title>0.87</title>
<enclosure url="magnet:?xt=urn:btih:517e97aeb8ad60357d693c37fbc5a3f4eb9ac224" type="application/x-bittorrent" />
<content type="html">&lt;p&gt;Browsing to a single contextual identity, thus creating an I2P in Private&lt;br&gt;
Browsing mode. It requires the use of a pre-installed I2P Router.&lt;br&gt;
i2psetproxy.js (0.87-1) UNRELEASED; urgency=low&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Disable searching for i2p sites in non-i2p search engines&lt;/li&gt;
&lt;li&gt;Add contexts for i2pbote and Dispatch&lt;/li&gt;
&lt;li&gt;Remain in tighter control of x-i2p-torrentlocation priority&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-- idk &lt;a href=&quot;mailto:hankhill19580@gmail.com&quot;&gt;hankhill19580@gmail.com&lt;/a&gt; Sat, 10 NOV 2020 1:33:50 -0400&lt;/p&gt;
&lt;p&gt;i2psetproxy.js (0.85-1) UNRELEASED; urgency=low&lt;/p&gt;</content>
<author>
<name>eyedeekay</name>
</author>
<media:thumbnail height="30" width="30" url="https://avatars3.githubusercontent.com/u/8733713?s=60&amp;v=4"/>
</entry>
<entry>
<id>tag:github.com,2008:Repository/169256012/0.85</id>
<updated>2020-11-11T06:44:44Z</updated>
<link rel="alternate" type="text/html" href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases/tag/0.85"/>
<title>0.85</title>
<content type="html">&lt;p&gt;A simple plugin for configuring a Firefox based web browser to isolate I2P&lt;br&gt;
Browsing to a single contextual identity, thus creating an I2P in Private&lt;br&gt;
Browsing mode. It requires the use of a pre-installed I2P Router.&lt;br&gt;
i2psetproxy.js (0.85-1) UNRELEASED; urgency=low&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Fix a bug which was causing i2psnark to fail to isolate.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-- idk &lt;a href=&quot;mailto:hankhill19580@gmail.com&quot;&gt;hankhill19580@gmail.com&lt;/a&gt; Sat, 10 NOV 2020 1:33:50 -0400&lt;/p&gt;
&lt;p&gt;i2psetproxy.js (0.83-1) UNRELEASED; urgency=low&lt;/p&gt;</content>
<author>
<name>eyedeekay</name>
</author>
<media:thumbnail height="30" width="30" url="https://avatars3.githubusercontent.com/u/8733713?s=60&amp;v=4"/>
</entry>
<entry>
<id>tag:github.com,2008:Repository/169256012/0.83</id>
<updated>2020-11-11T04:00:27Z</updated>
<link rel="alternate" type="text/html" href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases/tag/0.83"/>
<title>0.83</title>
<content type="html">&lt;p&gt;A simple plugin for configuring a Firefox based web browser to isolate I2P&lt;br&gt;
Browsing to a single contextual identity, thus creating an I2P in Private&lt;br&gt;
Browsing mode. It requires the use of a pre-installed I2P Router.&lt;br&gt;
i2psetproxy.js (0.83-1) UNRELEASED; urgency=low&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add a tab for I2P-Native Dispatch&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-- idk &lt;a href=&quot;mailto:hankhill19580@gmail.com&quot;&gt;hankhill19580@gmail.com&lt;/a&gt; Sat, 10 NOV 2020 22:00:01 -0400&lt;/p&gt;
&lt;p&gt;i2psetproxy.js (0.81-1) UNRELEASED; urgency=low&lt;/p&gt;</content>
<author>
<name>eyedeekay</name>
</author>
<media:thumbnail height="30" width="30" url="https://avatars3.githubusercontent.com/u/8733713?s=60&amp;v=4"/>
</entry>
<entry>
<id>tag:github.com,2008:Repository/169256012/0.81</id>
<updated>2020-11-08T02:44:34Z</updated>
<link rel="alternate" type="text/html" href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases/tag/0.81"/>
<title>0.81</title>
<content type="html">&lt;p&gt;Browsing mode. It requires the use of a pre-installed I2P Router.&lt;br&gt;
i2psetproxy.js (0.81-1) UNRELEASED; urgency=low&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;X-I2P-TorrentLocation header&lt;/li&gt;
&lt;li&gt;Visual tweaks&lt;/li&gt;
&lt;li&gt;Deprecate localhost browser container permanently&lt;/li&gt;
&lt;li&gt;Isolation rules improvements&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-- idk &lt;a href=&quot;mailto:hankhill19580@gmail.com&quot;&gt;hankhill19580@gmail.com&lt;/a&gt; Sat, 07 NOV 2020 21:34:25 -0400&lt;/p&gt;
&lt;p&gt;i2psetproxy.js (0.79-1) UNRELEASED; urgency=low&lt;/p&gt;</content>
<author>
<name>eyedeekay</name>
</author>
<media:thumbnail height="30" width="30" url="https://avatars3.githubusercontent.com/u/8733713?s=60&amp;v=4"/>
</entry>
<entry>
<id>tag:github.com,2008:Repository/169256012/0.79</id>
<updated>2020-09-26T03:36:46Z</updated>
<link rel="alternate" type="text/html" href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases/tag/0.79"/>
<title>0.79</title>
<content type="html">&lt;p&gt;A simple plugin for configuring a Firefox based web browser to isolate I2P&lt;br&gt;
Browsing to a single contextual identity, thus creating an I2P in Private&lt;br&gt;
Browsing mode. It requires the use of a pre-installed I2P Router.&lt;br&gt;
i2psetproxy.js (0.79-1) UNRELEASED; urgency=low&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Pin application tabs to the front of the tab order&lt;/li&gt;
&lt;li&gt;Refine pageaction behavior&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-- idk &lt;a href=&quot;mailto:hankhill19580@gmail.com&quot;&gt;hankhill19580@gmail.com&lt;/a&gt; Mon, 24 SEP 2020 20:18:03 -0400&lt;/p&gt;
&lt;p&gt;i2psetproxy.js (0.77-1) UNRELEASED; urgency=low&lt;/p&gt;</content>
<author>
<name>eyedeekay</name>
</author>
<media:thumbnail height="30" width="30" url="https://avatars3.githubusercontent.com/u/8733713?s=60&amp;v=4"/>
</entry>
<entry>
<id>tag:github.com,2008:Repository/169256012/0.77</id>
<updated>2020-09-25T00:19:45Z</updated>
<link rel="alternate" type="text/html" href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases/tag/0.77"/>
<title>0.77</title>
<enclosure url="magnet:?xt=urn:btih:5f45673bc107ec42a8b4d02aa4d5d7487949fc66" type="application/x-bittorrent" />
<content type="html">&lt;p&gt;Merge pull request &lt;a class=&quot;issue-link js-issue-link&quot; href=&quot;https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/pull/100&quot;&gt;#100&lt;/a&gt; from eyedeekay/bookmarks&lt;/p&gt;
&lt;p&gt;make the bookmarks part of a subdirectory&lt;/p&gt;</content>
@@ -98,101 +196,4 @@ i2psetproxy.js (0.69-1) UNRELEASED; urgency=low&lt;/p&gt;
</author>
<media:thumbnail height="30" width="30" url="https://avatars3.githubusercontent.com/u/8733713?s=60&amp;v=4"/>
</entry>
<entry>
<id>tag:github.com,2008:Repository/169256012/0.67</id>
<updated>2020-03-18T04:27:30Z</updated>
<link rel="alternate" type="text/html" href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases/tag/0.67"/>
<title>0.67</title>
<content type="html">&lt;p&gt;A simple plugin for configuring a Firefox based web browser to isolate I2P&lt;br&gt;
Browsing to a single contextual identity, thus creating an I2P in Private&lt;br&gt;
Browsing mode. It requires the use of a pre-installed I2P Router.&lt;br&gt;
i2psetproxy.js (0.67-1) UNRELEASED; urgency=low&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Tweak some default settings that should have gone into 65&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-- idk &lt;a href=&quot;mailto:hankhill19580@gmail.com&quot;&gt;hankhill19580@gmail.com&lt;/a&gt; Tue, 17 MAR 2020 22:58:55 -0400&lt;/p&gt;
&lt;p&gt;i2psetproxy.js (0.65-1) UNRELEASED; urgency=low&lt;/p&gt;</content>
<author>
<name>eyedeekay</name>
</author>
<media:thumbnail height="30" width="30" url="https://avatars3.githubusercontent.com/u/8733713?s=60&amp;v=4"/>
</entry>
<entry>
<id>tag:github.com,2008:Repository/169256012/0.65</id>
<updated>2020-03-18T03:01:20Z</updated>
<link rel="alternate" type="text/html" href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases/tag/0.65"/>
<title>0.65</title>
<content type="html">&lt;p&gt;Browsing to a single contextual identity, thus creating an I2P in Private&lt;br&gt;
Browsing mode. It requires the use of a pre-installed I2P Router.&lt;br&gt;
i2psetproxy.js (0.65-1) UNRELEASED; urgency=low&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Initial prototype of certs implementation&lt;/li&gt;
&lt;li&gt;Use &quot;pinned apptabs&quot; to minimize the number of tabs occupied by an app&lt;/li&gt;
&lt;li&gt;Get ready for self-hosted updates but with bittorrent because it&#39;s cooler&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-- idk &lt;a href=&quot;mailto:hankhill19580@gmail.com&quot;&gt;hankhill19580@gmail.com&lt;/a&gt; Tue, 17 MAR 2020 22:58:55 -0400&lt;/p&gt;
&lt;p&gt;i2psetproxy.js (0.63-1) UNRELEASED; urgency=low&lt;/p&gt;</content>
<author>
<name>eyedeekay</name>
</author>
<media:thumbnail height="30" width="30" url="https://avatars3.githubusercontent.com/u/8733713?s=60&amp;v=4"/>
</entry>
<entry>
<id>tag:github.com,2008:Repository/169256012/0.63</id>
<updated>2020-03-02T23:01:58Z</updated>
<link rel="alternate" type="text/html" href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases/tag/0.63"/>
<title>0.63</title>
<content type="html">&lt;p&gt;A simple plugin for configuring a Firefox based web browser to isolate I2P&lt;br&gt;
Browsing to a single contextual identity, thus creating an I2P in Private&lt;br&gt;
Browsing mode. It requires the use of a pre-installed I2P Router.&lt;br&gt;
i2psetproxy.js (0.63-1) UNRELEASED; urgency=low&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;other containerizers bugfix&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-- idk &lt;a href=&quot;mailto:hankhill19580@gmail.com&quot;&gt;hankhill19580@gmail.com&lt;/a&gt; Mon, 02 MAR 2020 17:54:26 -0400&lt;/p&gt;
&lt;p&gt;i2psetproxy.js (0.61-1) UNRELEASED; urgency=low&lt;/p&gt;</content>
<author>
<name>eyedeekay</name>
</author>
<media:thumbnail height="30" width="30" url="https://avatars3.githubusercontent.com/u/8733713?s=60&amp;v=4"/>
</entry>
<entry>
<id>tag:github.com,2008:Repository/169256012/0.61</id>
<updated>2020-03-02T22:48:06Z</updated>
<link rel="alternate" type="text/html" href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases/tag/0.61"/>
<title>0.61</title>
<content type="html">&lt;p&gt;A simple plugin for configuring a Firefox based web browser to isolate I2P&lt;br&gt;
Browsing to a single contextual identity, thus creating an I2P in Private&lt;br&gt;
Browsing mode. It requires the use of a pre-installed I2P Router.&lt;br&gt;
i2psetproxy.js (0.61-1) UNRELEASED; urgency=low&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;other containerizers bugfix&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-- idk &lt;a href=&quot;mailto:hankhill19580@gmail.com&quot;&gt;hankhill19580@gmail.com&lt;/a&gt; Mon, 02 MAR 2020 17:46:24 -0400&lt;/p&gt;
&lt;p&gt;i2psetproxy.js (0.59-1) UNRELEASED; urgency=low&lt;/p&gt;</content>
<author>
<name>eyedeekay</name>
</author>
<media:thumbnail height="30" width="30" url="https://avatars3.githubusercontent.com/u/8733713?s=60&amp;v=4"/>
</entry>
<entry>
<id>tag:github.com,2008:Repository/169256012/0.59</id>
<updated>2020-02-26T03:10:23Z</updated>
<link rel="alternate" type="text/html" href="https://github.com/eyedeekay/I2P-in-Private-Browsing-Mode-Firefox/releases/tag/0.59"/>
<title>0.59</title>
<content type="html">&lt;p&gt;A simple plugin for configuring a Firefox based web browser to isolate I2P&lt;br&gt;
Browsing to a single contextual identity, thus creating an I2P in Private&lt;br&gt;
Browsing mode. It requires the use of a pre-installed I2P Router.&lt;br&gt;
i2psetproxy.js (0.59-1) UNRELEASED; urgency=low&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;transmission-rpc based torrent controls&lt;/li&gt;
&lt;li&gt;bugfixes&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-- idk &lt;a href=&quot;mailto:hankhill19580@gmail.com&quot;&gt;hankhill19580@gmail.com&lt;/a&gt; Tue, 25 FEB 2020 20:52:19 -0400&lt;/p&gt;
&lt;p&gt;i2psetproxy.js (0.57-1) UNRELEASED; urgency=low&lt;/p&gt;</content>
<author>
<name>eyedeekay</name>
</author>
<media:thumbnail height="30" width="30" url="https://avatars3.githubusercontent.com/u/8733713?s=60&amp;v=4"/>
</entry>
</feed>

174
script.js
View File

@@ -1,37 +1,151 @@
browser.runtime.onMessage.addListener(request => {
var response = '';
browser.runtime.onMessage.addListener((request) => {
var response = 'no-alt-location';
console.log(request);
if (request.req === 'i2p-location') {
response = 'no-alt-location';
const metas = document.getElementsByTagName('meta');
for (let i = 0; i < metas.length; i++) {
try {
tag = metas[i].getAttribute('http-equiv');
if (tag.toUpperCase() === 'I2P-LOCATION') {
response = metas[i].getAttribute('content');
}
if (tag.toUpperCase() === 'X-I2P-LOCATION') {
response = metas[i].getAttribute('content');
}
}catch{
};
var tag = document.querySelector('meta[http-equiv="i2p-location"]');
if (tag != undefined) {
console.log(tag);
if (tag) response = tag.content;
}
var tag = document.querySelector('meta[http-equiv="x-i2p-location"]');
if (tag != undefined) {
console.log(tag);
if (tag) response = tag.content;
}
}
if (request.req === 'i2p-torrentlocation') {
response = 'no-alt-location';
const metas = document.getElementsByTagName('meta');
for (let i = 0; i < metas.length; i++) {
try {
tag = metas[i].getAttribute('http-equiv');
if (tag.toUpperCase() === 'I2P-TORRENTLOCATION') {
response = metas[i].getAttribute('content');
}
if (tag.toUpperCase() === 'X-I2P-TORRENTLOCATION') {
response = metas[i].getAttribute('content');
}
}catch{
};
var tag = document.querySelector('meta[http-equiv="i2p-torrentlocation"]');
if (tag != undefined) {
console.log(tag);
response = i2pTorrent(tag);
}
var tag = document.querySelector(
'meta[http-equiv="x-i2p-torrentlocation"]'
);
if (tag != undefined) {
console.log(tag);
response = i2pTorrent(tag);
}
}
return Promise.resolve({content: response});
return Promise.resolve({ content: response });
});
window.document.onload = function (e) {
console.log("presetting x-i2p-torrentlocation");
var tag = document.querySelector('meta[http-equiv="i2p-torrentlocation"]');
if (tag != undefined) {
console.log(tag);
response = i2pTorrent(tag);
}
var tag = document.querySelector('meta[http-equiv="x-i2p-torrentlocation"]');
if (tag != undefined) {
console.log(tag);
response = i2pTorrent(tag);
}
};
console.log("presetting x-i2p-torrentlocation");
var tag = document.querySelector('meta[http-equiv="i2p-torrentlocation"]');
if (tag != undefined) {
console.log(tag);
response = i2pTorrent(tag);
}
var tag = document.querySelector('meta[http-equiv="x-i2p-torrentlocation"]');
if (tag != undefined) {
console.log(tag);
response = i2pTorrent(tag);
}
function i2pTorrent(tag) {
let response = "no-alt-location";
if (tag) {
response = tag.content;
var imgs = document.getElementsByTagName("img");
console.log("rewriting torrent link");
for (let img of imgs) {
let tmpsrc = new URL(img.src);
if (tmpsrc.host == location.host) {
img.src =
"http://127.0.0.1:7657/i2psnark/" + tmpsrc.host + tmpsrc.pathname;
img.onerror = function () {
img.src = tmpsrc;
};
}
}
var videos = document.getElementsByTagName("video");
for (let video of videos) {
video.setAttribute("preload", "none");
let tmpsrc = new URL(video.currentSrc);
if (tmpsrc.host == location.host) {
if (!video.innerHTML.includes("127.0.0.1")) {
innerHTML = video.innerHTML;
topInnerHTML = video.innerHTML.replace(
'src="',
'src="http://127.0.0.1:7657/i2psnark/' + location.host + "/"
);
// let url = new URL("http://127.0.0.1:7657/i2psnark/"+location.host+"/"location.path)
console.log(
"http://127.0.0.1:7657/i2psnark/" + tmpsrc.host + tmpsrc.pathname
); //+"/"location.path)
video.src =
"http://127.0.0.1:7657/i2psnark/" + tmpsrc.host + tmpsrc.pathname;
video.innerHTML = topInnerHTML; // + innerHTML;
video.onerror = function () {
console.log("video error");
video.innerHTML = topInnerHTML + innerHTML;
};
}
}
}
var audios = document.getElementsByTagName("audio");
for (let audio of audios) {
audio.setAttribute("preload", "none");
let tmpsrc = new URL(audio.currentSrc);
if (tmpsrc.host == location.host) {
if (!audio.innerHTML.includes("127.0.0.1")) {
innerHTML = audio.innerHTML;
topInnerHTML = audio.innerHTML.replace(
'src="',
'src="http://127.0.0.1:7657/i2psnark/' + location.host + "/"
);
//console.log("http://127.0.0.1:7657/i2psnark/" + location); //.host+"/"location.path)
console.log(
"http://127.0.0.1:7657/i2psnark/" + tmpsrc.host + tmpsrc.pathname
); //+"/"location.path)
audio.src =
"http://127.0.0.1:7657/i2psnark/" + tmpsrc.host + tmpsrc.pathname;
audio.innerHTML = topInnerHTML; // + innerHTML;
audio.onerror = function () {
console.log("audio error");
audio.innerHTML = topInnerHTML + innerHTML;
};
}
}
}
var links = document.getElementsByTagName("a");
for (let link of links) {
let tmpsrc = new URL(link.href);
if (tmpsrc.host == location.host) {
if (
!tmpsrc.pathname.endsWith("html") &&
!tmpsrc.pathname.endsWith("htm") &&
!tmpsrc.pathname.endsWith("php") &&
!tmpsrc.pathname.endsWith("jsp") &&
!tmpsrc.pathname.endsWith("asp") &&
!tmpsrc.pathname.endsWith("aspx") &&
!tmpsrc.pathname.endsWith("atom") &&
!tmpsrc.pathname.endsWith("rss") &&
!tmpsrc.pathname.endsWith("/") &&
tmpsrc.pathname.includes(".")
) {
link.href =
"http://127.0.0.1:7657/i2psnark/" + tmpsrc.host + tmpsrc.pathname;
link.onerror = function () {
window.location.href = tmpsrc.href;
};
}
}
}
}
return response;
}

639
scrub.js
View File

@@ -4,42 +4,27 @@ var routerpref = chrome.i18n.getMessage('routerPreface');
var mailpref = chrome.i18n.getMessage('mailPreface');
var torrentpref = chrome.i18n.getMessage('torrentPreface');
var tunnelpref = chrome.i18n.getMessage('i2ptunnelPreface');
var localpref = chrome.i18n.getMessage('localPreface');
var ircpref = chrome.i18n.getMessage('ircPreface');
var extensionpref = chrome.i18n.getMessage('extensionPreface');
var muwirepref = chrome.i18n.getMessage('muwirePreface');
var botepref = chrome.i18n.getMessage('botePreface');
var contextScrub = async function(requestDetails) {
function onHeaderError() {
console.log('Header scrub error');
}
//console.log("(scrub)Scrubbing info from contextualized request");
try {
var headerScrub = function(context) {
var ua = 'MYOB/6.66 (AN/ON)';
if (!context) {
} else if (context.name == titlepref) {
if (i2pHost(requestDetails.url)) {
for (var header of requestDetails.requestHeaders) {
if (header.name.toLowerCase() === 'user-agent') {
header.value = ua;
console.log('(scrub)User-Agent header modified', header.value);
}
for (var header of requestDetails.requestHeaders) {
if (header.name.toLowerCase() === 'user-agent') {
header.value = ua;
}
}
return {
requestHeaders: requestDetails.requestHeaders
};
} else if (context.name == routerpref) {
if (i2pHost(requestDetails.url)) {
for (var header of requestDetails.requestHeaders) {
if (header.name.toLowerCase() === 'user-agent') {
header.value = ua;
console.log('(scrub)User-Agent header modified', header.value);
}
}
}
return {
requestHeaders: requestDetails.requestHeaders
requestHeaders: requestDetails.requestHeaders,
};
}
};
@@ -64,23 +49,10 @@ var contextScrub = async function(requestDetails) {
}
};
if (requestDetails.tabId > 0) {
var tab = {};
var context = {};
var req = {};
if (i2pHost(requestDetails.url)) {
//console.log("(scrub)I2P URL detected, ");
tab = tabGet(requestDetails.tabId);
context = tab.then(contextGet, onHeaderError);
req = await context.then(headerScrub, onHeaderError);
//console.log("(scrub)Scrubbing I2P Request", req);
return req;
} else if (routerHost(requestDetails.url)) {
tab = tabGet(requestDetails.tabId);
context = tab.then(contextGet, onHeaderError);
req = await context.then(headerScrub, onHeaderError);
//console.log("(scrub)Scrubbing non-I2P Request", req);
return req;
}
tab = tabGet(requestDetails.tabId);
context = tab.then(contextGet, onHeaderError);
req = context.then(headerScrub, onHeaderError);
//console.log("(scrub)Scrubbing I2P Request", req);
return req;
}
} catch (error) {
@@ -91,25 +63,28 @@ var contextScrub = async function(requestDetails) {
var notMyContextNotMyProblem = async function() {
var contexts = await browser.contextualIdentities.query({});
var context1 = await browser.contextualIdentities.query({
name: titlepref
name: titlepref,
});
var context2 = await browser.contextualIdentities.query({
name: routerpref
name: routerpref,
});
var context3 = await browser.contextualIdentities.query({
name: mailpref
name: mailpref,
});
var context4 = await browser.contextualIdentities.query({
name: torrentpref
name: torrentpref,
});
var context5 = await browser.contextualIdentities.query({
name: tunnelpref
name: tunnelpref,
});
var context6 = await browser.contextualIdentities.query({
name: localpref
name: ircpref,
});
var context7 = await browser.contextualIdentities.query({
name: muwirepref
name: muwirepref,
});
var context7 = await browser.contextualIdentities.query({
name: botepref,
});
var othercontexts = [];
console.log('Contexts:', contexts);
@@ -145,7 +120,7 @@ var contextSetup = function(requestDetails) {
var i2pTabFind = async function(tabId) {
try {
var context = await browser.contextualIdentities.query({
name: titlepref
name: titlepref,
});
if (tabId.cookieStoreId != context[0].cookieStoreId) {
function Create() {
@@ -159,7 +134,7 @@ var contextSetup = function(requestDetails) {
}
browser.pageAction.setPopup({
tabId: tabId.id,
popup: 'security.html'
popup: 'security.html',
});
browser.pageAction.show(tabId.id);
}
@@ -168,7 +143,7 @@ var contextSetup = function(requestDetails) {
var created = browser.tabs.create({
active: true,
cookieStoreId: context[0].cookieStoreId,
url: requestDetails.url
url: requestDetails.url,
});
created.then(onCreated, onContextError);
}
@@ -183,7 +158,7 @@ var contextSetup = function(requestDetails) {
var routerTabFind = async function(tabId) {
try {
var context = await browser.contextualIdentities.query({
name: routerpref
name: routerpref,
});
if (tabId.cookieStoreId != context[0].cookieStoreId) {
function Create() {
@@ -194,7 +169,7 @@ var contextSetup = function(requestDetails) {
console.log('in favor of', tab.id);
console.log('with context', tab.cookieStoreId);
browser.tabs.remove(tabId.id);
browser.tabs.move(tab.id, {index: 0});
browser.tabs.move(tab.id, { index: 0 });
}
for (index = 0; index < tabs.length; index++) {
if (index != tabs.length - 1)
@@ -202,7 +177,7 @@ var contextSetup = function(requestDetails) {
}
}
var pins = browser.tabs.query({
cookieStoreId: context[0].cookieStoreId
cookieStoreId: context[0].cookieStoreId,
});
pins.then(closeOldTab, onError);
}
@@ -215,7 +190,7 @@ var contextSetup = function(requestDetails) {
active: true,
pinned: true,
cookieStoreId: context[0].cookieStoreId,
url: requestDetails.url
url: requestDetails.url,
});
created.then(onCreated, onContextError);
}
@@ -230,7 +205,7 @@ var contextSetup = function(requestDetails) {
var i2ptunnelTabFind = async function(tabId) {
try {
var context = await browser.contextualIdentities.query({
name: tunnelpref
name: tunnelpref,
});
if (tabId.cookieStoreId != context[0].cookieStoreId) {
function Create() {
@@ -241,7 +216,7 @@ var contextSetup = function(requestDetails) {
console.log('in favor of', tab.id);
console.log('with context', tab.cookieStoreId);
browser.tabs.remove(tabId.id);
browser.tabs.move(tab.id, {index: 1});
browser.tabs.move(tab.id, { index: 0 });
}
for (index = 0; index < tabs.length; index++) {
if (index != tabs.length - 1)
@@ -249,7 +224,7 @@ var contextSetup = function(requestDetails) {
}
}
var pins = browser.tabs.query({
cookieStoreId: context[0].cookieStoreId
cookieStoreId: context[0].cookieStoreId,
});
pins.then(closeOldTab, onError);
}
@@ -262,7 +237,7 @@ var contextSetup = function(requestDetails) {
active: true,
pinned: true,
cookieStoreId: context[0].cookieStoreId,
url: requestDetails.url
url: requestDetails.url,
});
created.then(onCreated, onContextError);
}
@@ -277,45 +252,53 @@ var contextSetup = function(requestDetails) {
var snarkTabFind = async function(tabId) {
try {
var context = await browser.contextualIdentities.query({
name: torrentpref
name: torrentpref,
});
if (tabId.cookieStoreId != context[0].cookieStoreId) {
function Create() {
function onCreated(tab) {
function closeOldTab(tabs) {
if (tabId.id != tab.id) {
console.log('(isolate) Closing un-isolated tab', tabId.id);
console.log('in favor of', tab.id);
console.log('with context', tab.cookieStoreId);
browser.tabs.remove(tabId.id);
browser.tabs.move(tab.id, {index: 2});
}
for (index = 0; index < tabs.length; index++) {
if (index != tabs.length - 1)
browser.tabs.remove(tabs[index].id);
var exemptContext = await browser.contextualIdentities.query({
name: titlepref,
});
let tmp = new URL(tabId.url);
console.log('(isolate)tabid host', tmp.host);
if (!requestDetails.url.includes('snark/' + tmp.host)) {
// if (tabId.cookieStoreId != exemptContext[0].cookieStoreId){
function Create() {
function onCreated(tab) {
function closeOldTab(tabs) {
if (tabId.id != tab.id) {
console.log('(isolate) Closing un-isolated tab', tabId.id);
console.log('in favor of', tab.id);
console.log('with context', tab.cookieStoreId);
browser.tabs.remove(tabId.id);
browser.tabs.move(tab.id, { index: 0 });
}
for (index = 0; index < tabs.length; index++) {
if (index != tabs.length - 1)
browser.tabs.remove(tabs[index].id);
}
}
var pins = browser.tabs.query({
cookieStoreId: context[0].cookieStoreId,
});
pins.then(closeOldTab, onError);
}
var pins = browser.tabs.query({
cookieStoreId: context[0].cookieStoreId
if (requestDetails.url.endsWith('xhr1.html')) {
hostname = url.split('/')[2];
let prefix = url.substr(0, url.indexOf('://') + 3);
requestDetails.url = prefix + hostname + '/i2psnark/';
}
var created = browser.tabs.create({
active: true,
pinned: true,
cookieStoreId: context[0].cookieStoreId,
url: requestDetails.url,
});
pins.then(closeOldTab, onError);
created.then(onCreated, onContextError);
}
if (requestDetails.url.endsWith('xhr1.html')) {
hostname = url.split('/')[2];
let prefix = url.substr(0, url.indexOf('://') + 3);
requestDetails.url = prefix + hostname + '/i2psnark/';
}
var created = browser.tabs.create({
active: true,
pinned: true,
cookieStoreId: context[0].cookieStoreId,
url: requestDetails.url
});
created.then(onCreated, onContextError);
var gettab = browser.tabs.get(tabId.id);
gettab.then(Create, onContextError);
return tabId;
}
var gettab = browser.tabs.get(tabId.id);
gettab.then(Create, onContextError);
return tabId;
}
} catch (error) {
console.log('(isolate)Context Error', error);
@@ -324,7 +307,7 @@ var contextSetup = function(requestDetails) {
var muwireTabFind = async function(tabId) {
try {
var context = await browser.contextualIdentities.query({
name: muwirepref
name: muwirepref,
});
if (tabId.cookieStoreId != context[0].cookieStoreId) {
function Create() {
@@ -335,7 +318,7 @@ var contextSetup = function(requestDetails) {
console.log('in favor of', tab.id);
console.log('with context', tab.cookieStoreId);
browser.tabs.remove(tabId.id);
browser.tabs.move(tab.id, {index: 4});
browser.tabs.move(tab.id, { index: 0 });
}
for (index = 0; index < tabs.length; index++) {
if (index != tabs.length - 1)
@@ -343,7 +326,7 @@ var contextSetup = function(requestDetails) {
}
}
var pins = browser.tabs.query({
cookieStoreId: context[0].cookieStoreId
cookieStoreId: context[0].cookieStoreId,
});
pins.then(closeOldTab, onError);
}
@@ -356,7 +339,54 @@ var contextSetup = function(requestDetails) {
active: true,
pinned: true,
cookieStoreId: context[0].cookieStoreId,
url: requestDetails.url
url: requestDetails.url,
});
created.then(onCreated, onContextError);
}
var gettab = browser.tabs.get(tabId.id);
gettab.then(Create, onContextError);
return tabId;
}
} catch (error) {
console.log('(isolate)Context Error', error);
}
};
var i2pboteTabFind = async function(tabId) {
try {
var context = await browser.contextualIdentities.query({
name: botepref,
});
if (tabId.cookieStoreId != context[0].cookieStoreId) {
function Create() {
function onCreated(tab) {
function closeOldTab(tabs) {
if (tabId.id != tab.id) {
console.log('(isolate) Closing un-isolated tab', tabId.id);
console.log('in favor of', tab.id);
console.log('with context', tab.cookieStoreId);
browser.tabs.remove(tabId.id);
browser.tabs.move(tab.id, { index: 0 });
}
for (index = 0; index < tabs.length; index++) {
if (index != tabs.length - 1)
browser.tabs.remove(tabs[index].id);
}
}
var pins = browser.tabs.query({
cookieStoreId: context[0].cookieStoreId,
});
pins.then(closeOldTab, onError);
}
if (requestDetails.url.endsWith('xhr1.html')) {
hostname = url.split('/')[2];
let prefix = url.substr(0, url.indexOf('://') + 3);
requestDetails.url = prefix + hostname + '/i2pbote/';
}
var created = browser.tabs.create({
active: true,
pinned: true,
cookieStoreId: context[0].cookieStoreId,
url: requestDetails.url,
});
created.then(onCreated, onContextError);
}
@@ -371,7 +401,7 @@ var contextSetup = function(requestDetails) {
var mailTabFind = async function(tabId) {
try {
var context = await browser.contextualIdentities.query({
name: mailpref
name: mailpref,
});
if (tabId.cookieStoreId != context[0].cookieStoreId) {
function Create() {
@@ -382,7 +412,7 @@ var contextSetup = function(requestDetails) {
console.log('in favor of', tab.id);
console.log('with context', tab.cookieStoreId);
browser.tabs.remove(tabId.id);
browser.tabs.move(tab.id, {index: 3});
browser.tabs.move(tab.id, { index: 0 });
}
for (index = 0; index < tabs.length; index++) {
if (index != tabs.length - 1)
@@ -390,7 +420,7 @@ var contextSetup = function(requestDetails) {
}
}
var pins = browser.tabs.query({
cookieStoreId: context[0].cookieStoreId
cookieStoreId: context[0].cookieStoreId,
});
pins.then(closeOldTab, onError);
}
@@ -403,7 +433,7 @@ var contextSetup = function(requestDetails) {
active: true,
pinned: true,
cookieStoreId: context[0].cookieStoreId,
url: requestDetails.url
url: requestDetails.url,
});
created.then(onCreated, onContextError);
}
@@ -415,34 +445,45 @@ var contextSetup = function(requestDetails) {
console.log('(isolate)Context Error', error);
}
};
var localTabFind = async function(tabId) {
var ircTabFind = async function(tabId) {
try {
var context = await browser.contextualIdentities.query({
name: localpref
name: ircpref,
});
if (tabId.cookieStoreId != context[0].cookieStoreId) {
function Create() {
function onCreated(tab) {
function closeOldTab() {
if (tabId.id != tab.id) {
console.log('(isolate) Closing un-isolated tab', tabId.id);
console.log('in favor of', tab.id);
console.log('with context', tab.cookieStoreId);
browser.tabs.remove(tabId.id);
if (requestDetails.url.includes(':7669')) {
function Create() {
function onCreated(tab) {
function closeOldTab(tabs) {
if (tabId.id != tab.id) {
console.log('(isolate) Closing un-isolated tab', tabId.id);
console.log('in favor of', tab.id);
console.log('with context', tab.cookieStoreId);
browser.tabs.remove(tabId.id);
browser.tabs.move(tab.id, { index: 0 });
}
for (index = 0; index < tabs.length; index++) {
if (index != tabs.length - 1)
browser.tabs.remove(tabs[index].id);
}
}
var pins = browser.tabs.query({
cookieStoreId: context[0].cookieStoreId,
});
pins.then(closeOldTab, onError);
}
closeOldTab(tab);
var created = browser.tabs.create({
active: true,
pinned: true,
cookieStoreId: context[0].cookieStoreId,
url: requestDetails.url,
});
created.then(onCreated, onContextError);
}
var created = browser.tabs.create({
active: true,
cookieStoreId: context[0].cookieStoreId,
url: requestDetails.url
});
created.then(onCreated, onContextError);
var gettab = browser.tabs.get(tabId.id);
gettab.then(Create, onContextError);
return tabId;
}
var gettab = browser.tabs.get(tabId.id);
gettab.then(Create, onContextError);
return tabId;
}
} catch (error) {
console.log('(isolate)Context Error', error);
@@ -454,10 +495,10 @@ var contextSetup = function(requestDetails) {
}
try {
var anoncontext = await browser.contextualIdentities.query({
name: titlepref
name: titlepref,
});
var localcontext = await browser.contextualIdentities.query({
name: localpref
var irccontext = await browser.contextualIdentities.query({
name: ircpref,
});
var othercontexts = await notMyContextNotMyProblem();
var nmp = false;
@@ -471,7 +512,7 @@ var contextSetup = function(requestDetails) {
tabId.cookieStoreId == 'firefox-default' ||
tabId.cookieStoreId == 'firefox-private' ||
tabId.cookieStoreId == anoncontext[0].cookieStoreId ||
tabId.cookieStoreId == localcontext[0].cookieStoreId ||
tabId.cookieStoreId == irccontext[0].cookieStoreId ||
nmp
) {
console.log(
@@ -479,7 +520,7 @@ var contextSetup = function(requestDetails) {
tabId.cookieStoreId,
'not',
anoncontext[0].cookieStoreId,
localcontext[0].cookieStoreId
irccontext[0].cookieStoreId
);
return;
} else {
@@ -510,7 +551,7 @@ var contextSetup = function(requestDetails) {
var created = browser.tabs.create({
active: true,
cookieStoreId: 'firefox-default',
url: requestDetails.url
url: requestDetails.url,
});
created.then(onCreated, onContextError);
}
@@ -538,7 +579,7 @@ var contextSetup = function(requestDetails) {
setcookie = browser.cookies.set({
firstPartyDomain: i2pHostName(requestDetails.url),
url: requestDetails.url,
secure: true
secure: true,
});
setcookie.then(onContextGotLog, onContextError);
return requestDetails;
@@ -546,46 +587,62 @@ var contextSetup = function(requestDetails) {
if (requestDetails.tabId > 0) {
var tab = tabGet(requestDetails.tabId);
if (i2pHost(requestDetails.url)) {
var setcookie = browser.cookies.set({
firstPartyDomain: i2pHostName(requestDetails.url),
url: requestDetails.url,
secure: true
});
setcookie.then(onContextGotLog, onContextError);
var i2ptab = tab.then(i2pTabFind, onContextError);
return requestDetails;
}
if (extensionHost(requestDetails)) {
return requestDetails;
}
let localhost = localHost(requestDetails.url);
let routerhost = routerHost(requestDetails.url);
if (routerhost) {
if (routerhost === 'i2ptunnelmgr') {
var tunneltab = tab.then(i2ptunnelTabFind, onContextError);
return requestDetails;
} else if (routerhost === 'i2psnark') {
var snarktab = tab.then(snarkTabFind, onContextError);
return requestDetails;
} else if (routerhost === 'webmail') {
var mailtab = tab.then(mailTabFind, onContextError);
return requestDetails;
} else if (routerhost === 'muwire') {
var routertab = tab.then(muwireTabFind, onContextError);
return requestDetails;
} else if (routerhost === 'routerconsole') {
var routertab = tab.then(routerTabFind, onContextError);
tab.then(isolate);
function isolate(oldtab) {
// if (oldtab.cookieStoreId == 'firefox-default') {
if (i2pHost(requestDetails.url)) {
var thn = i2pHostName(requestDetails.url);
if (requestDetails.url.includes('=' + thn)) {
console.log('(scrub)checking search hostnames =' + thn);
var tpt = requestDetails.url.split('=' + thn, 2);
requestDetails.url =
'http://' + thn + '/' + tpt[1].replace('%2F', '');
}
console.log('(scrub) new hostname', requestDetails.url);
var setcookie = browser.cookies.set({
firstPartyDomain: i2pHostName(requestDetails.url),
url: requestDetails.url,
secure: true,
});
setcookie.then(onContextGotLog, onContextError);
var i2ptab = tab.then(i2pTabFind, onContextError);
return requestDetails;
}
} else {
if (localhost) {
var localtab = tab.then(localTabFind, onContextError);
if (extensionHost(requestDetails)) {
return requestDetails;
}
var normalTab = tab.then(normalTabFind, onContextError);
return requestDetails;
//return requestDetails;
let localhost = localHost(requestDetails.url);
let routerhost = routerHost(requestDetails.url);
if (routerhost) {
if (routerhost === 'i2ptunnelmgr') {
var tunneltab = tab.then(i2ptunnelTabFind, onContextError);
return requestDetails;
} else if (routerhost === 'i2psnark') {
var snarktab = tab.then(snarkTabFind, onContextError);
return requestDetails;
} else if (routerhost === 'webmail') {
var mailtab = tab.then(mailTabFind, onContextError);
return requestDetails;
} else if (routerhost === 'muwire') {
var routertab = tab.then(muwireTabFind, onContextError);
return requestDetails;
} else if (routerhost === 'i2pbote') {
var routertab = tab.then(i2pboteTabFind, onContextError);
return requestDetails;
} else if (routerhost === 'routerconsole') {
var routertab = tab.then(routerTabFind, onContextError);
return requestDetails;
}
} else {
if (localhost) {
var irctab = tab.then(ircTabFind, onContextError);
return requestDetails;
}
var normalTab = tab.then(normalTabFind, onContextError);
return requestDetails;
//return requestDetails;
}
//}
}
}
} catch (error) {
@@ -596,71 +653,220 @@ var contextSetup = function(requestDetails) {
var coolheadersSetup = function(e) {
var asyncSetPageAction = new Promise((resolve, reject) => {
window.setTimeout(() => {
for (i = 0; i < e.responseHeaders.length; i++) {
let header = e.responseHeaders[i];
if (e.url.startsWith('https')) {
if (header.name.toUpperCase() === 'I2P-LOCATION' || header.name.toUpperCase() === 'X-I2P-LOCATION') {
browser.pageAction.setPopup({
tabId: e.tabId,
popup: 'location.html'
});
browser.pageAction.setIcon({path: 'icons/i2plogo.png', tabId: e.tabId});
browser.pageAction.setTitle({
tabId: e.tabId,
title: header.value
});
browser.pageAction.show(e.tabId);
break;
}
if (header.name.toUpperCase() === 'I2P-TORRENTLOCATION' || header.name.toUpperCase() === 'X-I2P-TORRENTLOCATION') {
browser.pageAction.setPopup({
tabId: tabId.id,
popup: 'torrent.html'
});
browser.pageAction.setIcon({path: 'icons/i2plogo.png', tabId: e.tabId});
browser.pageAction.show(e.tabId);
browser.pageAction.setTitle({
tabId: e.tabId,
title: header.value
});
if (e.tabId != undefined) {
popup = browser.pageAction.getPopup({ tabId: e.tabId });
popup.then(gotPopup);
}
function gotPopup(p) {
console.log('(scrub) checking popup', p);
if (p.length != 0) return;
let headers = e.responseHeaders.filter((word) =>
word.name.toUpperCase().includes('I2P')
);
for (i = headers.length - 1; i >= 0; i--) {
let header = headers[i];
console.log('(scrub) checking header', header);
if (header.name.toUpperCase().endsWith('I2P-LOCATION')) {
var tab = browser.tabs.get(e.tabId);
tab.then(altSrc);
function altSrc(tab) {
console.log('(scrub) X-I2P-LOCATION');
let url = new URL(header.value);
browser.pageAction.setPopup({
tabId: e.tabId,
popup: 'location.html',
});
browser.pageAction.setIcon({
path: 'icons/i2plogo.png',
tabId: e.tabId,
});
let eurl = new URL(tab.url);
browser.pageAction.setTitle({
tabId: e.tabId,
title: 'http://' + url.host + eurl.pathname,
});
browser.pageAction.show(e.tabId);
}
break;
} else {
if (header.name.toUpperCase().endsWith('I2P-TORRENTLOCATION')) {
var imgs = document.getElementsByTagName('img');
for (let img of imgs) {
if (tmpsrc.host == location.host) {
img.src =
'http://127.0.0.1:7657/i2psnark/' +
tmpsrc.host +
tmpsrc.pathname;
img.onerror = function() {
img.src = tmpsrc;
};
}
}
var videos = document.getElementsByTagName('video');
for (let video of videos) {
let tmpsrc = new URL(video.currentSrc);
if (tmpsrc.host == location.host) {
if (!video.innerHTML.includes('127.0.0.1')) {
innerHTML = video.innerHTML;
topInnerHTML = video.innerHTML.replace(
'src="',
'src="http://127.0.0.1:7657/i2psnark/' +
location.host +
'/'
);
video.innerHTML = topInnerHTML; // + innerHTML;
video.onerror = function() {
video.innerHTML = topInnerHTML + innerHTML;
};
}
}
}
var audios = document.getElementsByTagName('audio');
for (let audio of audios) {
let tmpsrc = new URL(audio.currentSrc);
if (tmpsrc.host == location.host) {
if (!audio.innerHTML.includes('127.0.0.1')) {
innerHTML = audio.innerHTML;
topInnerHTML = audio.innerHTML.replace(
'src="',
'src="http://127.0.0.1:7657/i2psnark/' +
location.host +
'/'
);
audio.innerHTML = topInnerHTML; // + innerHTML;
audio.onerror = function() {
audio.innerHTML = topInnerHTML + innerHTML;
};
}
}
}
browser.pageAction.setPopup({
tabId: tabId.id,
popup: 'torrent.html',
});
browser.pageAction.setIcon({
path: 'icons/i2plogo.png',
tabId: e.tabId,
});
browser.pageAction.setTitle({
tabId: e.tabId,
title: header.value,
});
browser.pageAction.show(e.tabId);
break;
}
}
}
}
resolve({responseHeaders: e.responseHeaders});
resolve({ responseHeaders: e.responseHeaders });
}, 2000);
});
return asyncSetPageAction;
};
function getTabURL(tab) {
if (tab.url.startsWith("https")) {
try {
browser.tabs
.sendMessage(tab.id, { req: "i2p-location" })
.then((response) => {
if (response != undefined) {
console.log("(scrub) i2p-location response object", response);
if (response.content.toUpperCase() != "NO-ALT-LOCATION") {
browser.pageAction.setPopup({
tabId: tab.id,
popup: "location.html",
});
browser.pageAction.setIcon({
path: "icons/i2plogo.png",
tabId: tab.id,
});
browser.pageAction.setTitle({
tabId: tab.id,
title: response.content,
});
browser.pageAction.show(tab.id);
}
}
});
console.log("(pageaction)", tab.id, tab.url);
} catch (e) {
console.log("(pageaction)", e);
}
} else {
try {
browser.tabs
.sendMessage(tab.id, { req: "i2p-torrentlocation" })
.then((response) => {
if (response != undefined) {
console.log("(scrub) i2p-location response object", response);
if (response.content.toUpperCase() != "NO-ALT-LOCATION") {
browser.pageAction.setPopup({
tabId: tab.id,
popup: "torrent.html",
});
browser.pageAction.setIcon({
path: "icons/i2plogo.png",
tabId: tab.id,
});
browser.pageAction.setTitle({
tabId: tab.id,
title: response.content,
});
browser.pageAction.show(tab.id);
}
}
});
console.log("(pageaction)", tab.id, tab.url);
} catch (e) {
console.log("(pageaction)", e);
}
}
}
function getClearTab(tobj) {
function getTabURL(tab) {
if (tab.url.startsWith("https")){
browser.tabs.sendMessage( tab.id, {'req':'i2p-location'}).then( response => {
if (response.content.toUpperCase() != "NO-ALT-LOCATION"){
browser.pageAction.setPopup({
tabId: tab.id,
popup: 'location.html'
});
browser.pageAction.setIcon({path: 'icons/i2plogo.png', tabId: tab.id});
browser.pageAction.setTitle({
tabId: tab.id,
title: response.content
});
browser.pageAction.show(tab.id);
}
});
console.log("(pageaction)", tab.id, tab.url)
function setupTabs(tobj) {
if (typeof tobj == "number") {
browser.tabs.get(tobj).then(getTabURL, onError);
}
if (typeof tobj.tabId == "number") {
console.log("(scrub) tobj", tobj);
browser.tabs.get(tobj.tabId).then(getTabURL, onError);
} else {
for (let tab in tobj.tabIds) {
console.log("(scrub) tab", tobj.tabIds[tab]);
browser.tabs.get(tobj.tabIds[tab]).then(getTabURL, onError);
}
}
}
browser.tabs.get(tobj.tabId).then(getTabURL, onError)
if (tobj != undefined) {
setupTabs(tobj);
} else {
browser.tabs.query({}).then(setupTabs);
}
}
const filter = {
url: [{ hostContains: ".i2p" }],
};
function logOnDOMContentLoaded(details) {
console.log(`onDOMContentLoaded: ${details.url}`);
}
browser.tabs.onActivated.addListener(getClearTab);
browser.tabs.onAttached.addListener(getClearTab);
browser.tabs.onCreated.addListener(getClearTab);
browser.tabs.onDetached.addListener(getClearTab);
browser.tabs.onHighlighted.addListener(getClearTab);
browser.tabs.onMoved.addListener(getClearTab);
browser.tabs.onReplaced.addListener(getClearTab);
browser.pageAction.onClicked.addListener(getClearTab);
function reloadTabs(tabs) {
for (let tab of tabs) {
browser.tabs.reload(tab.id)
browser.tabs.reload(tab.id);
}
}
@@ -671,23 +877,26 @@ function reloadError(error) {
let querying = browser.tabs.query({});
querying.then(reloadTabs, onError);
// Listen for onHeaderReceived for the target page.
// Set "blocking" and "responseHeaders".
browser.webRequest.onHeadersReceived.addListener(
coolheadersSetup,
{urls: ['<all_urls>']},
["blocking", "responseHeaders"]
{ urls: ["*://*.i2p/*", "https://*/*"] },
["responseHeaders"]
);
browser.webRequest.onBeforeRequest.addListener(
contextSetup,
{ urls: ['<all_urls>'] },
['blocking']
browser.webNavigation.onDOMContentLoaded.addListener(getClearTab, filter);
browser.webNavigation.onDOMContentLoaded.addListener(
logOnDOMContentLoaded,
filter
);
browser.webRequest.onBeforeRequest.addListener(contextSetup, {
urls: ["*://*.i2p/*", "*://localhost/*", "*://127.0.0.1/*", "*://*/*i2p*"],
});
browser.webRequest.onBeforeSendHeaders.addListener(
contextScrub,
{ urls: ['<all_urls>'] },
['blocking', 'requestHeaders']
{ urls: ["*://*.i2p/*"] },
["requestHeaders"]
);

View File

@@ -20,7 +20,6 @@
color: #fff
}
.topnav input[type=search] {
width: 75%;
padding: 6px;
border: none;
margin-top: 8px;
@@ -35,17 +34,9 @@
color: #e6e6e7;
margin-right: 16px
}
@media screen and (max-width: 600px) {
.topnav a,
.topnav input[type=text] {
float: none;
display: block;
text-align: left;
width: 100%;
margin: 0;
padding: 14px
}
.topnav input[type=text] {
border: 1px solid #ccc
}
#search-query {
color: #1f1a24
}
#search-submit {
color: #1f1a24
}

View File

@@ -3,8 +3,7 @@
<head>
<meta charset="utf-8">
<link href="search.css" rel="stylesheet">
<link href="home.css" rel="stylesheet">
<link href="info.css" rel="stylesheet"><!--<link href="torrent/popup.css" rel="stylesheet">-->
<link href="home.css" rel="stylesheet"><!--<link href="info.css" rel="stylesheet">--><!--<link href="torrent/popup.css" rel="stylesheet">-->
<title>
</title>

View File

@@ -2,6 +2,22 @@ li {
width: 90%;
margin-left: 0
}
ul {
width: 100%
}
button {
width: 50%;
text-align: center
}
#applicationExplain {
float: unset
}
.button-list {
display: inline
}
#hidden {
display: none
}
.hidden {
display: none
}

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8">
<link href="search.css" rel="stylesheet">
<link href="home.css" rel="stylesheet">
<link href="info.css" rel="stylesheet"><!--<link href="torrent/popup.css" rel="stylesheet">-->
<!--<link href="info.css" rel="stylesheet">--><!--<link href="torrent/popup.css" rel="stylesheet">-->
<title>
</title>

View File

@@ -0,0 +1,19 @@
function gotCurrent(tab) {
function gotTitle(title) {
let addr = title;
document.getElementById('TypeInfo').innerHTML =
'<div class="AddressInfo"><a href="' + addr + '">' + addr + '</a></div>';
}
console.log(tab);
var gettingTitle = browser.pageAction.getTitle({
tabId: tab[0].id,
});
gettingTitle.then(gotTitle);
}
function tabError(error) {
console.log(`Error : ${error}`);
}
const gettingCurrent = browser.tabs.query({ active: true });
gettingCurrent.then(gotCurrent, tabError);

View File

@@ -21,7 +21,7 @@ setupExtractor();
function extractSession(requestDetails) {
const hdr = requestDetails.requestHeaders.filter(
x => x.name.toLowerCase() === "x-transmission-session-id"
(x) => x.name.toLowerCase() === "x-transmission-session-id"
)[0];
if (!hdr) {
return;
@@ -58,21 +58,21 @@ function addUrl(torrentUrl, downloadDir) {
console.log("Downloading torrent", torrentUrl);
p = fetch(torrentUrl, {
method: "GET",
credentials: "include"
credentials: "include",
})
.then(resp => {
.then((resp) => {
if (resp.ok) {
return resp.blob();
}
throw new Error("Could not download torrent");
})
.then(blobToBase64)
.then(b64 => {
.then((b64) => {
params.metainfo = b64;
return rpcCall("torrent-add", params);
});
}
return p.then(x => {
return p.then((x) => {
updateBadge();
return x;
});
@@ -85,7 +85,7 @@ function handleUrl(requestDetails) {
decodeURIComponent(
requestDetails.url.replace("http://transmitter.web-extension/", "")
)
).then(x => {
).then((x) => {
return browser.storage.local.get("server").then(({ server }) => {
return { redirectUrl: server.base_url + "web/" };
});
@@ -107,19 +107,19 @@ function createContextMenu() {
browser.contextMenus.create({
id: "transmitter-add",
title: "Download with Transmission remote",
contexts: ["link"]
contexts: ["link"],
});
} else {
browser.contextMenus.create({
id: "transmitter-add",
title: "Download to Default location",
contexts: ["link"]
contexts: ["link"],
});
server.locations.forEach(location => {
server.locations.forEach((location) => {
browser.contextMenus.create({
id: "transmitter-add-loc-" + location.index,
title: "Download to " + location.name,
contexts: ["link"]
contexts: ["link"],
});
});
}
@@ -152,42 +152,42 @@ function updateBadge() {
) {
return;
}
return rpcCall("session-stats", {}).then(response => {
return rpcCall("session-stats", {}).then((response) => {
const args = response.arguments; // lol the name 'arguments' means destructuring in strict mode is impossible
switch (server.badge) {
case "num":
browser.browserAction.setBadgeBackgroundColor({ color: "gray" });
browser.browserAction.setBadgeText({
text: "" + args.activeTorrentCount
text: "" + args.activeTorrentCount,
});
break;
case "dl":
browser.browserAction.setBadgeBackgroundColor({ color: "green" });
browser.browserAction.setBadgeText({
text: formatSpeed(args.downloadSpeed)
text: formatSpeed(args.downloadSpeed),
});
break;
case "ul":
browser.browserAction.setBadgeBackgroundColor({ color: "blue" });
browser.browserAction.setBadgeText({
text: formatSpeed(args.uploadSpeed)
text: formatSpeed(args.uploadSpeed),
});
break;
case "auto":
if (args.downloadSpeed > 0) {
browser.browserAction.setBadgeBackgroundColor({ color: "green" });
browser.browserAction.setBadgeText({
text: formatSpeed(args.downloadSpeed)
text: formatSpeed(args.downloadSpeed),
});
} else if (args.uploadSpeed > 0) {
browser.browserAction.setBadgeBackgroundColor({ color: "blue" });
browser.browserAction.setBadgeText({
text: formatSpeed(args.uploadSpeed)
text: formatSpeed(args.uploadSpeed),
});
} else {
browser.browserAction.setBadgeBackgroundColor({ color: "gray" });
browser.browserAction.setBadgeText({
text: "" + args.activeTorrentCount
text: "" + args.activeTorrentCount,
});
}
break;
@@ -196,20 +196,20 @@ function updateBadge() {
});
}
browser.alarms.onAlarm.addListener(alarm => {
browser.alarms.onAlarm.addListener((alarm) => {
if (alarm.name === "transmitter-badge-update") {
return updateBadge();
}
});
function setupBadge() {
browser.alarms.clear("transmitter-badge-update").then(x => {
browser.alarms.clear("transmitter-badge-update").then((x) => {
browser.storage.local.get("server").then(({ server }) => {
if (!server) {
return;
}
browser.alarms.create("transmitter-badge-update", {
periodInMinutes: parseInt(server.badge_interval || "1")
periodInMinutes: parseInt(server.badge_interval || "1"),
});
updateBadge();
});

View File

@@ -6,7 +6,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 !== '') {
@@ -19,7 +19,7 @@ function rpcCall(meth, args) {
method: 'POST',
headers: myHeaders,
body: JSON.stringify({ method: meth, 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');

View File

@@ -4,7 +4,7 @@ var TrpcCall = async function(meth, args) {
const server = await browser.storage.local.get(null);
const myHeaders = {
'Content-Type': 'application/json',
'x-transmission-session-id': server.session
'x-transmission-session-id': server.session,
};
console.log('(torrent) session', server.session);
if (server.username !== '' || server.btrpcpass !== '') {
@@ -16,7 +16,7 @@ var TrpcCall = async function(meth, args) {
method: 'POST',
headers: myHeaders,
body: JSON.stringify({ method: meth, arguments: args }),
credentials: 'include' // allows HTTPS client certs!
credentials: 'include', // allows HTTPS client certs!
});
/*.then(function(response) {
@@ -38,7 +38,7 @@ const torrentsPane = document.getElementById('torrents-pane');
const configPane = document.getElementById('config-pane');
for (const opener of document.querySelectorAll('.config-opener')) {
opener.addEventListener('click', e => {
opener.addEventListener('click', (e) => {
browser.runtime.openOptionsPage();
});
}
@@ -53,7 +53,13 @@ const torrentsList = document.getElementById("torrents-list");
const torrentsTpl = document.getElementById("torrents-tpl");
const torrentsError = document.getElementById("torrents-error");
const getArgs = {
fields: ["name", "percentDone", "rateDownload", "rateUpload", "queuePosition"]
fields: [
"name",
"percentDone",
"rateDownload",
"rateUpload",
"queuePosition",
],
};
let cachedTorrents = [];
@@ -90,7 +96,7 @@ function searchTorrents() {
let newTorrents = cachedTorrents;
const val = torrentsSearch.value.toLowerCase().trim();
if (val.length > 0) {
newTorrents = newTorrents.filter(x => x.name.toLowerCase().includes(val));
newTorrents = newTorrents.filter((x) => x.name.toLowerCase().includes(val));
}
renderTorrents(newTorrents);
}
@@ -99,16 +105,16 @@ torrentsSearch.addEventListener("keyup", searchTorrents);
function refreshTorrents(server) {
console.log("(torrent) initiating", server);
return TrpcCall("torrent-get", getArgs).then(function(response) {
return TrpcCall("torrent-get", getArgs).then(function (response) {
const session = response.headers.get("x-transmission-session-id");
if (session) {
browser.storage.local.get({}).then(function(storage) {
browser.storage.local.get({}).then(function (storage) {
storage.session = session;
browser.storage.local.set(storage);
});
}
let sponse = response.json();
sponse.then(function(response) {
sponse.then(function (response) {
console.log("(torrent) refreshing", response);
let newTorrents = response.arguments.torrents;
newTorrents.sort((x, y) => y.queuePosition - x.queuePosition);
@@ -125,7 +131,7 @@ function refreshTorrents(server) {
}
function refreshTorrentsLogErr(server) {
return refreshTorrents(server).catch(err => {
return refreshTorrents(server).catch((err) => {
console.error(err);
torrentsError.textContent = "Error: " + err.toString();
});
@@ -138,12 +144,12 @@ function showTorrents(server) {
opener.href = server.base_url + "web/";
}
console.log("(torrent) showing torrents");
refreshTorrents(server).catch(_ => refreshTorrentsLogErr(server));
refreshTorrents(server).catch((_) => refreshTorrentsLogErr(server));
setInterval(() => refreshTorrentsLogErr(server), 2000);
}
//let store =
browser.storage.local.get(function(server) {
browser.storage.local.get(function (server) {
console.log("(torrent) querying storage", server);
if (server && server.base_url && server.base_url !== "") {
showTorrents(server);

View File

@@ -18,7 +18,7 @@
<div id="browserpanel">
<div class="panel">
<div class="section-header panel-section panel-section-header" id="headline">
<div class="text-section-header" id="text-section-header">
<div class="text-section-header">
<h1 id="text-section-header">The Invisible Internet Browser</h1>
</div>
</div>
@@ -40,6 +40,7 @@
<div id="i2pbrowser-description">
<p id="description">You are now able to use I2P in this browser.</p>
<button class="hidden" id="visit-irc">Visit IRC</button>
</div>
</div>
@@ -70,16 +71,9 @@
<li class="application"><input id="disable-history" name="disablehistory" type="checkbox" value="history"> <label for="disable-history">Disable History in I2P Tabs</label> <span class="applicationDesc" id="histDesc">History is automatically cleared when your I2P tabs are closed. If you want to clear history as you go, check this box.</span></li>
</ul>
<p>
</p>
<p>
</p>
</div>
<div class="panel-section-separator">
</div>
<!--<div class="panel-section-separator">
</div>-->
<div class="application-info">
<p class="hideIfI2PConsoleOff">
@@ -100,25 +94,21 @@
<li class="application"><button class="applicationName" id="window-visit-snark" target="_blank">BitTorrent</button> <span class="applicationDesc" id="snark">I2P is capable of anonymous Peer-to-Peer file sharing, to use the built-in bittorrent client go here:</span></li>
</ul>
<p>
</p>
<p>
</p>
</div>
</div>
</div>
<br>
<div id="torrentpanel">
<div class="panel" id="torrentstatus">
<div class="section-header panel-section panel-section-header">
<div class="text-section-header" id="text-section-torrents-header">
<h3>Torrent Downloads</h3>
<h1>Torrent Downloads</h1>
</div>
</div>
<div hidden="" id="config-pane">
<div id="config-pane">
<strong>Torrent RPC Configuration</strong>
<br>
The server address is not set yet.
@@ -126,7 +116,7 @@
<a class="config-opener" href="#">Open the settings</a> to continue.
</div>
<div hidden="" id="torrents-pane">
<div id="torrents-pane">
<header>
<h1>Torrent Controls</h1>
<a class="webui-opener" href="#" target="_blank"><img alt="Open Web UI" src="images/i2plogo.png"></a> <!--<a class="config-opener" href="#">

BIN
x-i2p-torrentlocation.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 KiB