103 Commits

Author SHA1 Message Date
c2363881f6 Add github sync for i2pbutton
Some checks failed
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
2025-05-10 18:53:21 -04:00
152b67f76e Fix potential bug with config 2020-02-08 01:51:39 +01:00
103a92ba41 Version 0.3.9 2020-01-31 17:15:28 +01:00
cbf0c1e9a2 Reseed update part 2 2020-01-24 21:02:42 +01:00
886ddf5673 Reseed update 2020-01-24 20:16:04 +01:00
26458e21ef Remove unused code to avoid error at exit 2020-01-21 08:16:33 +01:00
b411b12c08 Update(s) for ESR 68.4 2020-01-21 08:11:35 +01:00
76a94416a5 Update for ESR 68.4 2020-01-21 08:03:28 +01:00
943261b762 i2pbutton_log 2020-01-21 08:00:20 +01:00
3455a60ff0 Merge branch 'master' of github.com:i2p/i2pbutton 2020-01-21 07:55:43 +01:00
29809d1d0f ESR 68.4 needed changes 2020-01-21 07:55:20 +01:00
6b9fbb2b85 Fix NS_NOINTERFACE error 2019-12-14 18:53:38 +01:00
459c9563ba Merge pull request #22 from mikalv/master
ESR 68
2019-12-14 18:45:08 +01:00
8bfed9885c Fix logging part 3 2019-12-14 18:43:30 +01:00
1b72915e7b Fix logging part 2 2019-12-14 18:43:03 +01:00
cf1e0666ab Fix logging 2019-12-14 18:41:46 +01:00
571bd40736 Merge pull request #21 from mikalv/master
more ESR68
2019-12-14 18:35:16 +01:00
3b417ca6f4 Avoid redeclaration error 2019-12-14 18:31:24 +01:00
1d90ec8eef Update dragDropFilter 2019-12-14 18:29:32 +01:00
f8db8d8b5d Merge pull request #20 from mikalv/master
Fixes for ESR 68
2019-12-14 18:26:16 +01:00
68300c10a8 Update the router process component 2019-12-14 18:25:42 +01:00
84e4a262b6 Update dragDropFilter 2019-12-14 18:23:09 +01:00
d38605742d Merge pull request #19 from mikalv/master
Remove unused xul files part 2
2019-12-14 17:56:34 +01:00
f29c7c001e Remove unused xul files part 2 2019-12-14 17:56:09 +01:00
9834a845ff Merge pull request #18 from mikalv/master
Remove unused xul files
2019-12-14 17:27:06 +01:00
4c213d6eca Remove unused xul files 2019-12-14 17:26:36 +01:00
65b5162cad Merge pull request #17 from mikalv/master
fix translation
2019-12-14 17:19:32 +01:00
bf5838f555 fix translation 2019-12-14 17:19:00 +01:00
1a7b1b8126 Merge pull request #16 from mikalv/master
ESR68 integration changes
2019-12-14 17:12:47 +01:00
b6c7edf6af fix missing ; in pref 2019-12-14 17:12:30 +01:00
755440fbd6 New strings for ESR68 integration 2019-12-14 16:54:00 +01:00
idk
a7d46901df Merge pull request #15 from eyedeekay/undorename
Hold off on the re-name until we're ready.
2019-12-13 19:05:34 +00:00
idk
94c4c0dd50 Hold off on the re-name until we're ready. 2019-12-13 14:03:41 -05:00
idk
e2ab83ab39 Merge pull request #13 from eyedeekay/snark
switch snark to use the light homepage instead of the aubergine homepage
2019-11-26 01:17:37 +00:00
idk
0b5b46260e switch snark to use the light homepage instead of the aubergine homepage 2019-11-25 15:01:11 -05:00
idk
38c8039f95 Merge pull request #12 from eyedeekay/susimail
Successfully tested
2019-11-25 13:56:35 -05:00
idk
52e51d4ff2 enable susimail, set susimail initial configuration up 2019-11-25 12:32:14 -05:00
idk
cb6cfb3213 Merge pull request #11 from eyedeekay/show-version
show the version of the I2P router in use
2019-11-23 18:19:33 -05:00
idk
f3a3b2e34c show the version of the I2P router in use 2019-11-23 18:17:40 -05:00
idk
a639a35bb7 Merge pull request #10 from eyedeekay/license
Add a LICENSE file
2019-11-22 12:07:33 -05:00
idk
e441bab7ec Add a LICENSE file 2019-11-22 11:40:41 -05:00
idk
d4d9f03afa Merge pull request #9 from eyedeekay/smart-homepage
Merged with the name change/goal shift in place.
2019-11-22 01:18:18 -05:00
idk
6825e9eab4 Prep it for the new goals/features/name, shorten some strings, fix some slightly wonky css 2019-11-22 00:27:33 -05:00
idk
0db34c6506 hide the old, hard to update, pointless onboarding slideshowfrom Tor 2019-11-21 23:43:06 -05:00
idk
90eb1f7182 Merge pull request #8 from eyedeekay/readme-devs
Improve the detail for testing new features in the readme
2019-11-20 17:58:33 -05:00
idk
411d6b5549 beautify css 2019-11-20 16:42:48 -05:00
idk
86a1336e01 fix onboarding test 2019-11-20 16:14:21 -05:00
idk
77c0ed7893 switch links to go directly to the standalone homepage for applications 2019-11-20 15:48:41 -05:00
idk
11d059cf9c re-add onboarding info to about:I2p home page 2019-11-20 15:22:57 -05:00
idk
7a2b341839 hide links by default, show them when links header is clicked 2019-11-20 14:32:38 -05:00
idk
54527c6af3 Fix the outcome of the proxy readiness function 2019-11-20 13:41:22 -05:00
idk
fb1bbaf574 work on proxy test 2019-11-20 00:59:09 -05:00
idk
a23de26582 Change the text on the homepage. 2019-11-19 22:45:56 -05:00
idk
4864a86096 Make a smarter, prettier homepage 2019-11-19 22:37:12 -05:00
idk
2b57d75c08 Make a smarter, prettier homepage 2019-11-19 22:13:02 -05:00
idk
f2bd48ada9 undo change from wrong branch 2019-11-17 18:43:23 -05:00
idk
3a38a01c51 update the readme to help new devs 2019-11-17 18:38:12 -05:00
eabb67ceb9 Merge pull request #7 from mikalv/master
Beta 7 changes (i2pbutton 0.3.8)
2019-11-03 01:43:28 +01:00
a6d97dc00a version bump 2019-11-03 00:42:12 +01:00
92a908907b A lot of bugfixing around the initial dialog and portchecking of the i2p console 2019-11-01 22:02:41 +01:00
b40d5578f8 Fixes noscript issue 2019-10-27 13:44:01 +01:00
199f3b839e Add services 2019-10-27 13:32:53 +01:00
dbf0d53e5c Make the progress dialog show until console is up 2019-10-27 13:31:47 +01:00
00f3ac2afb Adding waitForPortToOpen function 2019-10-27 13:25:43 +01:00
191a6e15e9 Merge pull request #4 from mikalv/master
Json RPC client for i2p control
2019-10-27 13:25:19 +01:00
32bb96b18e Adding reseed and restart methods 2019-10-27 12:55:23 +01:00
52c3c6a6c2 Merge remote-tracking branch 'upstream/master' 2019-10-27 12:53:54 +01:00
301bcf6d33 Adding json rpc client for use with i2p control 2019-10-27 12:49:02 +01:00
b52f7f7510 Merge pull request #3 from eyedeekay/master
Minor tweak to the about:i2p display
2019-10-18 10:18:58 +02:00
idk
116f787d25 Minor tweak to the about:i2p display 2019-09-16 13:02:14 -04:00
abc0ce454f Re-adding temporary fix for jetty 2019-09-15 18:25:57 +02:00
b90ed676fd version bump 2019-09-14 23:04:28 +02:00
91b0d0500e Update port numbers 2019-09-14 23:03:41 +02:00
1cafe3fd25 version bump 2019-09-13 12:07:12 +02:00
3a1ce635b1 Adding missing functions 2019-09-12 22:59:05 +02:00
506f675664 Adding missing functions 2019-09-12 22:58:42 +02:00
822fd90f6d function for listing addons 2019-09-12 22:58:16 +02:00
953da8a8e2 Added missing functions etc 2019-09-12 22:50:10 +02:00
ee146800ee Integration with the delay dialog 2019-09-12 22:49:23 +02:00
8ef76f4ebb Added progress dialog aka delay the user dialog 2019-09-12 22:48:07 +02:00
348846f5d3 Misc refactoring and fixes 2019-09-11 22:29:21 +02:00
e42e60276b Refactor away some duplicated code 2019-09-11 22:28:41 +02:00
235bbda10b Bugfixes, cleanup and improvements for the launcher part of the code 2019-09-11 00:04:59 +02:00
ced728b0f4 Functions for reading the router log files 2019-09-10 22:03:22 +02:00
015fa2166b version bump 2019-09-10 22:02:58 +02:00
637ff45592 Misc 2019-09-10 17:45:01 +02:00
78959d60c7 Use the subprocess as indicator for console 2019-09-10 17:44:40 +02:00
00283bde24 Write webapps.config as well 2019-09-10 07:15:57 +02:00
2c0666dcf2 Router config: routerconsole.welcomeWizardComplete=true 2019-09-10 05:56:47 +02:00
b06dded801 Router config: router.startup.jetty9.migrated=true 2019-09-10 05:53:53 +02:00
4bed82f527 Use different i2cp port 2019-09-10 05:52:26 +02:00
ed36de6cae Merge branch 'master' of github.com:mikalv/i2pbutton 2019-09-10 01:04:28 +02:00
676c2348d8 Use more secure permissions 2019-09-10 01:03:34 +02:00
e7d888c776 Merge pull request #2 from eyedeekay/master
Fix links on about:i2p to correspond to i2p browser router console
2019-09-09 05:12:25 +02:00
idk
6adb55d048 correct the links on the about:i2p page and direct new users to the router console for now 2019-09-08 22:56:36 -04:00
idk
4a680de5a2 Merge branch 'master' of https://github.com/mikalv/i2pbutton 2019-09-08 22:08:07 -04:00
79a32618f8 version bump 2019-09-09 03:16:54 +02:00
8d249f4831 omfg 2019-09-09 03:16:23 +02:00
67ed95fc25 version bump 2019-09-09 03:01:08 +02:00
5b6504a11d Temporary jetty fix 2019-09-09 02:54:05 +02:00
832c79f4b5 Make webapps, docs and hosts.txt get copied to config directory when it don't exists 2019-09-09 02:47:16 +02:00
988047ec4e Correct /tunnel/clients/ 2019-09-09 01:39:45 +02:00
idk
c19ea1d76c Merge branch 'master' of https://github.com/mikalv/i2pbutton 2019-09-06 13:25:41 -04:00
35 changed files with 1782 additions and 756 deletions

66
.github/workflows/sync.yaml vendored Normal file
View File

@ -0,0 +1,66 @@
# GitHub Actions workflow file to sync an external repository to this GitHub mirror.
# This file was automatically generated by go-github-sync.
#
# The workflow does the following:
# - Runs on a scheduled basis (and can also be triggered manually)
# - Clones the GitHub mirror repository
# - Fetches changes from the primary external repository
# - Applies those changes to the mirror repository
# - Pushes the updated content back to the GitHub mirror
#
# Authentication is handled by the GITHUB_TOKEN secret provided by GitHub Actions.
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Validate Github Actions Environment
run: if [ "$GITHUB_ACTIONS" != "true" ]; then echo 'This script must be run in a GitHub Actions environment.'; exit 1; fi
- name: Checkout GitHub Mirror
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure Git
run: |-
git config user.name 'GitHub Actions'
git config user.email 'actions@github.com'
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Sync Primary Repository
run: |-
# Add the primary repository as a remote
git remote add primary https://i2pgit.org/I2P_Developers/i2pbutton.git
# Fetch the latest changes from the primary repository
git fetch primary
# Check if the primary branch exists in the primary repository
if git ls-remote --heads primary master | grep -q master; then
echo "Primary branch master found in primary repository"
else
echo "Error: Primary branch master not found in primary repository"
exit 1
fi
# Check if we're already on the mirror branch
if git rev-parse --verify --quiet master; then
git checkout master
else
# Create the mirror branch if it doesn't exist
git checkout -b master
fi
# Force-apply all changes from primary, overriding any conflicts
echo "Performing force sync from primary/master to master"
git reset --hard primary/master
# Push changes back to the mirror repository
git push origin master
name: Sync Primary Repository to GitHub Mirror
"on":
push: {}
schedule:
- cron: 0 * * * *
workflow_dispatch: {}

18
LICENSE Normal file
View File

@ -0,0 +1,18 @@
Copyright 2019 The I2P Project, meeh, idk
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,12 +1,60 @@
# I2Pbutton
I2PButton is an XUL plugin which we incorporate into the I2P Browser in order
to enable I2P-specific features and improve the user experience of the I2P
Browser. It can only be used in I2P Browser where it is specifically enabled,
but developers can build the plugin from source and side-load it to test their
changes.
## Development howto
You can build and update i2pbutton without the need of recompiling firefox for most tasks luckly :)
You can build and update i2pbutton without the need of recompiling I2P browser
for most tasks.
To do this build it and copy it into your data directory. Note that these
examples assume that you only have one version of the .xpi file in the pkg/
directory where the finished product is built.
### OSX
On OSX, you will have an I2P Browser Data directory under ~/I2PBrowser-Data and
you can swap the plugin by copying it over the plugin in your working profile,
like in the following example:
To do this build it and copy it into your data directory:
```
./makexpi.sh
cp pkg/i2pbutton-0.2.xpi ~/I2PBrowser-Data/Browser/914o5i1s.default/extensions/i2pbutton@geti2p.net.xpi
cp pkg/i2pbutton-*.xpi ~/I2PBrowser-Data/Browser/914o5i1s.default/extensions/i2pbutton@geti2p.net.xpi
```
### Linux
Although the browser on Linux can be run from any location available to the
user, it was probably downloaded and extracted to your ~/Downloads/ directory.
If that is the case, then you may simply:
```
./makexpi.sh
find $HOME/Downloads/i2p-browser_en-US/ -name 'i2pbutton*.xpi' -exec cp -v {} i2pbutton.xpi.bak \;
find $HOME/Downloads/i2p-browser_en-US/ -name 'i2pbutton*.xpi' -exec cp -v pkg/i2pbutton-*.xpi {} \;
```
to automatically replace the I2PButton in your I2P browser with your working
copy. If you want to reverse this process, then:
```
find $HOME/Downloads/i2p-browser_en-US/ -name 'i2pbutton*.xpi' -exec cp -v i2pbutton.xpi.bak {} \;
```
### Windows
On Windows, your browser is usually installed to your Desktop where it's
configuration can be accessed. Your profile will be in the following directory
under, along with a default profile called "profile.default." You should usually
use the working profile directory and not the default.
To test local changes, you need to copy the pkg/i2pbutton-*.xpi over the
i2pbutton@geti2p.net.xpi
```
Desktop\I2P Browser Beta\Browser\I2PBrowser\Data\Browser\%profile_directory%\extensions\
```

View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- Mode: HTML -*- -->
<?xml-stylesheet href="chrome://i2pbutton/skin/aboutDialog.css" type="text/css"?>
<!DOCTYPE window [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
%brandDTD;
<!ENTITY % aboutDialogDTD SYSTEM "chrome://i2pbutton/locale/aboutDialog.dtd" >
%aboutDialogDTD;
]>
<overlay id="main-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox id="rightBox">
<vbox id="detailsBox">
<description class="text-blurb" id="projectDesc">
&project.start;
<label class="text-link"
href="https://geti2p.net/">
&project.tpoLink;
</label>&project.end;
</description>
<description class="text-blurb" id="helpDesc">
&help.start;
<label class="text-link"
href="https://geti2p.net/en/get-involved/donate">
&help.donateLink;
</label>
&help.or;
<label class="text-link"
href="https://geti2p.net/en/get-involved">
&help.getInvolvedLink;
</label>&help.end;
</description>
</vbox>
</vbox>
<vbox id="bottomBox">
<hbox id="newBottom" pack="center" position="1">
<label class="text-link bottom-link"
href="https://geti2p.net/en/faq">
&bottomLinks.questions;
</label>
<label class="text-link bottom-link"
href="https://geti2p.net/en/get-involved">
&bottomLinks.grow;
</label>
<label class="text-link bottom-link"
href="about:license">
&bottomLinks.license;
</label>
</hbox>
<description id="trademarkI2p" insertafter="trademark">
Test test.
</description>
</vbox>
</overlay>

View File

@ -79,6 +79,12 @@ var AboutI2pListener = {
body.removeAttribute("i2pconsoleon")
}
if (aData.i2pProxyOn) {
body.setAttribute("i2pproxyon", "yes")
} else {
body.removeAttribute("i2pproxyon")
}
if (aData.updateChannel)
body.setAttribute("updatechannel", aData.updateChannel);
else
@ -99,7 +105,7 @@ var AboutI2pListener = {
onLocaleChange: function(aLocale) {
// Display the Tor Browser product name and version.
// Display the I2P Browser product name and version.
try {
const kBrandBundle = "chrome://branding/locale/brand.properties";
let brandBundle = Cc["@mozilla.org/intl/stringbundle;1"]

View File

@ -28,41 +28,113 @@ window.addEventListener("pageshow", function() {
</script>
</head>
<body dir="&locale.dir;">
<div>
<!--<div>-->
<div class='background'>
<div class='content'>
<div class='section-header'>
<h1>&aboutI2p.browser_name;</h1>
</div>
<div id="i2pbrowser-version"></div>
<div id="i2pbrowser-description">
<p id="description">&aboutI2p.browser_name; ( &aboutI2p.browser_short_name; ) &aboutI2p.browser_description;</p>
<p class="version">&aboutI2p.browser_version_declare; &aboutI2p.browser_version;</p>
<p class="beta">&aboutI2p.warn_experimental;</p>
</div>
<p>
&aboutI2p.browser_name; ( &aboutI2p.browser_short_name; ) &aboutI2p.browser_description;
<h3>&aboutI2p.links;</h3>
<p>
<div id="readyness">
<div id="consoleOn" class="hideIfI2PConsoleOff">&aboutI2p.all_checks_ok;</div>
<div id="proxyUnready" class="hideIfI2PProxyOn">&aboutI2p.startup;</div>
<div id="proxyReady" class="hideIfI2PProxyOff">&aboutI2p.proxyready;</div>
</div>
<div id="onboarding" class="hideIfI2PConsoleOff">
<h3 id="onboardingTitle">&aboutI2p.onboardingTitle;</h3>
<h4 id="onboardingZero"><button class="showhider" onclick="flipVisibility('onboardingContentZero')">&aboutI2p.ZeroTitle;</button></h4>
<p id="onboardingContentZero" class="onboardingContent">&aboutI2p.Zero;</p>
<h4 id="onboardingOne"><button class="showhider" onclick="flipVisibility('onboardingContentOne')">&aboutI2p.OneTitle;</button></h4>
<p id="onboardingContentOne" class="onboardingContent">&aboutI2p.One;</p>
<h4 id="onboardingTwo"><button class="showhider" onclick="flipVisibility('onboardingContentTwo')">&aboutI2p.TwoTitle;</button></h4>
<p id="onboardingContentTwo" class="onboardingContent">&aboutI2p.Two;</p>
<h4 id="onboardingThree"><button class="showhider" onclick="flipVisibility('onboardingContentThree')">&aboutI2p.ThreeTitle;</button></h4>
<p id="onboardingContentThree" class="onboardingContent">&aboutI2p.Three;</p>
<h4 id="onboardingFour"><button class="showhider" onclick="flipVisibility('onboardingContentFour')">&aboutI2p.FourTitle;</button></h4>
<p id="onboardingContentFour" class="onboardingContent">&aboutI2p.Four;</p>
</div>
<!--<p class="hideIfI2POn">&aboutI2p.warn_not_running; <a href="about:i2p">&aboutI2p.refresh_text;</a> &aboutI2p.reccommend_not_running;</p>-->
<div class="application-info">
<p class="hideIfI2PConsoleOff">
<h3>&aboutI2p.applications;</h3>
<p id="applicationExplain">&aboutI2p.appExplain;</p>
<ul>
<li>&aboutI2p.source;: <a href="&aboutI2p.github;/test-i2p-browser/tree/i2p-browser-60.7.0esr-9.0-1-build3">&aboutI2p.github;/test-i2p-browser/tree/i2p-browser-60.7.0esr-9.0-1-build3</a></li>
<li>&aboutI2p.design;: <a href="&aboutI2p.github;/i2p-browser-design-docs">&aboutI2p.github;/i2p-browser-design-docs</a></li>
<li>&aboutI2p.bug_tracker;: <a href="&aboutI2p.trac;/">&aboutI2p.trac;/</a></li>
<li>&aboutI2p.build_scripts;: <a href="&aboutI2p.github;/i2p-browser-build-scripts">&aboutI2p.github;/i2p-browser-build-scripts</a></li>
<li>&aboutI2p.i2pbutton_source;: <a href="&aboutI2p.github;/i2pbutton">&aboutI2p.github;/i2pbutton</a></li>
<li><em>&aboutI2p.donate;: <a href="&aboutI2p.site;/get-involved/donate">&aboutI2p.supportus;</a></em></li>
<a class="applicationName" href="&aboutI2p.routerconsole;/i2ptunnel">
<li class="application">
&aboutI2p.i2ptunnel; <span class="applicationDesc">&aboutI2p.i2ptunnel_visit_msg;</span>
</li>
</a>
<a class="applicationName" href="&aboutI2p.routerconsole;/susimail">
<li class="application">
&aboutI2p.email; <span class="applicationDesc">&aboutI2p.email_visit_msg;</span>
</li>
</a>
<a class="applicationName" href="&aboutI2p.routerconsole;/i2psnark">
<li class="application">
&aboutI2p.torrent; <span class="applicationDesc">&aboutI2p.torrent_visit_msg;</span>
</li>
</a>
</ul>
</p>
&aboutI2p.warn_experimental;
</p>
<p class="hideIfI2POn">&aboutI2p.warn_not_running; <a href="about:i2p">&aboutI2p.refresh_text;</a> &aboutI2p.reccommend_not_running;</p>
<p class="hideIfI2POff">&aboutI2p.all_checks_ok;</p>
<p class="hideIfI2PConsoleOff">
<ul>
<li>&aboutI2p.i2ptunnel_visit_msg; <a href="&aboutI2p.routerconsole;/i2ptunnelmgr">&aboutI2p.i2ptunnel;</a></li>
<li>&aboutI2p.email_visit_msg; <a href="&aboutI2p.routerconsole;/webmail">&aboutI2p.email;</a></li>
<li>&aboutI2p.torrent_visit_msg; <a href="&aboutI2p.routerconsole;/torrents">&aboutI2p.torrent;</a></li>
<li>&aboutI2p.console_visit_msg; <a href="&aboutI2p.routerconsole;">&aboutI2p.console;</a></li>
</ul>
</p>
</div>
<div class="extended-info">
<h3 id="links"><button class="showhider" onclick="flipVisibility('info-content')">&aboutI2p.links;</button></h3>
<div id="info-content">
<p id="linksExplain">&aboutI2p.linkExplain;</p>
<p>
<ul>
<a href="&aboutI2p.github;/i2p-browser">
<li>
&aboutI2p.source; <span class="applicationDesc">&aboutI2p.browsersrc;</span>
</li>
</a>
<a href="&aboutI2p.github;/i2pbutton">
<li>
&aboutI2p.i2pbutton_source; <span class="applicationDesc">&aboutI2p.extsrc;</span>
</li>
</a>
<a href="&aboutI2p.githubdev;/i2p-browser-build-scripts">
<li>
&aboutI2p.build_scripts; <span class="applicationDesc">&aboutI2p.makesrc;</span>
</li>
</a>
<a href="&aboutI2p.githubdev;/i2p-browser-design-docs">
<li>
&aboutI2p.design; <span class="applicationDesc">&aboutI2p.designsrc;</span>
</li>
</a>
<a href="&aboutI2p.trac;/">
<li>
&aboutI2p.bug_tracker; <span class="applicationDesc">&aboutI2p.tracwiki;</span>
</li>
</a>
<a href="&aboutI2p.site;/get-involved/donate">
<li>
<em>&aboutI2p.supportus;</em> <span class="applicationDesc">&aboutI2p.donatecta;</span>
</li>
</a>
</ul>
</p>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function flipVisibility(div) {
var x = document.getElementById(div);
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
</script>
<!--</div>-->
</body>
</html>

View File

@ -1,10 +1,10 @@
let { Services } = Cu.import("resource://gre/modules/Services.jsm", {})
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm")
var { Services } = Cu.import("resource://gre/modules/Services.jsm", {})
var {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm")
//let SecurityPrefs = Cu.import("resource://i2pbutton/modules/security-prefs.js", {})
var m_ib_prefs = Services.prefs
var m_ib_domWindowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
var m_ib_prefs = Services.prefs;
var m_ib_domWindowUtils = window.windowUtils;
const k_ib_last_browser_version_pref = "extensions.i2pbutton.lastBrowserVersion";
const k_ib_browser_update_needed_pref = "extensions.i2pbutton.updateNeeded";
@ -21,6 +21,11 @@ var m_ib_window_height = window.outerHeight
var m_ib_window_width = window.outerWidth
let checkSvc = Cc["@geti2p.net/i2pbutton-i2pCheckService;1"].getService(Ci.nsISupports).wrappedJSObject
//let routerCtrl = Cc["@geti2p.net/i2pbutton-process-service;1"].getService(Ci.nsISupports).wrappedJSObject
function i2pbutton_log(lvl, msg) {
console.log(`[i2pbutton:${lvl}] ${msg}`)
}
function checkI2P(callback,proxyCallback) {
let req = checkSvc.createCheckConsoleRequest(true);
@ -50,10 +55,43 @@ function i2pbutton_i2p_check_ok()
// It's important to check both if failed and if it's initialised to not report wrong to the end user
return (checkSvc.isConsoleWorking && checkSvc.isProxyWorking && checkSvc.kCheckNotInitiated != checkSvc.statusOfI2PCheck)
}
function i2pbutton_i2p_console_check_ok()
function i2pbutton_i2p_console_check_ok() {
// This check will now test if the router subprocess is running
/*if (routerCtrl.mI2PProcess != null) {
if (routerCtrl.mI2PProcess.isRunning) {
return true
}
}*/
return false
}
function i2pbutton_i2p_proxy_check_ok() {
i2pbutton_log(3, "I2P Proxy readiness: " + checkSvc.isProxyWorking)
return (checkSvc.isProxyWorking)
}
var i2pbutton_window_pref_observer =
{
// It's important to check both if failed and if it's initialised to not report wrong to the end user
return (checkSvc.isConsoleWorking && checkSvc.kCheckNotInitiated != checkSvc.statusOfI2PCheck)
register: function()
{
m_ib_prefs.addObserver("extensions.i2pbutton", this, false);
},
unregister: function()
{
m_ib_prefs.removeObserver("extensions.i2pbutton", this);
},
// topic: what event occurred
// subject: what nsIPrefBranch we're observing
// data: which pref has been changed (relative to subject)
observe: function(subject, topic, data)
{
if (topic != "nsPref:changed") return;
switch (data) {
case k_ib_browser_update_needed_pref:
torbutton_notify_if_update_needed();
break;
}
}
}
var i2pbutton_unique_pref_observer =
@ -166,7 +204,8 @@ var i2pbutton_abouti2p_message_handler = {
let dataObj = {
updateChannel: AppConstants.MOZ_UPDATE_CHANNEL,
i2pOn: i2pbutton_i2p_check_ok(),
i2pConsoleOn: i2pbutton_i2p_console_check_ok()
i2pConsoleOn: i2pbutton_i2p_console_check_ok(),
i2pProxyOn: i2pbutton_i2p_proxy_check_ok()
};
if (aIsRespondingToPageLoad) {
@ -195,14 +234,82 @@ function i2pbutton_is_mobile() {
return false;
}
function i2pbutton_update_is_needed() {
var updateNeeded = false
try {
updateNeeded = m_ib_prefs.getBoolPref(k_ib_browser_update_needed_pref)
} catch (e) {}
return updateNeeded
}
function i2pbutton_notify_if_update_needed() {
function setOrClearAttribute(aElement, aAttrName, aValue)
{
if (!aElement || !aAttrName)
return
if (aValue)
aElement.setAttribute(aAttrName, aValue)
else
aElement.removeAttribute(aAttrName)
}
let updateNeeded = i2pbutton_update_is_needed()
// Change look of toolbar item (enable/disable animated update icon).
var btn = i2pbutton_get_toolbutton()
setOrClearAttribute(btn, "ibUpdateNeeded", updateNeeded)
// Make the "check for update" menu item bold if an update is needed.
var item = document.getElementById("i2pbutton-checkForUpdate")
setOrClearAttribute(item, "ibUpdateNeeded", updateNeeded)
}
function i2pbutton_check_for_update() {
// Open the update prompt in the correct mode. The update state
// checks used here were adapted from isPending() and isApplied() in
// Mozilla's browser/base/content/aboutDialog.js code.
let updateMgr = Cc["@mozilla.org/updates/update-manager;1"]
.getService(Ci.nsIUpdateManager)
let update = updateMgr.activeUpdate
let updateState = (update) ? update.state : undefined
let pendingStates = [ "pending", "pending-service",
"applied", "applied-service" ]
let isPending = (updateState && (pendingStates.indexOf(updateState) >= 0))
let prompter = Cc["@mozilla.org/updates/update-prompt;1"]
.createInstance(Ci.nsIUpdatePrompt)
if (isPending)
prompter.showUpdateDownloaded(update, false)
else
prompter.checkForUpdates()
}
function i2pbutton_get_toolbutton() {
var o_toolbutton = false;
i2pbutton_log(1, 'get_toolbutton(): looking for button element');
if (document.getElementById("i2pbutton-button")) {
o_toolbutton = document.getElementById("i2pbutton-button");
} else if (document.getElementById("i2pbutton-button-ib")) {
o_toolbutton = document.getElementById("i2pbutton-button-ib");
} else if (document.getElementById("i2pbutton-button-ib-msg")) {
o_toolbutton = document.getElementById("i2pbutton-button-ib-msg");
} else {
i2pbutton_log(3, 'get_toolbutton(): did not find i2pbutton-button');
}
return o_toolbutton;
}
// This function closes all XUL browser windows except this one. For this
// window, it closes all existing tabs and creates one about:blank tab.
function i2pbutton_close_tabs_on_new_identity() {
if (!m_ib_prefs.getBoolPref("extensions.i2pbutton.close_newnym", true)) {
i2pbutton_log(3, "Not closing tabs");
return;
i2pbutton_log(3, "Not closing tabs")
return
}
// TODO: muck around with browser.tabs.warnOnClose.. maybe..
@ -450,6 +557,28 @@ function i2pbutton_new_identity() {
}
}
/* The "New Identity" implementation does the following:
* 1. Disables Javascript and plugins on all tabs
* 2. Clears state:
* a. OCSP
* b. Cache + image cache
* c. Site-specific zoom
* d. Cookies+DOM Storage+safe browsing key
* e. google wifi geolocation token
* f. http auth
* g. SSL Session IDs
* h. last open location url
* i. clear content prefs
* j. permissions
* k. site security settings (e.g. HSTS)
* l. IndexedDB and asmjscache storage
* 3. Sends tor the NEWNYM signal to get a new circuit
* 4. Opens a new window with the default homepage
* 5. Closes this window
*
* XXX: intermediate SSL certificates are not cleared.
*/
function i2pbutton_do_new_identity() {
var obsSvc = Components.classes["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
// This is todo.
@ -659,36 +788,7 @@ function i2pbutton_do_new_identity() {
// Run garbage collection and cycle collection after window is gone.
// This ensures that blob URIs are forgotten.
window.addEventListener("unload", function (event) {
i2pbutton_log(3, "Initiating New Identity GC pass");
// Clear out potential pending sInterSliceGCTimer:
m_ib_domWindowUtils.runNextCollectorTimer();
// Clear out potential pending sICCTimer:
m_ib_domWindowUtils.runNextCollectorTimer();
// Schedule a garbage collection in 4000-1000ms...
m_ib_domWindowUtils.garbageCollect();
// To ensure the GC runs immediately instead of 4-10s from now, we need
// to poke it at least 11 times.
// We need 5 pokes for GC, 1 poke for the interSliceGC, and 5 pokes for CC.
// See nsJSContext::RunNextCollectorTimer() in
// https://mxr.mozilla.org/mozilla-central/source/dom/base/nsJSEnvironment.cpp#1970.
// XXX: We might want to make our own method for immediate full GC...
for (let poke = 0; poke < 11; poke++) {
m_ib_domWindowUtils.runNextCollectorTimer();
}
// And now, since the GC probably actually ran *after* the CC last time,
// run the whole thing again.
m_ib_domWindowUtils.garbageCollect();
for (let poke = 0; poke < 11; poke++) {
m_ib_domWindowUtils.runNextCollectorTimer();
}
i2pbutton_log(3, "Completed New Identity GC pass");
});
window.addEventListener("unload", function (event) {});
// Close the current window for added safety
window.close();
@ -1000,7 +1100,6 @@ var i2pbutton_resizelistener =
// in XUL that should be in an XPCOM component
function i2pbutton_close_window(event) {
i2pbutton_window_pref_observer.unregister();
i2pbutton_tor_check_observer.unregister();
window.removeEventListener("sizemodechange", m_ib_resize_handler,
false);
@ -1073,7 +1172,6 @@ function i2pbutton_do_main_window_startup()
{
i2pbutton_log(3, "I2pbutton main window startup");
m_ib_is_main_window = true;
i2pbutton_unique_pref_observer.register();
}
// Bug 1506 P4: Most of this function is now useless, save
@ -1194,7 +1292,6 @@ function i2pbutton_new_window(event)
// in XUL that should be in an XPCOM component
function i2pbutton_close_window(event) {
i2pbutton_window_pref_observer.unregister();
i2pbutton_i2p_check_observer.unregister();
window.removeEventListener("sizemodechange", m_ib_resize_handler,
false);

View File

@ -1,43 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://i2pbutton/skin/torbutton.css" type="text/css"?>
<?xul-overlay href="chrome://i2pbutton/content/popup.xul"?>
<!DOCTYPE overlay SYSTEM "chrome://i2pbutton/locale/i2pbutton.dtd">
<overlay id="i2pbutton-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://i2pbutton/content/i2pbutton_util.js" />
<script type="application/x-javascript" src="chrome://i2pbutton/content/i2pbutton.js" />
<script language="JavaScript">
//onLoad Hander
try{window.addEventListener("load", i2pbutton_init, false);}catch(e){}
</script>
<stringbundleset id="i2pbutton-stringbundleset">
<stringbundle id="i2pbutton-bundle" src="chrome://i2pbutton/locale/i2pbutton.properties"/>
</stringbundleset>
<!-- Place the context menu in the nav bar, so that the lack
of the status bar on FF4 doesn't make it invisible -->
<toolbar id="nav-bar">
<menupopup id="i2pbutton-context-menu"/>
</toolbar>
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton
id="i2pbutton-button"
class="toolbarbutton-1 chromeclass-toolbar-additional"
type="menu"
orient="horizontal"
label="I2Pbutton"
tooltiptext="&i2pbutton.button.tooltip;"
menu="i2pbutton-context-menu"
context="i2pbutton-context-menu"/>
</toolbarpalette>
<!-- Global keyboard shortcuts for new identity. -->
<keyset>
<key id="i2pbutton-new-identity-key" modifiers="accel shift" key="U" oncommand="i2pbutton_new_identity()"/>
</keyset>
</overlay>

View File

@ -1,38 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://i2pbutton/skin/i2pbutton.css" type="text/css"?>
<?xul-overlay href="chrome://i2pbutton/content/popup.xul"?>
<!DOCTYPE overlay SYSTEM "chrome://i2pbutton/locale/i2pbutton.dtd">
<overlay id="i2pbutton-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://i2pbutton/content/i2pbutton_util.js" />
<script type="application/x-javascript" src="chrome://i2pbutton/content/i2pbutton.js" />
<script language="JavaScript">
//onLoad Hander
try{window.addEventListener("load", i2pbutton_init, false);}catch(e){}
</script>
<stringbundleset id="i2pbutton-stringbundleset">
<stringbundle id="i2pbutton-bundle" src="chrome://i2pbutton/locale/i2pbutton.properties"/>
</stringbundleset>
<toolbarpalette id="MailToolbarPalette">
<toolbarbutton
id="i2pbutton-button-tb"
class="toolbarbutton-1"
label="i2pbutton"
tooltiptext="&i2pbutton.button.tooltip;"
context="i2pbutton-context-menu" />
</toolbarpalette>
<toolbarpalette id="MsgComposeToolbarPalette">
<toolbarbutton
id="i2pbutton-button-tb-msg"
class="toolbarbutton-1"
label="i2pbutton"
tooltiptext="&i2pbutton.button.tooltip;"
context="i2pbutton-context-menu" />
</toolbarpalette>
</overlay>

View File

@ -12,6 +12,8 @@ function i2pbutton_log(nLevel, sMsg) {
return true;
}
function i2pbutton_init_security_ui() {}
// get a preferences branch object
// FIXME: this is lame.
function i2pbutton_get_prefbranch(branch_name) {

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- Mode: HTML -*- -->
<!DOCTYPE overlay SYSTEM "chrome://i2pbutton/locale/i2pbutton.dtd">
<overlay id="i2pbutton-menu-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<menuitem id="menu_newIdentity"
accesskey="&i2pbutton.context_menu.new_identity_key;"
key="i2pbutton-new-identity-key"
label="&i2pbutton.context_menu.new_identity;"
oncommand="i2pbutton_new_identity();"/>
<toolbarbutton id="appMenuNewIdentity"
class="subviewbutton subviewbutton-iconic"
key="i2pbutton-new-identity-key"
label="&i2pbutton.context_menu.new_identity;"
oncommand="i2pbutton_new_identity();"/>
<toolbarbutton id="appMenu-private-window-button"
hidden="true"/>
<toolbarbutton id="appMenuRestoreLastSession"
hidden="true"/>
</overlay>

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- Mode: HTML -*- -->
<!DOCTYPE overlay SYSTEM "chrome://i2pbutton/locale/aboutI2p.dtd">
<overlay id="i2pbutton-menu-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<menupopup id="menu_HelpPopup">
<!-- Bug 18905: Hide unused help menu items -->
<menuitem id="menu_openHelp" removeelement="true"/>
<menuitem id="menu_openTour" removeelement="true"/>
<menuitem id="healthReport" removeelement="true"/>
<menuitem id="feedbackPage" removeelement="true"/>
<menuitem id="helpSafeMode" removeelement="true"/>
<menuitem id="menu_HelpPopup_reportPhishingtoolmenu" removeelement="true"/>
<menuitem id="menu_HelpPopup_reportPhishingErrortoolmenu" removeelement="true"/>
<!-- dummy elements to avoid 'getElementById' errors -->
<box id="feedbackPage"/>
<box id="helpSafeMode"/>
<box id="menu_HelpPopup_reportPhishingtoolmenu"/>
<box id="menu_HelpPopup_reportPhishingErrortoolmenu"/>
<!-- Add I2P Browser manual link -->
<!--<menuitem name="i2pBrowserUserManual"
id="i2pBrowserUserManual"
position="1"
label="&aboutI2p.i2pbrowser_user_manual.label;"
accesskey="&aboutI2p.i2pbrowser_user_manual.accesskey;"
oncommand="gBrowser.selectedTab = gBrowser.addTab('https://geti2p.net/en/browser/' + Services.locale.getRequestedLocale())" />-->
</menupopup>
</overlay>

View File

@ -1,39 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://i2pbutton/skin/i2pbutton.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://i2pbutton/locale/i2pbutton.dtd">
<overlay id="i2pbutton-popup-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<stringbundleset id="i2pbutton-stringbundleset">
<stringbundle id="i2pbutton-bundle" src="chrome://i2pbutton/locale/i2pbutton.properties"/>
</stringbundleset>
<panel id="i2pbutton-context-menu"
onpopupshowing="i2pbutton_check_protections();"
titlebar="normal" noautohide="true"
anchor="i2pbutton-button" position="after_start" >
<hbox align="start">
<vbox>
<menuitem id="i2pbutton-new-identity"
label="&i2pbutton.context_menu.new_identity;"
accesskey="&i2pbutton.context_menu.new_identity_key;"
insertafter="context-stop"
oncommand="i2pbutton_new_identity()"/>
<menuseparator/>
<menuitem id="i2pbutton-cookie-protector"
label="&i2pbutton.context_menu.cookieProtections;"
accesskey="&i2pbutton.context_menu.cookieProtections.key;"
insertafter="context-stop"
hidden="true"
oncommand="i2pbutton_open_cookie_dialog()"/>
<menuseparator id="i2pbutton-checkForUpdateSeparator"/>
<menuitem id="i2pbutton-checkForUpdate"
label="&i2pbutton.context_menu.downloadUpdate;"
accesskey="&i2pbutton.context_menu.downloadUpdate.key;"
insertafter="context-stop"
oncommand="i2pbutton_check_for_update()"/>
</vbox>
</hbox>
</panel>
</overlay>

View File

@ -0,0 +1,216 @@
const Cc = Components.classes
const Ci = Components.interfaces
const Cu = Components.utils
const kI2PProcessExitedTopic = "I2PProcessExited"
const kBootstrapStatusTopic = "I2PBootstrapStatus"
const kI2PBootstrapErrorTopic = "I2PBootstrapError"
const kI2PLogHasWarnOrErrTopic = "I2PLogHasWarnOrErr"
Cu.import("resource://gre/modules/Services.jsm")
Cu.import("resource://gre/modules/XPCOMUtils.jsm")
XPCOMUtils.defineLazyModuleGetter(this, "LauncherUtil", "resource://i2pbutton/modules/launcher-util.jsm")
const I2PLauncherLogger = Cc["@geti2p.net/i2pbutton-logger;1"].getService(Ci.nsISupports).wrappedJSObject
var gObsSvc
var gOpenerCallbackFunc // Set when opened from network settings.
var gIsInitialBootstrap
var gInitialPanelID
function closeThisWindow(reason) {
dump('closeThisWindow\n')
window.close()
}
function initDialog()
{
// If i2p bootstrap has already finished, just close the progress dialog.
// This situation can occur if bootstrapping is very fast and/or if this
// window opens s vlowly (observed with Adblock Plus installed).
try
{
let processSvc = Cc["@geti2p.net/i2pbutton-process-service;1"].getService(Ci.nsISupports).wrappedJSObject
if (processSvc.I2PIsBootstrapDone || processSvc.I2PBootstrapErrorOccurred)
{
closeThisWindow(processSvc.I2PIsBootstrapDone)
return
}
}
catch (e) { dump(`${e}\n`) }
try
{
gObsSvc = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService)
gObsSvc.addObserver(gObserver, kI2PProcessExitedTopic, false)
gObsSvc.addObserver(gObserver, kBootstrapStatusTopic, false)
gObsSvc.addObserver(gObserver, kI2PBootstrapErrorTopic, false)
gObsSvc.addObserver(gObserver, kI2PLogHasWarnOrErrTopic, false)
var isBrowserStartup = false
if (window.arguments)
{
let wargs = window.arguments || window.arguments.wrappedJSObject
isBrowserStartup = wargs[0]
dump(`window.arguments = ${wargs}\n`)
dump(`window.arguments.length = ${wargs.length}\n`)
if (window.arguments.length > 1)
gInitialPanelID = window.arguments[1]
}
if (gOpenerCallbackFunc)
{
// Dialog was opened from network settings: hide Open Settings button.
var extraBtn = document.documentElement.getButton("extra2")
extraBtn.setAttribute("hidden", true)
}
else
{
// Dialog was not opened from network settings: change Cancel to Quit.
var cancelBtn = document.documentElement.getButton("cancel")
var quitKey = (LauncherUtil.isWindows) ? "quit_win" : "quit"
cancelBtn.label = 'Cancel'//LauncherUtil.getLocalizedString(quitKey)
}
// If opened during browser startup, display the "please wait" message.
if (isBrowserStartup)
{
var pleaseWait = document.getElementById("progressPleaseWait")
if (pleaseWait)
pleaseWait.removeAttribute("hidden")
}
// Test if the i2p console port is open or not
let consolePort = Services.prefs.getIntPref("extensions.i2pbutton.console_port_i2pj", 7647)
LauncherUtil.waitForPortToOpen(consolePort, () => {
var meter = document.getElementById("progressMeter")
if (meter) {
meter.value = meter.value + 30
}
setTimeout(() => {
window.close()
}, 5000)
})
}
catch (e) {
dump(`Error: ${e}\n`)
}
dump('initDialog done\n')
}
function onCancel() {
//
dump('onCancel\n')
cleanup()
}
function cleanup()
{
if (gObsSvc)
{
gObsSvc.removeObserver(gObserver, kI2PProcessExitedTopic)
gObsSvc.removeObserver(gObserver, kBootstrapStatusTopic)
gObsSvc.removeObserver(gObserver, kI2PBootstrapErrorTopic)
gObsSvc.removeObserver(gObserver, kI2PLogHasWarnOrErrTopic)
}
}
function onOpenSettings()
{
//stopI2PBootstrap()
//cleanup()
window.close()
}
function stopI2PBootstrap()
{
// Tell i2p to disable use of the network; this should stop the bootstrap
// process.
const kErrorPrefix = "Setting DisableNetwork=1 failed: ";
try
{
var settings = {};
settings["DisableNetwork"] = true;
var errObj = {};
I2PLauncherLogger.log(5, kErrorPrefix + errObj.details);
}
catch(e)
{
I2PLauncherLogger.log(5, kErrorPrefix + e);
}
}
var gObserver = {
// nsIObserver implementation.
observe: function(aSubject, aTopic, aParam)
{
if ((kI2PProcessExitedTopic == aTopic) ||
(kI2PBootstrapErrorTopic == aTopic))
{
// In these cases, an error alert will be displayed elsewhere so it is
// best to close this window.
// TODO: provide a way to access tor log e.g., leave this dialog open
// and display the open settings button or provide a way to do
// that from our error alerts.
if (kI2PBootstrapErrorTopic == aTopic)
stopI2PBootstrap();
cleanup();
window.close();
}
else if (kBootstrapStatusTopic == aTopic)
{
var statusObj = aSubject.wrappedJSObject
var labelText = LauncherUtil.getLocalizedBootstrapStatus(statusObj, "TAG")
var percentComplete = (statusObj.PROGRESS) ? statusObj.PROGRESS : 0
var meter = document.getElementById("progressMeter")
if (meter)
meter.value = percentComplete
var bootstrapDidComplete = (percentComplete >= 100)
if (percentComplete >= 100)
{
// To ensure that 100% progress is displayed, wait a short while
// before closing this window.
window.setTimeout(function() { closeThisWindow(true) }, 250)
}
else if (statusObj._errorOccurred)
{
var s = LauncherUtil.getLocalizedBootstrapStatus(statusObj, "REASON");
if (s)
labelText = s;
if (meter)
meter.setAttribute("hidden", true);
var pleaseWait = document.getElementById("progressPleaseWait");
if (pleaseWait)
pleaseWait.setAttribute("hidden", true);
}
var desc = document.getElementById("progressDesc");
if (labelText && desc)
desc.textContent = labelText;
}
else if (kI2PLogHasWarnOrErrTopic == aTopic)
{
var extra2Btn = document.documentElement.getButton("extra2");
var clz = extra2Btn.getAttribute("class");
extra2Btn.setAttribute("class", clz ? clz + " i2pWarning" : "i2pWarning");
// TODO: show error / warning message in this dialog?
}
},
}

View File

@ -0,0 +1,43 @@
<?xml version="1.0"?>
<!--
- Copyright (c) 2019, The Invisible Internet Project.
- See LICENSE for licensing information.
- vim: set sw=2 sts=2 ts=8 et syntax=xml:
-->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://i2pbutton/skin/progress.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://i2pbutton/locale/progress.dtd">
<dialog id="I2PProgress"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&i2pprogress.dialog.title;"
windowtype="I2PLauncher:Progress"
persist="screenX screenY"
buttons="cancel"
buttonlabelextra2="&i2pprogress.openSettings;"
ondialogcancel="onCancel();"
ondialogextra2="onOpenSettings();"
onload="initDialog();"> <!-- extra2 was removed from buttons for now. -->
<script type="application/x-javascript"
src="chrome://i2pbutton/content/progress.js"/>
<vbox>
<hbox>
<vbox>
<spacer flex="1" />
<image id="ibb-icon" />
<spacer flex="1" />
</vbox>
<separator orient="vertical" />
<vbox flex="1">
<label id="progressHeading" value="&i2pprogress.heading;" />
<description id="progressDesc" />
</vbox>
</hbox>
<progressmeter id="progressMeter" mode="determined" value="0" max="100" />
<description id="progressPleaseWait"
hidden="true">&i2pprogress.pleaseWait;</description>
</vbox>
</dialog>

View File

@ -9,4 +9,4 @@
<!ENTITY bottomLinks.questions "Questions?">
<!ENTITY bottomLinks.grow "Help the I2P Network Grow!">
<!ENTITY bottomLinks.license "Licensing Information">
<!ENTITY tor.TrademarkStatement "'I2P' are registered trademarks of the I2P Project.">
<!ENTITY i2p.TrademarkStatement "'I2P' are registered trademarks of the I2P Project.">

View File

@ -3,34 +3,63 @@
<!ENTITY aboutI2p.viewChangelog.label "View Changelog">
<!ENTITY aboutI2p.browser_name "The Invisible Internet Browser">
<!ENTITY aboutI2p.browser_name "I2P Browser: Communications Security Toolkit">
<!ENTITY aboutI2p.browser_short_name "I2P Browser">
<!ENTITY aboutI2p.browser_description "is preconfigured to get your content using the anonymous and private I2P network. In this release, I2P Browser bundles it's own I2P Router, which starts and stops when you open and close the browser application. It does not require an existing I2P router installed.">
<!ENTITY aboutI2p.browser_description "is preconfigured to get your content using the anonymous and private I2P network and to provide accessible, first-class access to I2P Peer-to-Peer applications.">
<!ENTITY aboutI2p.browser_version_declare "This build of I2P Browser was made with">
<!ENTITY aboutI2p.browser_version "0.9.43">
<!ENTITY aboutI2p.donate "Donate">
<!ENTITY aboutI2p.supportus "Support I2P development">
<!ENTITY aboutI2p.warn_not_running "It currently seems like your router is NOT running :(">
<!ENTITY aboutI2p.warn_not_running "I2P hasn't started.">
<!ENTITY aboutI2p.reccommend_not_running "If you just started the router, it may take up to 2 minutes for the router to start the proxy.">
<!ENTITY aboutI2p.all_checks_ok "Super! The browser detected I2P running in background! :)">
<!ENTITY aboutI2p.all_checks_ok "I2P is running.">
<!ENTITY aboutI2p.warn_experimental "This is a experimental sub-project of I2P. It is currently Beta software.">
<!ENTITY aboutI2p.console_visit_msg "It seems like your console is up, click to visit:">
<!ENTITY aboutI2p.appExplain "These applications use I2P to provide them with security and privacy.">
<!ENTITY aboutI2p.applications "Applications">
<!ENTITY aboutI2p.console "Console:">
<!ENTITY aboutI2p.torrent "Torrents:">
<!ENTITY aboutI2p.i2ptunnel "Tunnels:">
<!ENTITY aboutI2p.email "E-Mail:">
<!ENTITY aboutI2p.i2ptunnel_visit_msg "I2P has a web-based interface for configuring .i2p services like web sites, to set up your own web sites, go here:">
<!ENTITY aboutI2p.email_visit_msg "I2P also bundles a webmail client which can be used to access in-I2P e-mail. To use it, go here:">
<!ENTITY aboutI2p.torrent_visit_msg "I2P is capable of anonymous Peer-to-Peer file sharing, to use the built-in bittorrent client go here:">
<!ENTITY aboutI2p.console "Console">
<!ENTITY aboutI2p.torrent "Torrents">
<!ENTITY aboutI2p.i2ptunnel "Tunnels">
<!ENTITY aboutI2p.email "E-Mail">
<!ENTITY aboutI2p.i2pbutton_source "I2P Button source">
<!ENTITY aboutI2p.build_scripts "Build scripts to compile from source">
<!ENTITY aboutI2p.source "Browse the source code">
<!ENTITY aboutI2p.bug_tracker "Submit a Bug Report">
<!ENTITY aboutI2p.links "Links">
<!ENTITY aboutI2p.design "Design Document">
<!ENTITY aboutI2p.console_visit_msg "It seems like your console is up, click to visit:">
<!ENTITY aboutI2p.refresh_text "Try refreshing the page.">
<!ENTITY aboutI2p.refresh_link "Refresh">
<!ENTITY aboutI2p.links "Links">
<!ENTITY aboutI2p.linkExplain "If you want to get more information about I2P, you can visit these links.">
<!ENTITY aboutI2p.site "http://i2p-projekt.i2p/en">
<!ENTITY aboutI2p.routerconsole "http://localhost:7657">
<!ENTITY aboutI2p.github "https://github.com/mikalv">
<!ENTITY aboutI2p.routerconsole "http://localhost:7647">
<!ENTITY aboutI2p.github "https://github.com/i2p">
<!ENTITY aboutI2p.githubdev "https://github.com/mikal">
<!ENTITY aboutI2p.trac "http://trac.i2p2.i2p">
<!ENTITY aboutI2p.i2pbutton_source "I2P Button Source Code:">
<!ENTITY aboutI2p.build_scripts "I2P Browser Build Scripts:">
<!ENTITY aboutI2p.source "I2P Browser Source Code:">
<!ENTITY aboutI2p.bug_tracker "Submit a Bug Report:">
<!ENTITY aboutI2p.design "I2P Browser Design Document:">
<!ENTITY aboutI2p.browsersrc "Go here to browse the source code of our Firefox fork.">
<!ENTITY aboutI2p.extsrc "Much of the functionality of the I2P Browser is implemented in the I2PButton plugin.">
<!ENTITY aboutI2p.makesrc "These scripts are used to build the browser.">
<!ENTITY aboutI2p.designsrc "This is the I2P Browser Design Document.">
<!ENTITY aboutI2p.tracwiki "To report a bug, visit the Trac Wiki.">
<!ENTITY aboutI2p.donatecta "I2P is funded by donations. In order to make a donation visit the project web site.">
<!ENTITY aboutI2p.startup "Proxy starting up.">
<!ENTITY aboutI2p.rc "Router Console">
<!ENTITY aboutI2p.proxyready "Proxy Ready">
<!ENTITY aboutI2p.onboardingTitle "New to I2P? Learn more here.">
<!ENTITY aboutI2p.Zero "I2P Browser allows you to surf the internet using the private and secure I2P network. When using it, you are protected against tracking, surveillance, and censorship as a first-class participant in the I2P network. I2P Browser isolates cookies and deletes your browser history after your session. These modifications ensure your privacy and security are protected in the browser.">
<!ENTITY aboutI2p.One "We also provide you with additional settings for bumping up your browser security. Our Security Settings allow you to block elements that could be used to attack your computer. Click below to see what the different options do. Note: By default, NoScript and HTTPS Everywhere are not included on the toolbar, but you can customize your toolbar to add them. With all the security and privacy features provided by I2P, your experience while browsing the internet may be a little different. Things may be a bit slower, and depending on your security level, some elements may not work or load. You may also be asked to prove you are a human and not a robot.">
<!ENTITY aboutI2p.Two "I2P is capable of using peer-to-peer applications like BitTorrent, protecting your identity when you share files. Our anonymous bittorrent client is available in the browser.">
<!ENTITY aboutI2p.Three "There is also an anonymous e-mail service available inside of I2P, which is accessible from our browser via the menu directly below.">
<!ENTITY aboutI2p.Four "With all the security and privacy features provided by I2P, your experience while browsing the internet may be a little different. Things may be a bit slower, and depending on your security level, some elements may not work or load. You may also be asked to prove you are a human and not a robot.">
<!ENTITY aboutI2p.ZeroTitle "Protect your Privacy">
<!ENTITY aboutI2p.OneTitle "Configure your Experience">
<!ENTITY aboutI2p.TwoTitle "Share Files">
<!ENTITY aboutI2p.ThreeTitle "Hidden e-mail">
<!ENTITY aboutI2p.FourTitle "Experience Tips">

View File

@ -4,3 +4,8 @@
<!ENTITY vendorShortName "I2P Project">
<!ENTITY trademarkInfo.part1 "Firefox and the Firefox logos are trademarks of the Mozilla Foundation.">
<!ENTITY plugins.installed.find "Click to load installed system plugins">
<!ENTITY plugins.installed.enable "Enable plugins">
<!ENTITY plugins.installed.disable "Disable plugins">
<!ENTITY plugins.installed.disable.tip "Click to prevent loading system plugins">

View File

@ -0,0 +1,4 @@
<!ENTITY i2pprogress.dialog.title "Starting the I2P router">
<!ENTITY i2pprogress.openSettings "Settings">
<!ENTITY i2pprogress.heading "I2P Browser">
<!ENTITY i2pprogress.pleaseWait "Please wait while the router establish a connection to the I2P network. This may take several minutes">

View File

@ -1,77 +1,290 @@
* {
padding: 0px;
margin: 0px;
padding: 0;
margin: 0
}
html {
height: 100%;
height: 100%
}
a {
color: #3b6bbf;
text-decoration: none;
font-weight: 700;
word-wrap: break-word;
outline: 0
}
.beta,
.version {
font-style: italic
}
.applicationDesc {
color: #81888f;
text-decoration: none;
font-weight: 700;
word-wrap: break-word;
outline: 0
}
.applicationDesc:hover,
a:hover {
color: #495057;
text-decoration: none;
font-weight: 700;
word-wrap: break-word;
outline: 0
}
body {
display: flex;
flex-direction: column;
font-family: "Droid Sans","Noto Sans",Ubuntu,"Segoe UI","Lucida Grande",Verdana,Helvetica,sans-serif;
width: 100%;
height: 100%;
margin: 0px auto;
padding: 0px 0px;
font-family: Helvetica, Arial, sans-serif;
color: var(--abouttor-text-color);
background-color: var(--abouttor-bg-toroff-color);
margin: 0 auto;
padding: 0;
color: #495057;
background-attachment: fixed;
background-size: 100% 100%;
text-decoration: none;
font-weight: 700;
word-wrap: break-word;
outline: 0
}
/* Hide the entire document by default to avoid showing the incorrect
* I2P on / off status (that info must be retrieved from the chrome
* process, which involves IPC when multiprocess mode is enabled). An
* initialized attribute will be added as soon as the status is known.
*/
body:not([initialized]) {
display: none;
body:not([initialized]) {
display: none
}
.background {
background-color: #3960b5;
padding: 120px;
height: 100%;
background-color: #f8f8ff;
height: 100%
}
p {
margin-top: 40px;
font-family: Open Sans, sans-serif;
font-weight: 300;
line-height: 32px;
font-size: 17px;
font-family: "Droid Sans","Noto Sans",Ubuntu,"Segoe UI","Lucida Grande",Verdana,Helvetica,sans-serif;
text-decoration: none;
color: #495057;
font-weight: 700;
word-wrap: break-word;
outline: 0
}
.content {
padding: 110px;
background-color: #FFFFFF;
border-radius: 15px;
box-shadow: 0px 30px 200px rgba(61,0,84,0.7);
min-height: 3rem;
padding: 1rem;
margin: 1.5rem;
display: inline-block;
border: 1px solid #d9d9d6;
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc;
background: #f8f8ff
}
.extended-info {
min-height: 3rem;
padding: 1rem;
margin-top: 1.5rem;
display: inline-block;
border: 1px solid #d9d9d6;
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc;
background: #f8f8ff;
min-width: 50%
}
.application-info {
min-height: 3rem;
padding: 1rem;
margin-top: 1.5rem;
display: inline-block;
border: 1px solid #d9d9d6;
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc;
background: #f8f8ff
}
h1 {
margin-right: auto;
font-family: Montserrat, sans-serif;
font-family: "Droid Sans","Noto Sans",Ubuntu,"Segoe UI","Lucida Grande",Verdana,Helvetica,sans-serif;
font-weight: 600;
font-size: 32px;
text-transform: uppercase;
color: #41465f;
border: 1px solid #dee2e6;
border-radius: 2px 2px 0 0;
width: 90%;
padding-left: 5%
}
h2,
h3 {
margin-right: auto;
font-family: "Droid Sans","Noto Sans",Ubuntu,"Segoe UI","Lucida Grande",Verdana,Helvetica,sans-serif;
font-weight: 600;
font-size: 25px;
text-transform: uppercase;
color: #41465f;
border: 1px solid #dee2e6;
border-radius: 2px 2px 0 0;
width: 90%;
padding-left: 5%
}
h4 {
margin-right: auto;
font-family: "Droid Sans","Noto Sans",Ubuntu,"Segoe UI","Lucida Grande",Verdana,Helvetica,sans-serif;
font-weight: 600;
font-size: 20px!important;
text-transform: uppercase;
color: #41465f;
border: 1px solid #dee2e6;
border-radius: 2px 2px 0 0;
width: 90%;
padding-left: 5%
}
.showhider {
margin-right: auto;
font-family: "Droid Sans","Noto Sans",Ubuntu,"Segoe UI","Lucida Grande",Verdana,Helvetica,sans-serif;
text-transform: uppercase;
background: 0 0!important;
border: none;
padding: 0!important;
width: 90%;
color: #3b6bbf;
text-decoration: none;
font-weight: 700;
word-wrap: break-word;
outline: 0;
text-align: left
}
#links .showhider {
font-size: 25px
}
#info-content {
display: none
}
.section-header {
display: flex;
flex-direction: row;
margin-bottom: 80px;
margin-bottom: 80px
}
body[i2pon] .hideIfI2POn,
body:not([i2pconsoleon]) .hideIfI2PConsoleOff,
body:not([i2pon]) .hideIfI2POff,
body:not([i2pproxyon]) .hideIfI2PProxyOff,
body[i2pconsoleon] .hideIfI2PConsoleOn,
body:not([i2pconsoleon]) .hideIfI2PConsoleOff {
display: none;
body[i2pon] .hideIfI2POn,
body[i2pproxyon] .hideIfI2PProxyOn {
display: none!important
}
ul {
margin-left: 2rem;
list-style: none
}
li {
min-height: 3rem;
padding: .5rem;
background: #dee2e6;
border: 1px solid #dee2e6;
width: 64%;
min-width: 64%;
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc;
margin: .5rem .5rem .5rem 32%
}
#readyness {
min-height: 5rem;
padding: .5rem;
margin: .5rem;
width: 42%;
min-width: 42%;
background: #dee2e6;
text-align: center!important;
border: 1px solid #dee2e6;
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc
}
#onboarding {
min-height: 5rem;
padding: .5rem;
margin: .5rem;
width: 42%;
min-width: 42%;
font-size: 2rem;
background: #a48fe1;
text-align: center!important;
border: 1px solid #a48fe1;
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc
}
#i2pbrowser-description {
width: 50%;
min-width: 50%;
min-height: 5rem;
padding: .5rem;
display: inline;
background: #dee2e6;
float: right;
border: 1px solid #dee2e6;
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc
}
#applicationExplain,
#linksExplain {
min-height: 5rem;
padding: .5rem;
margin: .5rem;
width: 30%;
min-width: 30%;
background: #dee2e6;
float: left;
text-align: center!important;
border: 1px solid #dee2e6;
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc
}
#proxyReady {
height: 3.5rem;
padding: .5rem;
margin: .2rem;
width: 38%;
min-width: 38%;
display: inline;
background: #d9d9d6;
float: right;
text-align: center!important;
border: 1px solid #d9d9d6;
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc
}
#proxyUnready {
height: 3.5rem;
padding: .5rem;
margin: .2rem;
width: 38%;
min-width: 38%;
display: inline;
float: right;
text-align: center!important;
border: 1px solid #ffc56d;
border-radius: 2px;
background: #ffc56d;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc
}
#consoleOn {
height: 3.5rem;
padding: .5rem;
margin: .2rem;
width: 38%;
min-width: 38%;
display: inline;
float: left;
text-align: center!important;
border: 1px solid #f7e59a;
border-radius: 2px;
background: #f7e59a;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc
}
#onboardingContentFour,
#onboardingContentOne,
#onboardingContentThree,
#onboardingContentTwo,
#onboardingContentZero {
display: none
}
.onboardingContent {
font-size: .8rem!important;
text-align: left
}
#onboarding-overlay-button {
display: none
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2019, The Invisible Internet Project.
* See LICENSE for licensing information.
*
* vim: set sw=2 sts=2 ts=8 et syntax=css:
*/
dialog {
width: 400px;
}
#progressHeading {
font-size: 110%;
margin: 8px 0px 8px 0px;
font-weight: bold;
}
#progressPleaseWait {
font-size: 110%;
margin-bottom: 15px;
}
#ibb-icon {
list-style-image: url("chrome://i2pbutton/skin/default48.png");
width: 48px;
height: 48px;
}
#progressDesc {
height: 48px;
}
#progressMeter {
margin-bottom: 16px;
}
.i2pWarning {
list-style-image: url("chrome://i2pbutton/skin/warning.png");
}
/* Ensure that our caution icon is always shown on GTK-based platforms. */
.i2pWarning .button-icon {
display: inline !important;
}

BIN
src/chrome/skin/warning.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -4,14 +4,9 @@
* Implements an observer that filters drag events to prevent OS
* access to URLs (a potential proxy bypass vector).
*************************************************************************/
const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://i2pbutton/modules/default-prefs.js", {}).ensureDefaultPrefs();
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
// Module specific constants
const kMODULE_NAME = "I2pbutton Drag and Drop Handler";
@ -21,22 +16,19 @@ const kMODULE_CID = Components.ID("f605ec27-d867-44b5-ad97-2a29276642c3");
const kInterfaces = [Ci.nsIObserver, Ci.nsIClassInfo];
function DragDropFilter() {
this.logger = Cc["@geti2p.net/i2pbutton-logger;1"]
.getService(Ci.nsISupports).wrappedJSObject;
this.logger = Cc["@geti2p.net/i2pbutton-logger;1"].getService(Ci.nsISupports).wrappedJSObject;
this.logger.log(3, "Component Load 0: New DragDropFilter.");
try {
var observerService = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
observerService.addObserver(this, "on-datatransfer-available", false);
} catch(e) {
Services.obs.addObserver(this, "on-datatransfer-available");
} catch (e) {
this.logger.log(5, "Failed to register drag observer");
}
}
DragDropFilter.prototype =
{
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, Ci.nsIObserver]),
QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
// make this an nsIClassInfo object
flags: Ci.nsIClassInfo.DOM_OBJECT,
@ -86,3 +78,5 @@ DragDropFilter.prototype =
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([DragDropFilter]);

View File

@ -35,13 +35,15 @@ IBI2PCheckService.prototype =
isConsoleWorking: false,
isProxyWorking: false,
isInProgressOfTestingConsole: false,
isInProgressOfTestingProxy: false,
wrappedJSObject: null,
_logger: null,
_statusOfI2PCheck: 0, // this.kCheckNotInitiated,
// make this an nsIClassInfo object
flags: Ci.nsIClassInfo.DOM_OBJECT,
// make this an singleton object
flags: Ci.nsIClassInfo.SINGLETON,
// method of nsIClassInfo
classDescription: kMODULE_NAME,
@ -71,17 +73,21 @@ IBI2PCheckService.prototype =
init: function () {
let self = this
this.isInProgressOfTestingConsole = true
let req = this.createCheckConsoleRequest(true)
req.onreadystatechange = function (event) {
if (req.readyState === 4) {
self.parseCheckConsoleResponse(req)
self.isInProgressOfTestingConsole = false
}
}
req.send(null)
this.isInProgressOfTestingProxy = true
let proxyReq = this.createCheckProxyRequest(true)
proxyReq.onreadystatechange = function (event) {
if (proxyReq.readyState === 4) {
self.parseCheckProxyResponse(proxyReq)
self.isInProgressOfTestingConsole = false
}
}
proxyReq.send(null)
@ -100,7 +106,7 @@ IBI2PCheckService.prototype =
createCheckConsoleRequest: function(aAsync)
{
let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch)
let port = prefs.getIntPref("extensions.i2pbutton.console_port_i2pj", 17657)
let port = prefs.getIntPref("extensions.i2pbutton.console_port_i2pj", 7647)
let url = `http://localhost:${port}/netdb?r=.`
return this._createRequest(url, aAsync, "text/html")
},

View File

@ -5,14 +5,37 @@ const Ci = Components.interfaces
const Cr = Components.results
const Cu = Components.utils
const nsISupports = Components.interfaces.nsISupports;
const nsIClassInfo = Components.interfaces.nsIClassInfo;
const nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar;
const nsIObserverService = Components.interfaces.nsIObserverService;
// ctypes can be disabled at build time
try { Cu.import("resource://gre/modules/ctypes.jsm") } catch(e) {}
Cu.import("resource://gre/modules/XPCOMUtils.jsm")
Cu.import("resource://gre/modules/Services.jsm")
XPCOMUtils.defineLazyModuleGetter(this, "LauncherUtil", "resource://i2pbutton/modules/launcher-util.jsm")
//let observerService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService)
const timer = Cc["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer)
let routerStateLoglines = [
'Router state change from STARTING_1 to STARTING_2',
'Router state change from STARTING_2 to STARTING_3',
'Router state change from STARTING_3 to NETDB_READY',
'Router state change from NETDB_READY to RUNNING'
]
function setTimeout(fn, sleep) {
let event = {
notify: fn
}
return timer.initWithCallback(event, sleep, Components.interfaces.nsITimer.TYPE_ONE_SHOT)
}
function I2PProcessService()
{
this._logger = Cc["@geti2p.net/i2pbutton-logger;1"].getService(Ci.nsISupports).wrappedJSObject
@ -23,11 +46,15 @@ function I2PProcessService()
I2PProcessService.prototype =
{
kContractID : "@geti2p.net/i2pbutton-process-service;1",
kServiceName : "I2P Launcher Process Service",
kClassID: Components.ID("{f77babef-dead-b00b-beff-babe6c9afda7}"),
contractID : "@geti2p.net/i2pbutton-process-service;1",
serviceName : "I2P Launcher Process Service",
classID: Components.ID("{f77babef-dead-b00b-beff-babe6c9afda7}"),
kI2PLauncherExtPath: "i2pbutton@geti2p.net", // This could vary.
classDescription: this.kServiceName,
flags: Ci.nsIClassInfo.SINGLETON,
kPrefPromptAtStartup: "extensions.i2pbutton.prompt_at_startup",
kWizardProgressPageID: "progress",
@ -48,18 +75,7 @@ I2PProcessService.prototype =
kI2PBootstrapErrorTopic: "I2PBootstrapError",
// nsISupports implementation.
QueryInterface: function(aIID)
{
if (!aIID.equals(Ci.nsISupports) &&
!aIID.equals(Ci.nsIFactory) &&
!aIID.equals(Ci.nsIObserver) &&
!aIID.equals(Ci.nsIClassInfo))
{
throw Cr.NS_ERROR_NO_INTERFACE;
}
return this;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIClassInfo]),
// nsIFactory implementation.
createInstance: function(aOuter, aIID)
@ -70,6 +86,16 @@ I2PProcessService.prototype =
return this.QueryInterface(aIID);
},
QueryInterface: function(iid)
{
if (!iid.equals(nsIClassInfo) &&
!iid.equals(nsISupports)) {
Components.returnCode = Cr.NS_ERROR_NO_INTERFACE;
return null;
}
return this;
},
init: function(aWindow) {},
uninit: function unit() {},
@ -94,19 +120,49 @@ I2PProcessService.prototype =
const self = this
this._logger.log(3, 'Checking if a console is already up (an router already running)')
this._isConsoleRunning(function(res) {
//this._logger.log(3, 'Checking if a console is already up (an router already running)')
let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch)
let shouldShowDelayUserDialog = prefs.getBoolPref("extensions.i2pbutton.delay_user_with_dialog", true)
let canStartPromise = self._config_checker.ensure_config()
canStartPromise.then(() => {
self._logger.log(3, 'Starting the router')
self.I2PStartAndControlI2P(true)
})
try {
if (shouldShowDelayUserDialog) {
self.openWaitForRouterDialog()
setTimeout(() => {
let progressmeter = self.mDelayUserDialog.document.getElementById('progressMeter')
progressmeter.value = progressmeter.value + 35
var text = self.mDelayUserDialog.document.getElementById('progressPleaseWait')
text.value = 'Waiting for the router to open the console and proxy port.'
}, 5000)
}
} catch (err) {
self._logger.log(5, `Unknown error while executing delay user dialog: ${err}`)
}
// After the router process is spawned.
/*if (self.mDelayUserDialog) {
setTimeout(() => {
let progressmeter = self.mDelayUserDialog.document.getElementById('progressMeter')
progressmeter.value = progressmeter.value + 35
var text = self.mDelayUserDialog.document.getElementById('progressPleaseWait')
text.value = 'Waiting for the router to open the console and proxy port.'
}, 5000)
}*/
/*this._isConsoleRunning(function(res) {
if (res!=4) {
// Yes, 4 is success
let canStartPromise = self._config_checker.ensure_config()
canStartPromise.then(() => {
self._logger.log(3, 'Starting the router')
self.I2PStartAndControlI2P(true)
})
} else {
self._logger.log(3, 'Already found a router, won\'t launch.')
}
})
})*/
}
else if ("quit-application-granted" == aTopic)
{
@ -119,8 +175,8 @@ I2PProcessService.prototype =
let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch)
let shouldKillRouter = prefs.getBoolPref("extensions.i2pbutton.kill_router_on_exit", true)
if (shouldKillRouter) this.mI2PProcess.kill()
this._logger.log(4, "Disconnecting from i2p process (pid " + this.mI2PProcess.pid + ")");
this.mI2PProcess = null;
this._logger.log(4, "Disconnecting from i2p process (pid " + this.mI2PProcess.pid + ")")
this.mI2PProcess = null
}
}
else if (("process-failed" == aTopic) || ("process-finished" == aTopic))
@ -135,11 +191,11 @@ I2PProcessService.prototype =
this.mI2PProcessStatus = this.kStatusExited;
this.mIsBootstrapDone = false;
this.mObsSvc.notifyObservers(null, "I2PProcessExited", null);
this.mObsSvc.notifyObservers(null, "I2PProcessExited", null)
if (this.mIsQuitting)
{
LauncherUtil.cleanupTempDirectories();
LauncherUtil.cleanupTempDirectories()
}
else
{
@ -147,9 +203,9 @@ I2PProcessService.prototype =
var cancelBtnLabel = "OK";
try
{
const kSysBundleURI = "chrome://global/locale/commonDialogs.properties";
var sysBundle = Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService).createBundle(kSysBundleURI);
cancelBtnLabel = sysBundle.GetStringFromName(cancelBtnLabel);
const kSysBundleURI = "chrome://global/locale/commonDialogs.properties"
var sysBundle = Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService).createBundle(kSysBundleURI)
cancelBtnLabel = sysBundle.GetStringFromName(cancelBtnLabel)
} catch(e) {}
this._logger.log(3, 'The router stopped..')
@ -167,9 +223,9 @@ I2PProcessService.prototype =
this.mObsSvc.notifyObservers(null, "I2PProcessIsReady", null)
}
} else if (kBootstrapStatusTopic == aTopic) {
//this._processBootstrapStatus(aSubject.wrappedJSObject);
this._processBootstrapStatus(aSubject.wrappedJSObject)
} else if (kUserQuitTopic == aTopic) {
this.mQuitSoon = true;
this.mQuitSoon = true
}
},
@ -188,28 +244,6 @@ I2PProcessService.prototype =
getHelperForLanguage: function (aLanguage) { return null; },
contractID: this.kContractID,
classDescription: this.kServiceName,
classID: this.kClassID,
flags: Ci.nsIClassInfo.SINGLETON,
classInfo : XPCOMUtils.generateCI({
classID: this.kClassID,
contractID: this.kContractID,
classDescription: this.kServiceName,
interfaces: [
Ci.nsISupports,
Ci.nsIFactory,
Ci.nsIObserver,
Ci.nsIClassInfo
],
flags: Ci.nsIClassInfo.SINGLETON
}),
// Hack to get us registered early to observe recovery
_xpcom_categories: [{category:"profile-after-change"}],
// Public Properties and Methods ///////////////////////////////////////////
get I2PProcessStatus()
@ -227,6 +261,46 @@ I2PProcessService.prototype =
},
openWaitForRouterDialog: function() {
const self = this
//var win = ww.openWindow(null, "chrome://i2pbutton/content/progress.xul", "wizard", "chrome,dialog=no,modal,centerscreen", {blabla:0})
const ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].getService(Components.interfaces.nsIWindowWatcher)
self.mDelayUserDialog = ww.openWindow(
null,
"chrome://i2pbutton/content/progress.xul",
"startingrouter",
"chrome,dialog=no,modal,centerscreen",
[true])
this._logger.log(3, 'After open wait for router dialog')
setTimeout(() => {
let progressmeter = self.mDelayUserDialog.document.getElementById('progressMeter')
progressmeter.value = progressmeter.value + 15
var text = self.mDelayUserDialog.document.getElementById('progressPleaseWait')
text.hidden = false
}, 1000)
return self.mDelayUserDialog
},
getWrapperLog: function() {
let wrapperLogFile = LauncherUtil.dataDirectoryObject
wrapperLogFile.append('I2P')
wrapperLogFile.append('wrapper.log')
return this._getFileAsString(wrapperLogFile)
},
getLogsLogTxt: function() {
let logTxtFile = LauncherUtil.dataDirectoryObject
logTxtFile.append('I2P')
logTxtFile.append('logs')
logTxtFile.append('log-0.txt')
return this._getFileAsString(logTxtFile)
},
retrieveBootstrapStatus: function() {},
I2PStartAndControlI2P: function()
{
this._startI2P()
@ -256,8 +330,22 @@ I2PProcessService.prototype =
mLastI2PWarningPhase: null,
mLastI2PWarningReason: null,
mDefaultPreferencesAreLoaded: false,
mDelayUserDialog: null,
// Private Methods /////////////////////////////////////////////////////////
_resetLogFiles: function() {
let wrapperLogFile = LauncherUtil.dataDirectoryObject
wrapperLogFile.append('I2P')
wrapperLogFile.append('wrapper.log')
if (wrapperLogFile.exists()) wrapperLogFile.remove(false)
let logTxtFile = LauncherUtil.dataDirectoryObject
logTxtFile.append('I2P')
logTxtFile.append('logs')
logTxtFile.append('log-0.txt')
if (logTxtFile.exists()) logTxtFile.remove(false)
},
_startI2P: function()
{
this.mI2PProcessStatus = this.kStatusUnknown;
@ -270,13 +358,13 @@ I2PProcessService.prototype =
try
{
// Ideally, we would cd to the Firefox application directory before
// starting tor (but we don't know how to do that). Instead, we
// rely on the TBB launcher to start Firefox from the right place.
// starting i2p (but we don't know how to do that). Instead, we
// rely on the IBB launcher to start Firefox from the right place.
// Get the I2P data directory first so it is created before we try to
// construct paths to files that will be inside it.
let dataDir = LauncherUtil.getI2PConfigPath(true)
let exeFile = LauncherUtil.getI2PFile("i2p", false)
let exeFile = LauncherUtil.getI2PBinary()
this._logger.log(3, `Datadir => ${dataDir.path}\nExeFile => ${exeFile.path}`)
var detailsKey;
@ -294,13 +382,13 @@ I2PProcessService.prototype =
return;
}
this._resetLogFiles()
let args = LauncherUtil.getRouterDefaultArgs()
// Set an environment variable that points to the I2P data directory.
// This is used by meek-client-torbrowser to find the location for
// the meek browser profile.
let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment)
env.set("I2P_BROWSER_I2P_DATA_DIR", dataDir.path)
env.set('I2P_BROWSER_I2P_DATA_DIR', dataDir.path)
// On Windows, prepend the I2P program directory to PATH. This is
// needed so that pluggable transports can find OpenSSL DLLs, etc.
@ -322,7 +410,7 @@ I2PProcessService.prototype =
p.init(exeFile)
for (var i = 0; i < args.length; ++i)
this._logger.log(2, " " + args[i])
this._logger.log(2, ` ${args[i]}`)
// Possible fix for Windows and cmd.exe window spawn.
p.startHidden = true
@ -336,42 +424,90 @@ I2PProcessService.prototype =
{
this.mI2PProcessStatus = this.kStatusExited
//var s = LauncherUtil.getLocalizedString("i2p_failed_to_start");
//this._notifyUserOfError(s, null, this.kI2PProcessDidNotStartTopic);
this._notifyUserOfError('Failed to start the I2P router', null, this.kI2PProcessDidNotStartTopic);
this._logger.log(4, "_startI2P error: ", e)
}
}, // _startI2P()
_isConsoleRunning: function(callback) {
let checkSvc = Cc["@geti2p.net/i2pbutton-i2pCheckService;1"].getService(Ci.nsISupports).wrappedJSObject
let req = checkSvc.createCheckConsoleRequest(true);
let obsSvc = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService)
let req = checkSvc.createCheckConsoleRequest(true)
const self = this
req.onreadystatechange = function(event) {
if (req.readyState === 4) {
// Done
let result = checkSvc.parseCheckConsoleResponse(req)
self.mIsBootstrapDone = true
self.mI2PProcessStatus = self.kStatusRunning
self._processBootstrapStatus({ PROGRESS: 100, message: 'The router has succcessfully started.' })
var statusObj = { bootstrap: 'done', success: true }
statusObj.wrappedJSObject = statusObj
obsSvc.notifyObservers(statusObj, "I2PBootstrapStatus", null)
callback(result)
}
}
req.send(null)
},
_processBootstrapStatus: function(aStatusObj)
{
if (!aStatusObj)
return
if (100 == aStatusObj.PROGRESS)
{
this.mIsBootstrapDone = true
this.mBootstrapErrorOccurred = false
LauncherUtil.setBoolPref(this.kPrefPromptAtStartup, false)
}
else
{
this.mIsBootstrapDone = false
if (aStatusObj._errorOccurred)
{
this.mBootstrapErrorOccurred = true
LauncherUtil.setBoolPref(this.kPrefPromptAtStartup, true)
let phase = LauncherUtil.getLocalizedBootstrapStatus(aStatusObj, "TAG")
let reason = LauncherUtil.getLocalizedBootstrapStatus(aStatusObj, "REASON")
let details = LauncherUtil.getFormattedLocalizedString(
"i2p_bootstrap_failed_details", [phase, reason], 2)
I2PLauncherLogger.log(5, "I2P bootstrap error: [" + aStatusObj.TAG +
"/" + aStatusObj.REASON + "] " + details);
if ((aStatusObj.TAG != this.mLastI2PWarningPhase) ||
(aStatusObj.REASON != this.mLastI2PWarningReason))
{
this.mLastI2PWarningPhase = aStatusObj.TAG
this.mLastI2PWarningReason = aStatusObj.REASON
let msg = LauncherUtil.getLocalizedString("i2p_bootstrap_failed")
this._notifyUserOfError(msg, details, this.kI2PBootstrapErrorTopic)
}
}
}
}, // _processBootstrapStatus()
_controlI2P: function(aIsRunningI2P)
{
try
{
if (aIsRunningI2P)
this._monitorI2PProcessStartup();
this._monitorI2PProcessStartup()
// If the user pressed "Quit" within settings/progress, exit.
if (this.mQuitSoon)
this._quitApp();
this._quitApp()
}
catch (e)
{
this.mI2PProcessStatus = this.kStatusExited;
var s = LauncherUtil.getLocalizedString("i2p_control_failed");
this._notifyUserOfError(s, null, null);
this._logger.log(4, "_controlI2P error: ", e);
this.mI2PProcessStatus = this.kStatusExited
var s = LauncherUtil.getLocalizedString("i2p_control_failed")
this._notifyUserOfError(s, null, null)
this._logger.log(4, "_controlI2P error: ", e)
}
}, // controlI2P()
@ -384,8 +520,8 @@ I2PProcessService.prototype =
this.mI2PProcess.kill()
}
var asSvc = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);
var flags = asSvc.eAttemptQuit;
let asSvc = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);
let flags = asSvc.eAttemptQuit;
asSvc.quit(flags);
}
catch (e)
@ -403,25 +539,25 @@ I2PProcessService.prototype =
_notifyUserOfError: function(aMessage, aDetails, aNotifyTopic)
{
let errorObj = { handled: false, message: aMessage };
let errorObj = { handled: false, message: aMessage }
if (aDetails)
errorObj.details = aDetails;
errorObj.details = aDetails
if (aNotifyTopic)
{
// Give other code an opportunity to handle this error, e.g., if the
// network settings window is open, errors are displayed using an
// overlaid XUL element.
errorObj.wrappedJSObject = errorObj;
this.mObsSvc.notifyObservers(errorObj, aNotifyTopic, null);
errorObj.wrappedJSObject = errorObj
this.mObsSvc.notifyObservers(errorObj, aNotifyTopic, null)
}
if (!errorObj.handled)
{
let msg = aMessage;
let msg = aMessage
if (aDetails)
msg += "\n\n" + aDetails;
I2PLauncherUtil.showAlert(null, msg);
msg += "\n\n" + aDetails
LauncherUtil.showAlert(null, msg)
}
},
@ -565,4 +701,4 @@ function NSGetFactory(aClassID)
// This is the new stuff, stay away from generateNSGetModule which is the old stuff..
//var NSGetFactory = XPCOMUtils.generateNSGetFactory([I2PProcessService])
var NSGetFactory = XPCOMUtils.generateNSGetFactory([I2PProcessService])

View File

@ -4,13 +4,15 @@ const kMODULE_NAME = "I2pbutton Logger"
const kMODULE_CONTRACTID = "@geti2p.net/i2pbutton-logger;1"
const kMODULE_CID = Components.ID("f36d72c9-9718-4134-b550-e109638331d7")
const Cr = Components.results
const Cc = Components.classes
const Ci = Components.interfaces
const Cu = Components.utils
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://i2pbutton/modules/default-prefs.js", {}).ensureDefaultPrefs()
Cu.import("resource://gre/modules/Services.jsm")
Cu.import("resource://gre/modules/Log.jsm")
let console = (Cu.import("resource://gre/modules/Console.jsm", {})).console
@ -22,14 +24,12 @@ function I2pbuttonLogger() {
this.logmethod = Services.prefs.getIntPref("extensions.i2pbutton.logmethod");
try {
var logMngr = Components.classes["@mozmonkey.com/debuglogger/manager;1"]
.getService(Components.interfaces.nsIDebugLoggerManager);
var logMngr = Cc["@mozmonkey.com/debuglogger/manager;1"].getService(Ci.nsIDebugLoggerManager);
this._debuglog = logMngr.registerLogger("i2pbutton");
} catch (exErr) {
this._debuglog = false;
}
this._console = Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService);
this._console = Services.console;
// This JSObject is exported directly to chrome
this.wrappedJSObject = this;
@ -107,32 +107,32 @@ I2pbuttonLogger.prototype =
},
safe_log: function(level, str, scrub) {
if (this.loglevel < 4) {
this.eclog(level, str+scrub);
} else {
this.eclog(level, str+" [scrubbed]");
}
if (this.loglevel < 4) {
this.eclog(level, str+scrub);
} else {
this.eclog(level, str+" [scrubbed]");
}
},
log: function(level, str) {
switch(this.logmethod) {
case 2: // debuglogger
if(this._debuglog) {
this._debuglog.log((6-level), this.formatLog(str,level));
break;
}
// fallthrough
case 0: // stderr
if(this.loglevel <= level)
dump(this.formatLog(str,level)+"\n");
break;
default:
dump("Bad log method: "+this.logmethod);
case 1: // errorconsole
if(this.loglevel <= level)
this._console.logStringMessage(this.formatLog(str,level));
break;
}
switch(this.logmethod) {
case 2: // debuglogger
if(this._console) {
this._console.log((6-level), this.formatLog(str,level));
break;
}
// fallthrough
case 0: // stderr
if(this.loglevel <= level)
dump(this.formatLog(str,level)+"\n");
break;
default:
dump("Bad log method: "+this.logmethod);
case 1: // errorconsole
if(this.loglevel <= level)
this._console.logStringMessage(this.formatLog(str,level));
break;
}
},
error: function(str) { this.log(6, str) },
@ -149,25 +149,25 @@ I2pbuttonLogger.prototype =
// data: which pref has been changed (relative to subject)
observe: function(subject, topic, data)
{
if (topic != "nsPref:changed") return;
switch (data) {
case "extensions.i2pbutton.logmethod":
this.logmethod = Services.prefs.getIntPref("extensions.i2pbutton.logmethod");
if (this.logmethod === 0) {
Services.prefs.setBoolPref("browser.dom.window.dump.enabled",
true);
} else if (Services.prefs.
getIntPref("extensions.i2plauncher.logmethod", 3) !== 0) {
// If Tor Launcher is not available or its log method is not 0
// then let's reset the dump pref.
Services.prefs.setBoolPref("browser.dom.window.dump.enabled",
false);
}
break;
case "extensions.i2pbutton.loglevel":
this.loglevel = Services.prefs.getIntPref("extensions.i2pbutton.loglevel");
break;
}
if (topic != "nsPref:changed") return;
switch (data) {
case "extensions.i2pbutton.logmethod":
this.logmethod = Services.prefs.getIntPref("extensions.i2pbutton.logmethod");
if (this.logmethod === 0) {
Services.prefs.setBoolPref("browser.dom.window.dump.enabled",
true);
} else if (Services.prefs.
getIntPref("extensions.i2plauncher.logmethod", 3) !== 0) {
// If I2P Launcher is not available or its log method is not 0
// then let's reset the dump pref.
Services.prefs.setBoolPref("browser.dom.window.dump.enabled",
false);
}
break;
case "extensions.i2pbutton.loglevel":
this.loglevel = Services.prefs.getIntPref("extensions.i2pbutton.loglevel");
break;
}
}
}

View File

@ -5,6 +5,11 @@ const Ci = Components.interfaces
const Cr = Components.results
const Cu = Components.utils
const nsISupports = Components.interfaces.nsISupports;
const nsIClassInfo = Components.interfaces.nsIClassInfo;
const nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar;
const nsIObserverService = Components.interfaces.nsIObserverService;
/*const ZipReader = Components.Constructor(
"@mozilla.org/libjar/zip-reader;1",
"nsIZipReader",
@ -22,8 +27,21 @@ Cu.import('resource://gre/modules/FileUtils.jsm')
XPCOMUtils.defineLazyModuleGetter(this, "LauncherUtil", "resource://i2pbutton/modules/launcher-util.jsm")
let consolePort = Services.prefs.getIntPref("extensions.i2pbutton.console_port_i2pj", 17657)
let httpProxyPort = Services.prefs.getIntPref("network.proxy.http_port", 14444)
let consolePort = Services.prefs.getIntPref("extensions.i2pbutton.console_port_i2pj", 7647)
let httpProxyPort = Services.prefs.getIntPref("network.proxy.http_port", 7644)
let popClientPort = Services.prefs.getIntPref("extensions.i2pbutton.pop3_port", 7645)
let smtpClientPort = Services.prefs.getIntPref("extensions.i2pbutton.smtp_port", 7646)
// The preferences code above might return "0" in some cases, we need to override it then.
if (parseInt(consolePort) == 0) { consolePort=7647 }
if (parseInt(httpProxyPort) == 0) { httpProxyPort=7644 }
if (parseInt(popClientPort) == 0) { popClientPort=7645 }
if (parseInt(smtpClientPort) == 0) { smtpClientPort=7646 }
const defaultWebappsConfig = `# Autogenerated by I2P Browser
webapps.jsonrpc.startOnLoad=true
webapps.routerconsole.startOnLoad=true
webapps.i2ptunnel.startOnLoad=true
`
const defaultProxyTunnels = `# Autogenerated by I2P Browser
tunnel.0.description=HTTP proxy for browsing eepsites and the web
@ -39,7 +57,7 @@ tunnel.0.option.i2cp.reduceIdleTime=900000
tunnel.0.option.i2cp.reduceOnIdle=true
tunnel.0.option.i2cp.reduceQuantity=1
tunnel.0.option.i2p.streaming.connectDelay=0
tunnel.0.option.i2ptunnel.httpclient.SSLOutproxies=false.i2p
tunnel.0.option.i2ptunnel.httpclient.SSLOutproxies=false.i2p,exitulbsnsksxmxeokehe56i4ixfiy7q54psybce2wcfdojtghla.b32.i2p,exitkbklp7cpv326cnwniaj4mcbvt5fxbi6o5fgokpjqqz2yq6aa.b32.i2p,exitrts24sirf36zxmohswnqdjwfeee56id6pq2mbsidmpyo5i2a.b32.i2p,exitffc43eewzqmdgjekatq7svkddxznmifyyet35suetr5v7tzq.b32.i2p,exitogozlvokfzegkposvub53qtc7honedk6jggip35i5g74d2tq.b32.i2p,exitxwqntj5ix76yj2l34k53cwnswm4mv6kkuo65djyvd2xtek3q.b32.i2p,exitkvfpe5newfmj6vjo36whhuczaco54vrnkxwcbnb4jyqbqieq.b32.i2p,exittheiaghqhegtaifebrhgubf5x2lgxvdwtyfx6pcyzyccnbza.b32.i2p,exitvjf23kkrwfys2rmdlksqmntpcbwl22jgp7xz5d54kswlv2ea.b32.i2p,exiton6zhnnbvibjf6af2f35k6zty2twfizkixigv3lspzrt6jiq.b32.i2p,exit2t6lpxdfa7lh7myo74ndimkqdld5dcvbksf2ir2bineee4kq.b32.i2p,exit4shkhrjivffa6me7rk6z3qeqtlowkfmmegtlh4s6r42udyba.b32.i2p,exitsbu7rdzut7w2cta3deefloqtm6vlqvc5tl2qlxksdtsgdtzq.b32.i2p,exitc3ixaawclcrfqtdkqx3dz7z4kmqqwb6xjdcjxhiqpyqaxykq.b32.i2p,exit3324w3wmxf4dm557oyb7xu22h27dzfrlsfomfju55c7vzunq.b32.i2p,exitfeu3f52m3t4quju35rbboqio7p6hb2u3ufsyapcujtw45sdq.b32.i2p,exity5apnxal6p4v5irknmvcahsruccauxizycd7rr5jj3xfvrpq.b32.i2p,exitq45yln7rufb2nds5n3wtbq5onxaquclouoqe2rgw7uux5kea.b32.i2p,exithmchu47w4ykmsuhu2ixuwgj7m47nlu7xdooeykcerl5nps2a.b32.i2p,exit24yuwd4lvbfylahr7z5hxddn7dy5z6wzn77pjmg3uujfpxna.b32.i2p
tunnel.0.option.i2ptunnel.httpclient.allowInternalSSL=true
tunnel.0.option.i2ptunnel.httpclient.jumpServers=http://stats.i2p/cgi-bin/jump.cgi?a=,http://i2pjump.i2p/jump/
tunnel.0.option.i2ptunnel.httpclient.sendAccept=false
@ -61,10 +79,45 @@ tunnel.0.option.outproxyAuth=false
tunnel.0.option.persistentClientKey=false
tunnel.0.option.sslManuallySet=true
tunnel.0.option.useSSL=false
tunnel.0.proxyList=false.i2p
tunnel.0.proxyList=false.i2p,exitulbsnsksxmxeokehe56i4ixfiy7q54psybce2wcfdojtghla.b32.i2p,exitkbklp7cpv326cnwniaj4mcbvt5fxbi6o5fgokpjqqz2yq6aa.b32.i2p,exitrts24sirf36zxmohswnqdjwfeee56id6pq2mbsidmpyo5i2a.b32.i2p,exitffc43eewzqmdgjekatq7svkddxznmifyyet35suetr5v7tzq.b32.i2p,exitogozlvokfzegkposvub53qtc7honedk6jggip35i5g74d2tq.b32.i2p,exitxwqntj5ix76yj2l34k53cwnswm4mv6kkuo65djyvd2xtek3q.b32.i2p,exitkvfpe5newfmj6vjo36whhuczaco54vrnkxwcbnb4jyqbqieq.b32.i2p,exittheiaghqhegtaifebrhgubf5x2lgxvdwtyfx6pcyzyccnbza.b32.i2p,exitvjf23kkrwfys2rmdlksqmntpcbwl22jgp7xz5d54kswlv2ea.b32.i2p,exiton6zhnnbvibjf6af2f35k6zty2twfizkixigv3lspzrt6jiq.b32.i2p,exit2t6lpxdfa7lh7myo74ndimkqdld5dcvbksf2ir2bineee4kq.b32.i2p,exit4shkhrjivffa6me7rk6z3qeqtlowkfmmegtlh4s6r42udyba.b32.i2p,exitsbu7rdzut7w2cta3deefloqtm6vlqvc5tl2qlxksdtsgdtzq.b32.i2p,exitc3ixaawclcrfqtdkqx3dz7z4kmqqwb6xjdcjxhiqpyqaxykq.b32.i2p,exit3324w3wmxf4dm557oyb7xu22h27dzfrlsfomfju55c7vzunq.b32.i2p,exitfeu3f52m3t4quju35rbboqio7p6hb2u3ufsyapcujtw45sdq.b32.i2p,exity5apnxal6p4v5irknmvcahsruccauxizycd7rr5jj3xfvrpq.b32.i2p,exitq45yln7rufb2nds5n3wtbq5onxaquclouoqe2rgw7uux5kea.b32.i2p,exithmchu47w4ykmsuhu2ixuwgj7m47nlu7xdooeykcerl5nps2a.b32.i2p,exit24yuwd4lvbfylahr7z5hxddn7dy5z6wzn77pjmg3uujfpxna.b32.i2p
tunnel.0.sharedClient=true
tunnel.0.startOnLoad=true
tunnel.0.type=httpclient
tunnel.1.description=smtp server
tunnel.1.interface=127.0.0.1
tunnel.1.listenPort=${smtpClientPort}
tunnel.1.name=smtp.postman.i2p
tunnel.1.option.inbound.nickname=shared clients
tunnel.1.option.outbound.nickname=shared clients
tunnel.1.option.i2cp.reduceIdleTime=900000
tunnel.1.option.i2cp.reduceOnIdle=true
tunnel.1.option.i2cp.reduceQuantity=1
tunnel.1.option.inbound.length=3
tunnel.1.option.inbound.lengthVariance=0
tunnel.1.option.outbound.length=3
tunnel.1.option.outbound.lengthVariance=0
tunnel.1.startOnLoad=true
tunnel.1.targetDestination=smtp.postman.i2p:25
tunnel.1.type=client
tunnel.1.sharedClient=true
tunnel.2.name=pop3.postman.i2p
tunnel.2.description=pop3 server
tunnel.2.interface=127.0.0.1
tunnel.2.listenPort=${popClientPort}
tunnel.2.option.inbound.nickname=shared clients
tunnel.2.option.outbound.nickname=shared clients
tunnel.2.option.i2cp.reduceIdleTime=900000
tunnel.2.option.i2cp.reduceOnIdle=true
tunnel.2.option.i2cp.reduceQuantity=1
tunnel.2.option.i2p.streaming.connectDelay=1000
tunnel.2.option.inbound.length=3
tunnel.2.option.inbound.lengthVariance=0
tunnel.2.option.outbound.length=3
tunnel.2.option.outbound.lengthVariance=0
tunnel.2.startOnLoad=true
tunnel.2.targetDestination=pop.postman.i2p:110
tunnel.2.type=client
tunnel.2.sharedClient=true
`
const defaultClientsConfig = `# Autogenerated by I2P Browser
@ -117,17 +170,53 @@ tunnel.1.startOnLoad=false
tunnel.1.type=sockstunnel
`
const defaultSusiMailConfig = `# Autogenerated by I2P Browser
susimail.composer.cols=80
susimail.composer.copy.to.sent=true
susimail.composer.rows=15
susimail.debug=false
susimail.host=localhost
susimail.pager.pagesize=30
susimail.pop3.check.enable=false
susimail.pop3.check.interval.minutes=180
susimail.pop3.idle.timeout.seconds=240
susimail.pop3.leave.on.server=false
susimail.ports.fixed=true
susimail.ports.pop3=${popClientPort}
susimail.ports.smtp=${smtpClientPort}
susimail.sender.domain=mail.i2p
susimail.sender.fixed=true
`
const defaultSnarkConfig = `# Autogenerated by I2P Browser
i2psnark.autoStart=false
i2psnark.collapsePanels=true
i2psnark.comments=true
i2psnark.commentsName=
i2psnark.dir=i2psnark
i2psnark.i2cpOptions=inbound.length=3 outbound.length=3 inbound.quantity=3 outbound.quantity=3
i2psnark.pageSize=50
i2psnark.ratings=true
i2psnark.refreshSeconds=60
i2psnark.startupDelay=3
i2psnark.theme=light
i2psnark.uploaders.total=20
`
const defaultRouterConfig = `# Autogenerated by I2P Browser
i2np.laptopMode=true
i2np.upnp.enable=true
i2np.udp.addressSources=local,upnp,ssu
i2p.reseedURL=https://download.xxlspeed.com/,https://i2p.mooo.com/netDb/,https://i2p.novg.net/,https://i2pseed.creativecowpat.net:8443/,https://itoopie.atomike.ninja/,https://netdb.i2p2.no/,https://reseed.i2p-projekt.de/,https://reseed.i2p.net.in/,https://reseed.memcpy.io/,https://reseed.onion.im/
i2p.reseedURL=https://download.xxlspeed.com/,https://i2p.mooo.com/netDb/,https://i2p.novg.net/,https://i2pseed.creativecowpat.net:8443/,https://netdb.i2p2.no/,https://reseed.i2p-projekt.de/,https://reseed.i2p.net.in/,https://reseed.memcpy.io/,https://reseed.onion.im/,https://reseed.i2p2.no/,https://reseed2.i2p2.no/
router.outboundPool.quantity=7
router.inboundPool.quantity=7
router.sharePercentage=50
i2cp.hostname=127.0.0.1
i2cp.port=17654
router.startup.jetty9.migrated=true
routerconsole.welcomeWizardComplete=true
`
function RouterConfigManager() {
this.version = '0.1'
this._logger = Cc["@geti2p.net/i2pbutton-logger;1"].getService(Ci.nsISupports).wrappedJSObject
@ -148,36 +237,82 @@ RouterConfigManager.prototype = {
// State
mDoesRouterConfigExists: false,
mDoesClientsConfigExists: false,
mDoesSusiConfigExists: false,
mDoesSnarkConfigExists: false,
mDoesTunnelConfigExists: false,
mDoesWebappsConfigExists: false,
mHasChecksStarted: false,
mIsChecksDone: false,
// nsISupports implementation.
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports]),
QueryInterface: function(iid)
{
if (!iid.equals(nsIClassInfo) &&
!iid.equals(nsISupports)) {
Components.returnCode = Cr.NS_ERROR_NO_INTERFACE;
return null;
}
return this;
},
canRouterStart: function() {
return (this.mDoesRouterConfigExists && this.mDoesClientsConfigExists && this.mDoesTunnelConfigExists)
},
_write_router_config: function(configfile,onComplete) {
_write_config: function(configfile, content, onComplete) {
const self = this
LauncherUtil.writeFileWithData(configfile, defaultRouterConfig, file => { onComplete(file) }, (err) => {
this._logger.log(6,`Can't write router config file :( - path was ${configfile.path}`)
LauncherUtil.writeFileWithData(configfile, content, file => { onComplete(file) }, (err) => {
this._logger.log(6,`Can't write config file :( - path was ${configfile.path}, error: ${err}`)
})
},
_write_tunnel_config: function(configfile,onComplete) {
const self = this
LauncherUtil.writeFileWithData(configfile, defaultProxyTunnels, file => { onComplete(file) }, (err) => {
this._logger.log(6,`Can't write tunnel proxy config file :( - path was ${configfile.path}`)
})
copy_recursive: async function(sourceDir, destDir) {
let items = sourceDir.directoryEntries
while (items.hasMoreElements()) {
let item = items.getNext().QueryInterface(Components.interfaces.nsIFile)
if (item.isFile()) {
item.copyTo(destDir, "")
this._logger.log(3, `Copied ${item.path}`)
} else if (item.isDirectory()) {
let newDir = destDir.clone()
newDir.append(item.leafName)
newDir.create(newDir.DIRECTORY_TYPE, 0o700)
this._logger.log(3, `Recursively copying ${item.path}`)
this.copy_recursive(item, newDir)
}
}
},
_write_clients_config: function(configfile,onComplete) {
const self = this
LauncherUtil.writeFileWithData(configfile, defaultClientsConfig, file => { onComplete(file) }, (err) => {
this._logger.log(6,`Can't write clients config file :( - path was ${configfile.path}`)
})
ensure_docs: async function() {
let configDirectory = LauncherUtil.getI2PConfigPath(true)
let destDocsDir = configDirectory.clone()
let distDocsDir = LauncherUtil.getI2PBinary()
distDocsDir = distDocsDir.parent.parent
distDocsDir.append('docs')
destDocsDir.append('docs')
if (!destDocsDir.exists()) {
this.copy_recursive(distDocsDir, destDocsDir)
}
},
ensure_webapps: async function() {
let configDirectory = LauncherUtil.getI2PConfigPath(true)
let destWebappDir = configDirectory.clone()
let distWebppDir = LauncherUtil.getI2PBinary()
distWebppDir = distWebppDir.parent.parent
distWebppDir.append('webapps')
destWebappDir.append('webapps')
if (!destWebappDir.exists()) {
destWebappDir.create(destWebappDir.DIRECTORY_TYPE, 0o700)
let items = distWebppDir.directoryEntries
while (items.hasMoreElements()) {
let item = items.getNext().QueryInterface(Components.interfaces.nsIFile)
if (item.isFile()) {
item.copyTo(destWebappDir, "")
this._logger.log(3, `Copied ${item.path}`)
}
}
}
},
@ -189,8 +324,44 @@ RouterConfigManager.prototype = {
routerConfigFile.append('router.config')
let tunnelConfigFile = configDirectory.clone()
tunnelConfigFile.append('i2ptunnel.config')
let susiConfigFile = configDirectory.clone()
susiConfigFile.append('susimail.config')
let snarkConfigFile = configDirectory.clone()
snarkConfigFile.append('i2psnark.config')
let clientsConfigFile = configDirectory.clone()
clientsConfigFile.append('clients.config')
let webappsConfigFile = configDirectory.clone()
webappsConfigFile.append('webapps.config')
let hoststxtFile = configDirectory.clone()
hoststxtFile.append('hosts.txt')
if (!hoststxtFile.exists()) {
let distFile = LauncherUtil.getI2PBinary().parent.parent
distFile.append('hosts.txt')
distFile.copyTo(hoststxtFile.parent, "")
this._logger.log(3, `Copied hosts.txt file`)
}
// Temporary jetty fix
let orgDir = configDirectory.clone()
orgDir.append('org')
if (!orgDir.exists()) {
orgDir.create(orgDir.DIRECTORY_TYPE, 0o700)
orgDir.append('eclipse')
orgDir.create(orgDir.DIRECTORY_TYPE, 0o700)
orgDir.append('jetty')
orgDir.create(orgDir.DIRECTORY_TYPE, 0o700)
orgDir.append('webapp')
orgDir.create(orgDir.DIRECTORY_TYPE, 0o700)
let distJettyFile = LauncherUtil.getI2PBinary().parent.parent
distJettyFile.append('org')
distJettyFile.append('eclipse')
distJettyFile.append('jetty')
distJettyFile.append('webapp')
distJettyFile.append('webdefault.xml')
distJettyFile.copyTo(orgDir, '')
}
// Ensure they exists
const self = this
@ -198,7 +369,7 @@ RouterConfigManager.prototype = {
this.ensureRouterConfigPromise = () => {
return new Promise(resolve => {
if (!routerConfigFile.exists()) {
self._write_router_config(routerConfigFile, file => {
self._write_config(routerConfigFile, defaultRouterConfig, file => {
self.mDoesRouterConfigExists = true
self._logger.log(3, 'Wrote router.config')
if (typeof onCompleteCallback === 'function') onCompleteCallback(file)
@ -215,7 +386,7 @@ RouterConfigManager.prototype = {
this.ensureTunnelConfigPromise = () => {
return new Promise(resolve => {
if (!tunnelConfigFile.exists()) {
self._write_tunnel_config(tunnelConfigFile, tfile => {
self._write_config(tunnelConfigFile, defaultProxyTunnels, tfile => {
self._logger.log(3, 'Wrote i2ptunnel.config')
self.mDoesTunnelConfigExists = true
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
@ -229,10 +400,44 @@ RouterConfigManager.prototype = {
})
}
this.ensureSusiConfigPromise = () => {
return new Promise(resolve => {
if (!susiConfigFile.exists()) {
self._write_config(susiConfigFile, defaultSusiMailConfig, tfile => {
self._logger.log(3, 'Wrote susimail.config')
self.mDoesSusiConfigExists = true
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
resolve(susiConfigFile)
})
} else {
self._logger.log(3, 'Found susimail.config from earlier')
self.mDoesSusiConfigExists = true
resolve(null)
}
})
}
this.ensureSnarkConfigPromise = () => {
return new Promise(resolve => {
if (!snarkConfigFile.exists()) {
self._write_config(snarkConfigFile, defaultSnarkConfig, tfile => {
self._logger.log(3, 'Wrote i2psnark.config')
self.mDoesSnarkConfigExists = true
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
resolve(snarkConfigFile)
})
} else {
self._logger.log(3, 'Found i2psnark.config from earlier')
self.mDoesSnarkConfigExists = true
resolve(null)
}
})
}
this.ensureClientsConfigPromise = () => {
return new Promise(resolve => {
if (!clientsConfigFile.exists()) {
self._write_tunnel_config(tunnelConfigFile, tfile => {
self._write_config(clientsConfigFile, defaultClientsConfig, tfile => {
self._logger.log(3, 'Wrote clients.config')
self.mDoesClientsConfigExists = true
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
@ -246,12 +451,32 @@ RouterConfigManager.prototype = {
})
}
this.ensureWebappsConfigPromise = () => {
return new Promise(resolve => {
if (!webappsConfigFile.exists()) {
self._write_config(webappsConfigFile, defaultWebappsConfig, tfile => {
self._logger.log(3, 'Wrote webapps.config')
self.mDoesWebappsConfigExists = true
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
resolve(webappsConfigFile)
})
} else {
self._logger.log(3, 'Found webapps.config from earlier')
self.mDoesWebappsConfigExists = true
resolve(null)
}
})
}
// Promises are not done but at least done here.
this.mIsChecksDone = true
return Promise.all([
this.ensureRouterConfigPromise(),
this.ensureTunnelConfigPromise(),
this.ensureSusiConfigPromise(),
this.ensureSnarkConfigPromise(),
this.ensureClientsConfigPromise(),
this.ensureWebappsConfigPromise(),
])
},
}

View File

@ -18,7 +18,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm")
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", "resource://gre/modules/FileUtils.jsm")
Cu.import("resource://i2pbutton/modules/default-prefs.js", {}).ensureDefaultPrefs()
let NoScriptControl = Cu.import("resource://i2pbutton/modules/noscript-control.js", {})
// Module specific constants
const kMODULE_NAME = "Startup"
@ -73,13 +72,13 @@ StartupObserver.prototype = {
this._prefs.setIntPref("network.proxy.type", 1);
this._prefs.setIntPref("network.proxy.socks_port", 0);
this._prefs.setCharPref("network.proxy.socks", "");
this._prefs.setIntPref("extensions.i2pbutton.console_port_i2pj", 17657);
this._prefs.setIntPref("extensions.i2pbutton.console_port_i2pj", 7647);
this._prefs.setCharPref("network.proxy.http", "127.0.0.1");
this._prefs.setIntPref("network.proxy.http_port", 14444);
this._prefs.setIntPref("network.proxy.http_port", 7644);
this._prefs.setCharPref("network.proxy.ssl", "127.0.0.1");
this._prefs.setIntPref("network.proxy.ssl_port", 14444);
this._prefs.setIntPref("network.proxy.ssl_port", 7644);
this._prefs.setCharPref("network.proxy.ftp", "127.0.0.1");
this._prefs.setIntPref("network.proxy.ftp_port", 14444);
this._prefs.setIntPref("network.proxy.ftp_port", 7644);
this._prefs.setCharPref("network.proxy.no_proxies_on", "localhost, 127.0.0.1");
// Force prefs to be synced to disk

View File

@ -1,11 +1,11 @@
// debug prefs
pref("extensions.i2pbutton.loglevel", 3); // Loglevel = info would be nice for the beta period.
pref("extensions.i2pbutton.logmethod",1); // 0=stdout, 1=errorconsole, 2=debuglog
pref("extensions.i2pbutton.logmethod", 1); // 0=stdout, 1=errorconsole, 2=debuglog
pref("extensions.i2pbutton@geti2p.net.description", "chrome://i2pbutton/locale/i2pbutton.properties");
pref("extensions.i2pbutton.updateNeeded", false);
pref("app.update.url.details", "https://geti2p.net/en/download/lab")
pref("app.update.url.details", "https://geti2p.net/en/download/lab");
// I2P check and proxy prefs
pref("extensions.i2pbutton.test_enabled",true);
@ -56,9 +56,11 @@ pref("browser.startup.homepage", "chrome://i2pbutton/content/locale/non-localize
pref("extensions.i2pbutton.start_i2p", true);
pref("extensions.i2pbutton.kill_router_on_exit", true);
pref("extensions.i2pbutton.console_host", "127.0.0.1");
pref("extensions.i2pbutton.console_port_i2pj", 17657);
pref("extensions.i2pbutton.console_port_i2pj", 7647);
pref("extensions.i2pbutton.console_port_i2pd", 17070);
pref("extensions.i2pbutton.pop3_port", 7645);
pref("extensions.i2pbutton.smtp_port", 7646);
// I2P Implementation
pref("extensions.i2pbutton.i2pimpl_driver", "i2pj");

View File

@ -6,7 +6,7 @@
<em:name>I2pbutton</em:name>
<em:creator>Meeh, Mikal Villa</em:creator>
<em:id>i2pbutton@geti2p.net</em:id>
<em:version>0.3.2</em:version>
<em:version>0.3.9</em:version>
<em:multiprocessCompatible>true</em:multiprocessCompatible>
<em:homepageURL>https://geti2p.net/en/download/lab</em:homepageURL>
<em:iconURL>chrome://i2pbutton/skin/i2p.png</em:iconURL>

View File

@ -0,0 +1,93 @@
const EXPORTED_SYMBOLS = ['JsonPrcClient']
// vim: set sw=2 sts=2 ts=8 et syntax=javascript:
const Cc = Components.classes
const Ci = Components.interfaces
const Cr = Components.results
const Cu = Components.utils
Cu.import("resource://gre/modules/Services.jsm")
Cu.import("resource://gre/modules/XPCOMUtils.jsm")
Cu.import("resource://gre/modules/Log.jsm")
Cu.import("resource://i2pbutton/modules/http.jsm")
Cu.importGlobalProperties(["XMLHttpRequest"])
var log = Log.repository.getLogger("i2pbutton.jsonrpc-client")
log.level = Log.Level.Debug
// A console appender logs to the browser console.
log.addAppender(new Log.ConsoleAppender(new Log.BasicFormatter()))
class JsonRpcClient {
constructor(url) {
this.serverUrl = url
this.mReqIdSequence = 0
this.responses = new Array()
this.token = ''
}
_createTemplateData(method, params, id) {
this.mReqIdSequence++
return JSON.stringify({
'id': id || this.mReqIdSequence,
'method': method,
'params': params || {},
'jsonrpc': '2.0'
})
}
_onload(method, callback) {
const self = this
return () => {
console.log('done', method)
switch (method) {
case 'Authenticate':
let jData = JSON.parse(self.xhr.response)
let token = jData.result.Token
self.token = token
break
case 'RouterManager':
break
default:
console.log('Unknown method')
}
if('function' === typeof callback) {
callback(self.xhr)
}
self.responses.push(self.xhr.response)
console.log(self.xhr.responseText)
}
}
makeRequest(method, params, callback) {
this.xhr = new XMLHttpRequest()
this.xhr.open('POST', this.serverUrl)
let data = this._createTemplateData(method, params)
this.xhr.onload = this._onload(method, callback)
this.xhr.setRequestHeader('Content-Length', `${data.length}`)
this.xhr.setRequestHeader('Content-Type', 'application/json')
this.xhr.send(data)
}
}
class I2PControlClient extends JsonRpcClient {
constructor() {
super('http://127.0.0.1:7647/jsonrpc/')
}
authenticate(password, callback) {
this.makeRequest('Authenticate', {'API':1, 'Password':password}, callback)
}
shutdownRouter(callback) {
this.makeRequest('RouterManager', {'API':1,'Token':this.token, 'Shutdown': true}, callback)
}
reseedRouter(callback) {
this.makeRequest('RouterManager', {'API':1,'Token':this.token, 'Reseed': true}, callback)
}
restartRouter(callback) {
this.makeRequest('RouterManager', {'API':1,'Token':this.token, 'Restart': true}, callback)
}
}

View File

@ -5,6 +5,8 @@ const Ci = Components.interfaces
const Cu = Components.utils
const Cr = Components.results
Cu.importGlobalProperties(["XMLHttpRequest"])
const kPropBundleURI = "chrome://i2pbutton/locale/i2pbutton.properties"
const kPropNamePrefix = "i2pbutton."
@ -19,6 +21,57 @@ let logger = {
}
}
// ## Environment variables
// __env__.
// Provides access to process environment variables.
let env = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment);
// __getEnv(name)__.
// Reads the environment variable of the given name.
var getEnv = function (name) {
return env.exists(name) ? env.get(name) : undefined;
};
// __getLocale
// Reads the browser locale, the default locale is en-US.
var getLocale = function() {
return Services.locale.requestedLocale || "en-US";
};
const Timer = Components.Constructor("@mozilla.org/timer;1", "nsITimer", "initWithCallback");
function delay(timeout, func) {
let timer = new Timer(function () {
// Remove the reference so that it can be reaped.
delete delay.timers[idx];
func();
}, timeout, Ci.nsITimer.TYPE_ONE_SHOT);
// Store a reference to the timer so that it's not reaped before it fires.
let idx = delay.timers.push(timer) - 1;
return idx
}
delay.timers = []
function repeat(timeout, func) {
let timer = new Timer(function () {
func();
}, timeout, Ci.nsITimer.TYPE_REPEATING_SLACK);
// Store a reference to the timer so that it's not reaped before it fires.
let idx = delay.timers.push(timer) - 1;
return idx
}
repeat.timers = []
// Wrapper since window.setTimeout isn't always available in context/scope.
function setTimeout(func, interval) {
delay(interval, func)
}
const LauncherUtil = {
get isMac()
@ -49,7 +102,7 @@ const LauncherUtil = {
{
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator)
let browserWindow = wm.getMostRecentWindow("navigator:browser")
if (TLUtilInternal._isWindowVisible(browserWindow))
if (LauncherUtilInternal._isWindowVisible(browserWindow))
aParentWindow = browserWindow;
}
@ -83,34 +136,40 @@ const LauncherUtil = {
return argsArray;
},
setTimeout: (func, interval) => {
delay(interval, func)
},
setInterval: (func, interval) => {
repeat(interval, func)
},
get _networkSettingsWindow()
{
var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
return wm.getMostRecentWindow("I2PLauncher:NetworkSettings");
let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator)
return wm.getMostRecentWindow("I2PLauncher:NetworkSettings")
},
_openNetworkSettings: function(aIsInitialBootstrap, aStartAtWizardPanel)
{
var win = this._networkSettingsWindow;
var win = this._networkSettingsWindow
if (win)
{
// Return to "Starting i2p" panel if being asked to open & dlog already exists.
//win.showStartingTorPanel();
win.focus();
//win.showStartingI2PPanel()
win.focus()
return;
}
const kSettingsURL = "chrome://i2pbutton/content/network-settings.xul";
const kWizardURL = "chrome://i2pbutton/content/network-settings-wizard.xul";
const kSettingsURL = "chrome://i2pbutton/chrome/content/i2pstartup-confdlg.xul"
const kWizardURL = "chrome://i2pbutton/chrome/content/i2pstartup-confdlg-wizard.xul"
var wwSvc = Cc["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Ci.nsIWindowWatcher);
var winFeatures = "chrome,dialog=yes,modal,all";
var argsArray = this._createOpenWindowArgsArray(aIsInitialBootstrap,
aStartAtWizardPanel);
let isProgress = (this.kWizardProgressPageID == aStartAtWizardPanel);
let url = (aIsInitialBootstrap || isProgress) ? kWizardURL : kSettingsURL;
wwSvc.openWindow(null, url, "_blank", winFeatures, argsArray);
.getService(Ci.nsIWindowWatcher)
var winFeatures = "chrome,dialog=no,modal,all"
var argsArray = this._createOpenWindowArgsArray(aIsInitialBootstrap,aStartAtWizardPanel)
let isProgress = (this.kWizardProgressPageID == aStartAtWizardPanel)
//let url = (aIsInitialBootstrap || isProgress) ? kWizardURL : kSettingsURL
wwSvc.openWindow(null, kWizardURL, "_blank", winFeatures, argsArray)
},
// Returns true if user confirms; false if not.
@ -145,18 +204,6 @@ const LauncherUtil = {
cleanupTempDirectories: function()
{
try
{
let dirPath = this.getCharPref(TLUtilInternal.kIPCDirPrefName);
this.clearUserPref(TLUtilInternal.kIPCDirPrefName);
if (dirPath)
{
let f = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
f.initWithPath(dirPath);
if (f.exists())
f.remove(false) // Remove directory if it is empty
}
} catch(e) {}
},
restartBrowser: function() {
@ -164,35 +211,65 @@ const LauncherUtil = {
asSvc.quit(0x12) // eAttemptQuit (0x02) + eRestart (0x10)
},
waitForPortToOpen: function(portNum, doneCallback, interval) {
interval = interval || 3000
let portOpen = false
let testPort = () => {
var xhr = new XMLHttpRequest()
xhr.open('GET', `http://127.0.0.1:${portNum}`)
xhr.onerror = () => {
console.log(`Still waiting for ${portNum} to open`)
if (!portOpen) {
setTimeout(testPort, interval)
}
}
xhr.onload = () => {
console.log(`Port ${portNum} seem open now finally`)
portOpen = true
if ('function' === typeof doneCallback) {
doneCallback(portNum)
}
}
xhr.send()
}
testPort()
},
//waitForPortToOpen(7647, () => { console.log('ALL DONE') })
getRouterDefaultArgs: function() {
let dataDir = this.getI2PConfigPath(true)
let exeFile = this.getI2PBinary()
let libDir = dataDir.clone()
let i2pDir = libDir.clone()
let i2pDir = exeFile.parent.parent.clone()
libDir.append('lib')
let args = []
// NOTE: Don't mind spaces as nsIProcess escapes them.
args.push(`-Di2p.dir.base=${i2pDir.path}`)
logger.log(2, `Path for base is => ${i2pDir.path}`)
args.push(`-Duser.dir=${dataDir.path}`) // make PWD equal dataDir
let logFile = dataDir.clone()
logFile.append('wrapper.log')
args.push(`-Dwrapper.logfile=${logFile.path}`)
args.push(`-Djetty.home=${i2pDir.path}`)
args.push(`-Di2p.dir.config=${dataDir.path}`)
args.push(`-Di2p.dir.router=${dataDir.path}`)
args.push(`-Di2p.dir.app=${dataDir.path}`)
let nativeLib = libDir.clone()
nativeLib.append('jbigi.jar')
let clientConfigFile = dataDir.clone()
clientConfigFile.append('clients.config')
let routerCofigFile = dataDir.clone()
routerCofigFile.append('router.config')
logger.log(2, `Path for base is => ${i2pDir.path}`)
// NOTE: Don't mind spaces as nsIProcess escapes them.
args.push(`-Di2p.dir.base=${i2pDir.path}`)
args.push(`-Duser.dir=${dataDir.path}`) // make PWD equal dataDir
args.push(`-Dwrapper.logfile=${logFile.path}`)
args.push(`-Djetty.home=${i2pDir.path}`)
args.push(`-Djava.library.path=${libDir.path}`)
args.push(`-Di2p.dir.config=${dataDir.path}`)
args.push(`-Di2p.dir.router=${dataDir.path}`)
args.push(`-Di2p.dir.app=${dataDir.path}`)
args.push(`-Drouter.clientConfigFile=${clientConfigFile.path}`)
args.push(`-Drouter.configLocation=${routerCofigFile.path}`)
args.push('-Di2p.dir.portableMode=false')
args.push('-Dwrapper.name=i2pbrowser')
args.push('-Dwrapper.displayname=I2PBrowser')
args.push('-cp')
args.push(`${i2pDir.path}:${libDir.path}:${dataDir.path}`)
args.push(`${i2pDir.path}:${nativeLib.path}:${libDir.path}:${dataDir.path}`)
args.push("-Djava.awt.headless=true")
args.push("-Dwrapper.console.loglevel=DEBUG")
// Main class to execute
@ -250,7 +327,7 @@ const LauncherUtil = {
let dataDir = profDir.parent.parent.clone()
dataDir.append('I2P')
if (!dataDir.exists() && create) {
dataDir.create(dataDir.DIRECTORY_TYPE, 0o775)
dataDir.create(dataDir.DIRECTORY_TYPE, 0o700)
}
return dataDir
@ -310,7 +387,7 @@ const LauncherUtil = {
return i2pFile
} else {
logger.log(4, aI2PFileType + " file not found: "+ i2pFile.path)
return ''
return null
}
} catch(e) {
@ -319,22 +396,27 @@ const LauncherUtil = {
}
},
get internal() {
return LauncherUtilInternal
},
get dataDirectoryObject() {
let dataDir = LauncherUtilInternal._dataDir
try { dataDir.normalize() } catch(e) {}
logger.log(3, `Decided to use file ${dataDir.path}`)
return dataDir.clone()
},
get appDirectoryObject() {
return LauncherUtilInternal._appDir.clone()
},
flushLocalizedStringCache: function()
{
LauncherUtilInternal.mStringBundle = undefined
},
// "i2pbutton." is prepended to aStringName.
getLocalizedString: function(aStringName)
{
@ -344,7 +426,7 @@ const LauncherUtil = {
try
{
var key = kPropNamePrefix + aStringName;
return TLUtilInternal._stringBundle.GetStringFromName(key);
return LauncherUtilInternal._stringBundle.GetStringFromName(key);
} catch(e) {}
return aStringName;
@ -359,7 +441,7 @@ const LauncherUtil = {
try
{
var key = kPropNamePrefix + aStringName;
return TLUtilInternal._stringBundle.formatStringFromName(key, aArray, aLen)
return LauncherUtilInternal._stringBundle.formatStringFromName(key, aArray, aLen)
} catch(e) {}
return aStringName;
@ -414,6 +496,7 @@ let LauncherUtilInternal = {
return this.mOS
},
get _stringBundle()
{
if (!this.mStringBundle)

View File

@ -1,164 +0,0 @@
// # NoScript settings control (for binding to Security Slider)
/* jshint esversion:6 */
// ## Utilities
const { utils: Cu } = Components;
const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
const { LegacyExtensionContext } =
Cu.import("resource://gre/modules/LegacyExtensionsUtils.jsm", {});
const { bindPref } =
Cu.import("resource://i2pbutton/modules/utils.js", {});
let logger = Components.classes["@geti2p.net/i2pbutton-logger;1"]
.getService(Components.interfaces.nsISupports).wrappedJSObject;
let log = (level, msg) => logger.log(level, msg);
// ## NoScript settings
// Minimum and maximum capability states as controlled by NoScript.
const max_caps = ["fetch", "font", "frame", "media", "object", "other", "script", "webgl"];
const min_caps = ["frame", "other"];
// Untrusted capabilities for [Standard, Safer, Safest] safety levels.
const untrusted_caps = [
max_caps, // standard safety: neither http nor https
["frame", "font", "object", "other"], // safer: http
min_caps, // safest: neither http nor https
];
// Default capabilities for [Standard, Safer, Safest] safety levels.
const default_caps = [
max_caps, // standard: both http and https
["fetch", "font", "frame", "object", "other", "script"], // safer: https only
min_caps, // safest: both http and https
];
// __noscriptSettings(safetyLevel)__.
// Produces NoScript settings with policy according to
// the safetyLevel which can be:
// 0 = Standard, 1 = Safer, 2 = Safest
//
// At the "Standard" safety level, we leave all sites at
// default with maximal capabilities. Essentially no content
// is blocked.
//
// At "Safer", we set all http sites to untrusted,
// and all https sites to default. Scripts are only permitted
// on https sites. Neither type of site is supposed to allow
// media, but both allow fonts (as we used in legacy NoScript).
//
// At "Safest", all sites are at default with minimal
// capabilities. Most things are blocked.
let noscriptSettings = safetyLevel => (
{
"__meta": {
"name": "updateSettings",
"recipientInfo": null
},
"policy": {
"DEFAULT": {
"capabilities": default_caps[safetyLevel],
"temp": false
},
"TRUSTED": {
"capabilities": max_caps,
"temp": false
},
"UNTRUSTED": {
"capabilities": untrusted_caps[safetyLevel],
"temp": false
},
"sites": {
"trusted": [],
"untrusted": [[], ["http:"], []][safetyLevel],
"custom": {},
"temp": []
},
"enforced": true,
"autoAllowTop": false
},
"isI2PBrowser": true,
"tabId": -1
});
// ## Communications
// The extension ID for NoScript (WebExtension)
const noscriptID = "{73a6fe31-595d-460b-a920-fcc0f8843232}";
// Ensure binding only occurs once.
let initialized = false;
// __initialize()__.
// The main function that binds the NoScript settings to the security
// slider pref state.
var initialize = () => {
if (initialized) {
return;
}
initialized = true;
try {
// A mock extension object that can communicate with another extension
// via the WebExtensions sendMessage/onMessage mechanism.
let extensionContext = new LegacyExtensionContext({ id : noscriptID });
// The component that handles WebExtensions' sendMessage.
let messageManager = extensionContext.messenger.messageManagers[0];
// __setNoScriptSettings(settings)__.
// NoScript listens for internal settings with onMessage. We can send
// a new settings JSON object according to NoScript's
// protocol and these are accepted! See the use of
// `browser.runtime.onMessage.addListener(...)` in NoScript's bg/main.js.
let sendNoScriptSettings = settings =>
extensionContext.messenger.sendMessage(messageManager, settings, noscriptID);
// __setNoScriptSafetyLevel(safetyLevel)__.
// Set NoScript settings according to a particular safety level
// (security slider level): 0 = Standard, 1 = Safer, 2 = Safest
let setNoScriptSafetyLevel = safetyLevel =>
sendNoScriptSettings(noscriptSettings(safetyLevel));
// __securitySliderToSafetyLevel(sliderState)__.
// Converts the "extensions.i2pbutton.security_slider" pref value
// to a "safety level" value: 0 = Standard, 1 = Safer, 2 = Safest
let securitySliderToSafetyLevel = sliderState =>
[undefined, 2, 1, 1, 0][sliderState];
// Wait for the first message from NoScript to arrive, and then
// bind the security_slider pref to the NoScript settings.
let messageListener = (a,b,c) => {
try {
log(3, `Message received from NoScript: ${JSON.stringify([a,b,c])}`);
if (!["started", "pageshow"].includes(a.__meta.name)) {
return;
}
extensionContext.api.browser.runtime.onMessage.removeListener(messageListener);
let noscriptPersist = Services.prefs.getBoolPref("extensions.i2pbutton.noscript_persist", false);
let noscriptInited = Services.prefs.getBoolPref("extensions.i2pbutton.noscript_inited", false);
// Set the noscript safety level once if we have never run noscript
// before, or if we are not allowing noscript per-site settings to be
// persisted between browser sessions. Otherwise make sure that the
// security slider position, if changed, will rewrite the noscript
// settings.
bindPref("extensions.i2pbutton.security_slider",
sliderState => setNoScriptSafetyLevel(securitySliderToSafetyLevel(sliderState)),
!noscriptPersist || !noscriptInited);
if (!noscriptInited) {
Services.prefs.setBoolPref("extensions.i2pbutton.noscript_inited", true);
}
} catch (e) {
log(5, e.message);
}
};
extensionContext.api.browser.runtime.onMessage.addListener(messageListener);
log(3, "Listening for message from NoScript.");
} catch (e) {
log(5, e.message);
}
};
// Export initialize() function for external use.
let EXPORTED_SYMBOLS = ["initialize"];

View File

@ -1,5 +1,5 @@
// ### Shortcut
const { Cu: utils, Cr: results } = Components
let {classes: Cc, utils: Cu } = Components;
// ### Import Mozilla Services
Cu.import("resource://gre/modules/Services.jsm")
@ -77,7 +77,7 @@ const getProfileDir = function() {
getService(Ci.nsIProperties)
// this is a reference to the profile dir (ProfD) now.
let localDir = directoryService.get("ProfD", Ci.nsIFile)
return localDir.path
return localDir
}
function openFile(path, mode) {
@ -112,6 +112,22 @@ function array_to_hexdigits(array) {
}).join('');
}
function listExtensions(callbackFn) {
AddonManager.getAddonsByTypes(["extension"], function(addons) {
var addonData = [];
for (let i in addons) {
let cur = addons[i];
addonData.push({
id: cur.id.toString(),
name: cur.name,
});
};
console.log(JSON.stringify(addonData, null, ' '));
callbackFn(addonData)
});
}
//window.open("chrome://browser/content/browser.xul", "bmarks", "chrome,width=600,height=300")
// __prefs__. A shortcut to Mozilla Services.prefs.
@ -135,10 +151,10 @@ var getPrefValue = function (prefName) {
var bindPref = function (prefName, prefHandler, init = false) {
let update = () => { prefHandler(getPrefValue(prefName)); },
observer = { observe : function (subject, topic, data) {
if (data === prefName) {
update();
}
} };
if (data === prefName) {
update();
}
} };
prefs.addObserver(prefName, observer, false);
if (init) {
update();
@ -187,7 +203,7 @@ var getEnv = function (name) {
// __getLocale
// Reads the browser locale, the default locale is en-US.
var getLocale = function() {
return Services.locale.getRequestedLocale() || "en-US";
return "en-US";
}
// ## Windows
@ -200,14 +216,14 @@ let dialogsByName = {};
// Like window.openDialog, but if the window is already
// open, just focuses it instead of opening a new one.
var showDialog = function (parent, url, name, features) {
let existingDialog = dialogsByName[name];
let existingDialog = dialogsByName[name]
if (existingDialog && !existingDialog.closed) {
existingDialog.focus();
return existingDialog;
existingDialog.focus()
return existingDialog
} else {
let newDialog = parent.openDialog.apply(parent, Array.slice(arguments, 1));
dialogsByName[name] = newDialog;
return newDialog;
let newDialog = parent.openDialog.apply(parent, Array.slice(arguments, 1))
dialogsByName[name] = newDialog
return newDialog
}
}