26 Commits
0.3 ... 0.3.2

Author SHA1 Message Date
6fa1736321 version bump 2019-09-09 01:05:14 +02:00
890438ffe9 Fixed a issue with launching router on osx 2019-09-09 01:04:56 +02:00
ebf6f2577a Use self to avoid error 2019-09-09 00:48:19 +02:00
d3b043fc23 version bump 2019-09-07 23:04:12 +02:00
a9e70d19a7 small cleanup 2019-09-07 23:03:55 +02:00
4e6117faf9 Merge pull request #1 from eyedeekay/master
Update about:i2p and browser onboarding text
2019-09-07 22:26:22 +02:00
idk
015e20c06a put the rest of the URLs into the dtd 2019-09-05 16:42:55 -04:00
idk
96ad84bf2c make it so links to the project site can honor localizations 2019-09-05 16:33:48 -04:00
idk
45b13ef209 more straightforward language on intro page 2019-09-05 14:16:21 -04:00
idk
fbf7ced2c7 more straightforward language on intro page 2019-09-05 14:04:06 -04:00
idk
d2403362ba ucomment the un-used slides 2019-09-05 13:55:18 -04:00
idk
fe23ea2047 update onboarding content without adding or removing slides. The order makes sense now. 2019-09-05 13:49:43 -04:00
5b01b19688 Improvements to config manager + run checks for config files and write them before executing the router subprocess 2019-09-05 01:24:36 +02:00
7664b3530d Misc 2019-09-04 22:37:13 +02:00
87faaa3e74 Misc cleanup + change of default ports to not crash with already existing i2p install 2019-09-04 22:22:10 +02:00
e66bc441d3 Use already set preference 2019-09-04 22:00:39 +02:00
13eaf1f035 Cleanup + added i2p console port to preferences 2019-09-04 21:57:56 +02:00
8106f114ca Cleanup + made firefox spawn i2p on linux 2019-09-04 21:35:51 +02:00
idk
e796ce750f update about:i2p text and onboarding text 2019-09-04 15:02:36 -04:00
idk
7301cbd7ba Merge branch 'master' of https://github.com/mikalv/i2pbutton 2019-09-04 14:44:39 -04:00
3bb805b40c Windows will now run i2p 2019-09-04 19:31:04 +02:00
4a880b973d More fixes 2019-09-03 18:48:30 +02:00
60c455b6af Make paths resolve correctly on windows and linux 2019-09-03 16:50:26 +02:00
idk
721a3b9242 update the content on the about:i2p page 2019-08-28 18:47:39 -04:00
idk
1886a5ffc9 update the content on the about:i2p page 2019-08-28 16:52:29 -04:00
idk
40d97cd420 update the content on the about:i2p page 2019-08-28 16:25:06 -04:00
14 changed files with 269 additions and 197 deletions

View File

@ -38,20 +38,28 @@ window.addEventListener("pageshow", function() {
&aboutI2p.browser_name; ( &aboutI2p.browser_short_name; ) &aboutI2p.browser_description;
<h3>&aboutI2p.links;</h3>
<p>
&aboutI2p.source;: <a href="https://github.com/mikalv/test-i2p-browser/tree/i2p-browser-60.7.0esr-9.0-1-build3">https://github.com/mikalv/test-i2p-browser/tree/i2p-browser-60.7.0esr-9.0-1-build3</a><br />
&aboutI2p.bug_tracker;: <a href="https://trac.i2p2.de/">https://trac.i2p2.de/</a><br />
&aboutI2p.build_scripts;: <a href="https://github.com/mikalv/i2p-browser-build-scripts">https://github.com/mikalv/i2p-browser-build-scripts</a><br />
&aboutI2p.i2pbutton_source;: <a href="https://github.com/mikalv/i2pbutton">https://github.com/mikalv/i2pbutton</a><br />
<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>
</ul>
</p>
&aboutI2p.warn_experimental;
</p>
<p>
&aboutI2p.refresh_text; <a href="about:i2p">&aboutI2p.refresh_link;</a>
</p>
<p class="hideIfI2POn">&aboutI2p.warn_not_running;</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">&aboutI2p.console_visit_msg; <a href="http://127.0.0.1:7657">&aboutI2p.console;</a></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>
</div>

View File

@ -20,9 +20,9 @@ var m_ib_confirming_plugins = false
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
function checkI2P(callback,proxyCallback) {
let checkSvc = Cc["@geti2p.net/i2pbutton-i2pCheckService;1"].getService(Ci.nsISupports).wrappedJSObject;
let req = checkSvc.createCheckConsoleRequest(true);
req.onreadystatechange = function(event) {
if (req.readyState === 4) {
@ -47,13 +47,11 @@ function checkI2P(callback,proxyCallback) {
function i2pbutton_i2p_check_ok()
{
let checkSvc = Cc["@geti2p.net/i2pbutton-i2pCheckService;1"].getService(Ci.nsISupports).wrappedJSObject
// 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()
{
let checkSvc = Cc["@geti2p.net/i2pbutton-i2pCheckService;1"].getService(Ci.nsISupports).wrappedJSObject
// 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)
}

View File

@ -5,21 +5,32 @@
<!ENTITY aboutI2p.browser_name "The Invisible Internet Browser">
<!ENTITY aboutI2p.browser_short_name "I2P Browser">
<!ENTITY aboutI2p.browser_description "is preconfigured to search for content on the I2P network. In this release, I2P Browser does not launch its own router and is dependent on having the I2P router pre installed and running. The I2P Browser is preconfigured with default router settings.">
<!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.donate "Donate">
<!ENTITY aboutI2p.supportus "Support I2P development">
<!ENTITY aboutI2p.warn_not_running "It currently seems like your router is NOT running :( However, if you just started the router, please try again in two minutes cause it need time to start.">
<!ENTITY aboutI2p.warn_not_running "It currently seems like your router is NOT running :(">
<!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.warn_experimental "This is a experimental sub-project of I2P.">
<!ENTITY aboutI2p.console_visit_msg "It seems like your console is up, click the to visit:">
<!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.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">
<!ENTITY aboutI2p.source "Source">
<!ENTITY aboutI2p.bug_tracker "Bugtracker">
<!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.refresh_text "Click the link to refresh the page (In case the router is starting up):">
<!ENTITY aboutI2p.design "Design Document">
<!ENTITY aboutI2p.refresh_text "Try refreshing the page.">
<!ENTITY aboutI2p.refresh_link "Refresh">
<!ENTITY aboutI2p.getInvolved.label "Get Involved »">
<!ENTITY aboutI2p.getInvolved.link "https://geti2p.net/en/get-involved">
<!ENTITY aboutI2p.site "http://i2p-projekt.i2p/en">
<!ENTITY aboutI2p.routerconsole "http://localhost:7657">
<!ENTITY aboutI2p.github "https://github.com/mikalv">
<!ENTITY aboutI2p.trac "http://trac.i2p2.i2p">

View File

@ -1,44 +1,53 @@
# vim: set sw=2 sts=2 ts=8 et:
onboarding.tour-i2p-welcome=Welcome
onboarding.tour-i2p-welcome.title=Youre ready.
onboarding.tour-i2p-welcome.description=I2P Browser offers the highest standard of privacy and security while browsing the web. Youre now protected against tracking, surveillance, and censorship. This quick onboarding will show you how.
onboarding.tour-i2p-welcome.title=Welcome to I2P Browser
onboarding.tour-i2p-welcome.description=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.
# onboarding.tour-i2p-welcome.description-suffix=I2P Browser isolates cookies and deletes your browser history after your session. These modifications ensure your privacy and security are protected in the browser.
onboarding.tour-i2p-welcome.next-button=Go to Privacy
onboarding.tour-i2p-privacy=Privacy
onboarding.tour-i2p-privacy.title=Snub trackers and snoopers.
onboarding.tour-i2p-privacy.description=I2P Browser isolates cookies and deletes your browser history after your session. These modifications ensure your privacy and security are protected in the browser. Click I2P Network to learn how we protect you on the network level.
onboarding.tour-i2p-privacy.button=Go to I2P Network
onboarding.tour-i2p-privacy.title=Stay in control of your Data
onboarding.tour-i2p-privacy.description=I2P Browser isolates cookies and deletes your browser history after your session. These modifications ensure your privacy and security are protected in the browser.
onboarding.tour-i2p-privacy.button=Go to Security and Experience
onboarding.tour-i2p-network=I2P Network
# This slide is not currently use in the I2P Browser Onboarding slideshow
#onboarding.tour-i2p-network=I2P Network
onboarding.tour-i2p-network.title=Travel a decentralized network.
onboarding.tour-i2p-network.description=I2P Browser connects you to the I2P network run by thousands of volunteers around the world. Unlike a VPN, theres no one point of failure or centralized entity you need to trust in order to enjoy the internet privately.
onboarding.tour-i2p-network.button=Go to Tunnel Display
# End
# This slide is not currently use in the I2P Browser Onboarding slideshow
onboarding.tour-i2p-circuit-display=Tunnel Display
onboarding.tour-i2p-circuit-display.title=See your path.
onboarding.tour-i2p-circuit-display.description=For each domain you visit, your traffic is relayed and encrypted in a tunnel across three I2P routers around the world. Currently displaying this information is still under development.
onboarding.tour-i2p-circuit-display.button=Sorry, come back later.
onboarding.tour-i2p-circuit-display.next-button=Go to Security
# end
onboarding.tour-i2p-security=Security
onboarding.tour-i2p-security=Security and Experience
onboarding.tour-i2p-security.title=Choose your experience.
onboarding.tour-i2p-security.description=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.
onboarding.tour-i2p-security.description-suffix=Note: By default, NoScript and HTTPS Everywhere are not included on the toolbar, but you can customize your toolbar to add them.
onboarding.tour-i2p-security.description=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.\n Note: By default, NoScript and HTTPS Everywhere are not included on the toolbar, but you can customize your toolbar to add them.
onboarding.tour-i2p-security.description-suffix=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.
onboarding.tour-i2p-security-level.button=See Your Security Level
onboarding.tour-i2p-security-level.next-button=Go to Experience Tips
onboarding.tour-i2p-expect-differences=Experience Tips
onboarding.tour-i2p-expect-differences.title=Expect some differences.
onboarding.tour-i2p-expect-differences.description=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.
onboarding.tour-i2p-expect-differences.button=See FAQs
onboarding.tour-i2p-expect-differences.next-button=Go to Hidden Services
onboarding.tour-i2p-expect-differences.button=Done
# onboarding.tour-i2p-expect-differences.button=See FAQs
onboarding.tour-i2p-expect-differences.next-button=Done
# onboarding.tour-i2p-expect-differences.next-button=Go to Hidden Services
onboarding.tour-i2p-onion-services=Hidden Services
onboarding.tour-i2p-onion-services.title=Be extra protected.
onboarding.tour-i2p-onion-services.description=Hidden services are sites that end with a .i2p that provide extra protections to publishers and visitors, including added safeguards against censorship. Onion services allow anyone to provide content and services anonymously.
onboarding.tour-i2p-onion-services.button=Visit an Hidden
onboarding.tour-i2p-onion-services.next-button=Done
# This slide is not currently use in the I2P Browser Onboarding slideshow
#onboarding.tour-i2p-onion-services=Hidden Services
#onboarding.tour-i2p-onion-services.title=Be extra protected.
#onboarding.tour-i2p-onion-services.description=Hidden services are sites that end with a .i2p that provide extra protections to publishers and visitors, including added safeguards against censorship. Onion services allow anyone to provide content and services anonymously.
#onboarding.tour-i2p-onion-services.button=Visit an Hidden
#onboarding.tour-i2p-onion-services.next-button=Done
# End
onboarding.overlay-icon-tooltip-updated2=See what's new\nin %S
onboarding.tour-i2p-update.prefix-new=New

View File

@ -72,3 +72,6 @@ body:not([i2pconsoleon]) .hideIfI2PConsoleOff {
display: none;
}
ul {
margin-left: 2rem;
}

View File

@ -12,8 +12,8 @@ function IBI2PCheckService() {
this._logger = Cc["@geti2p.net/i2pbutton-logger;1"].getService(Ci.nsISupports).wrappedJSObject
this._logger.info("I2pbutton I2P Check Service initialized")
this._statusOfI2PCheck = this.kCheckNotInitiated;
this.wrappedJSObject = this;
this._statusOfI2PCheck = this.kCheckNotInitiated
this.wrappedJSObject = this
}
IBI2PCheckService.prototype =
@ -88,25 +88,27 @@ IBI2PCheckService.prototype =
},
_createRequest: function(url, aAsync, mimetype) {
Cu.importGlobalProperties(["XMLHttpRequest"]);
let req = new XMLHttpRequest();
req.open('GET', url, aAsync);
req.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
req.overrideMimeType(mimetype);
req.timeout = 120000; // Wait at most two minutes for a response.
return req;
Cu.importGlobalProperties(["XMLHttpRequest"])
let req = new XMLHttpRequest()
req.open('GET', url, aAsync)
req.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE
req.overrideMimeType(mimetype)
req.timeout = 120000 // Wait at most two minutes for a response.
return req
},
createCheckConsoleRequest: function(aAsync)
{
let url = 'http://localhost:7657/netdb?r=.';
return this._createRequest(url, aAsync, "text/html");
let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch)
let port = prefs.getIntPref("extensions.i2pbutton.console_port_i2pj", 17657)
let url = `http://localhost:${port}/netdb?r=.`
return this._createRequest(url, aAsync, "text/html")
},
createCheckProxyRequest: function(aAsync) {
let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
let url = prefs.getCharPref("extensions.i2pbutton.test_url");
return this._createRequest(url, aAsync, "application/json");
let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch)
let url = prefs.getCharPref("extensions.i2pbutton.test_url")
return this._createRequest(url, aAsync, "application/json")
},
parseCheckConsoleResponse: function(aReq)
@ -181,5 +183,5 @@ IBI2PCheckService.prototype =
}
};
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
var NSGetFactory = XPCOMUtils.generateNSGetFactory([IBI2PCheckService]);
Cu.import("resource://gre/modules/XPCOMUtils.jsm")
var NSGetFactory = XPCOMUtils.generateNSGetFactory([IBI2PCheckService])

View File

@ -10,13 +10,13 @@ try { Cu.import("resource://gre/modules/ctypes.jsm") } catch(e) {}
Cu.import("resource://gre/modules/XPCOMUtils.jsm")
XPCOMUtils.defineLazyModuleGetter(this, "LauncherUtil", "resource://i2pbutton/modules/launcher-util.jsm")
//XPCOMUtils.defineLazyModuleGetter(this, "I2PLauncherLogger", "resource://i2pbutton/modules/tl-logger.jsm")
//let observerService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService)
function I2PProcessService()
{
this._logger = Cc["@geti2p.net/i2pbutton-logger;1"].getService(Ci.nsISupports).wrappedJSObject
this._config_checker = Cc["@geti2p.net/i2pbutton-router-config-mgr;1"].getService(Ci.nsISupports).wrappedJSObject
this._logger.log(3, "I2pbutton I2P Router Process Service initialized")
this.wrappedJSObject = this
}
@ -34,7 +34,7 @@ I2PProcessService.prototype =
kInitialControlConnDelayMS: 25,
kMaxControlConnRetryMS: 2000, // Retry at least every 2 seconds.
kControlConnTimeoutMS: 5*60*1000, // Wait at most 5 minutes for tor to start.
kControlConnTimeoutMS: 5*60*1000, // Wait at most 5 minutes for i2p to start.
kStatusUnknown: 0, // I2P process status.
kStatusStarting: 1,
@ -94,12 +94,15 @@ I2PProcessService.prototype =
const self = this
this._logger.log(3, 'Checking if a console is already up (an router already running)s')
this._logger.log(3, 'Checking if a console is already up (an router already running)')
this._isConsoleRunning(function(res) {
if (res!=4) {
// Yes, 4 is success
self._logger.log(3, 'Starting the router')
self.I2PStartAndControlI2P(true)
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.')
}
@ -274,7 +277,7 @@ I2PProcessService.prototype =
// construct paths to files that will be inside it.
let dataDir = LauncherUtil.getI2PConfigPath(true)
let exeFile = LauncherUtil.getI2PFile("i2p", false)
this._logger.log(3, `Datadir: ${dataDir.path} ,,, ExeFile: ${exeFile.path}`)
this._logger.log(3, `Datadir => ${dataDir.path}\nExeFile => ${exeFile.path}`)
var detailsKey;
if (!exeFile)
@ -314,28 +317,32 @@ I2PProcessService.prototype =
this._logger.log(3, `Trying to start with ${args}`)
this._logger.log(2, "Starting " + exeFile.path)
var p = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess)
p.init(exeFile)
this._logger.log(2, "Starting " + exeFile.path)
for (var i = 0; i < args.length; ++i)
this._logger.log(2, " " + args[i])
// Possible fix for Windows and cmd.exe window spawn.
p.startHidden = true
p.noShell = true
p.runwAsync(args, args.length, this, false)
this.mI2PProcess = p
this.mI2PProcessStartTime = Date.now()
}
catch (e)
{
this.mI2PProcessStatus = this.kStatusExited;
this.mI2PProcessStatus = this.kStatusExited
//var s = LauncherUtil.getLocalizedString("i2p_failed_to_start");
//this._notifyUserOfError(s, null, this.kI2PProcessDidNotStartTopic);
this._logger.log(4, "_startI2P error: ", e);
this._logger.log(4, "_startI2P error: ", e)
}
}, // _startI2P()
_isConsoleRunning: function(callback) {
let checkSvc = Cc["@geti2p.net/i2pbutton-i2pCheckService;1"].getService(Ci.nsISupports).wrappedJSObject;
let checkSvc = Cc["@geti2p.net/i2pbutton-i2pCheckService;1"].getService(Ci.nsISupports).wrappedJSObject
let req = checkSvc.createCheckConsoleRequest(true);
req.onreadystatechange = function(event) {
if (req.readyState === 4) {

View File

@ -1,26 +1,18 @@
// Bug 1506 P1: This is just a handy logger. If you have a better one, toss
// this in the trash.
/*************************************************************************
* TBLogger (JavaScript XPCOM component)
*
* Allows loglevel-based logging to different logging mechanisms.
*
*************************************************************************/
// TODO: Slowly migrate to firefox's Log module "resource://gre/modules/Log.jsm"
// Module specific constants
const kMODULE_NAME = "I2pbutton Logger";
const kMODULE_CONTRACTID = "@geti2p.net/i2pbutton-logger;1";
const kMODULE_CID = Components.ID("f36d72c9-9718-4134-b550-e109638331d7");
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 Cr = Components.results
const Cc = Components.classes
const Ci = Components.interfaces
const Cu = Components.utils
Cu.import("resource://i2pbutton/modules/default-prefs.js", {}).ensureDefaultPrefs();
Cu.import("resource://i2pbutton/modules/default-prefs.js", {}).ensureDefaultPrefs()
Cu.import("resource://gre/modules/Services.jsm")
Cu.import("resource://gre/modules/Services.jsm");
let console = (Cu.import("resource://gre/modules/Console.jsm", {})).console
function I2pbuttonLogger() {
// Register observer

View File

@ -16,18 +16,19 @@ const nsFile = Components.Constructor(
"initWithPath"
)
Cu.import("resource://gre/modules/XPCOMUtils.jsm")
//XPCOMUtils.defineLazyModuleGetter(this, "LauncherUtil", "resource://i2pbutton/modules/launcher-util.jsm")
Cu.import("resource://i2pbutton/modules/launcher-util.jsm")
//ChromeUtils.defineModuleGetter(this, "ZipUtils", "resource://gre/modules/ZipUtils.jsm")
Cu.import("resource://gre/modules/Services.jsm")
Cu.import('resource://gre/modules/osfile.jsm')
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)
const defaultProxyTunnels = `# Autogenerated by I2P Browser
tunnel.0.description=HTTP proxy for browsing eepsites and the web
tunnel.0.interface=127.0.0.1
tunnel.0.listenPort=4444
tunnel.0.listenPort=${httpProxyPort}
tunnel.0.name=I2P HTTP Proxy
tunnel.0.option.i2cp.closeIdleTime=1800000
tunnel.0.option.i2cp.closeOnIdle=false
@ -67,7 +68,7 @@ tunnel.0.type=httpclient
`
const defaultClientsConfig = `# Autogenerated by I2P Browser
clientApp.0.args=7657 ::1,127.0.0.1 ./webapps/
clientApp.0.args=${consolePort} ::1,127.0.0.1 ./webapps/
clientApp.0.main=net.i2p.router.web.RouterConsoleRunner
clientApp.0.name=I2P Router Console
clientApp.0.onBoot=true
@ -129,7 +130,6 @@ router.sharePercentage=50
function RouterConfigManager() {
this.version = '0.1'
this.routerCertsZipFile = LauncherUtil.getI2PFile("certszip", false)
this._logger = Cc["@geti2p.net/i2pbutton-logger;1"].getService(Ci.nsISupports).wrappedJSObject
this._logger.log(3, "I2pbutton I2P RouterConfigManager Service initialized")
this.wrappedJSObject = this
@ -145,9 +145,20 @@ RouterConfigManager.prototype = {
_logger: null,
state: {},
// State
mDoesRouterConfigExists: false,
mDoesClientsConfigExists: false,
mDoesTunnelConfigExists: false,
mHasChecksStarted: false,
mIsChecksDone: false,
// nsISupports implementation.
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports]),
canRouterStart: function() {
return (this.mDoesRouterConfigExists && this.mDoesClientsConfigExists && this.mDoesTunnelConfigExists)
},
_write_router_config: function(configfile,onComplete) {
@ -170,31 +181,78 @@ RouterConfigManager.prototype = {
},
ensure_config: function(onCompleteCallback) {
ensure_config: async function(onCompleteCallback) {
this.mHasChecksStarted = true
let configDirectory = LauncherUtil.getI2PConfigPath(true)
let routerConfigFile = configDirectory.clone()
routerConfigFile.append('router.config')
let tunnelConfigFIle = configDirectory.clone()
tunnelConfigFIle.append('i2ptunnel.config')
let clientsConfigFIle = configDirectory.clone()
clientsConfigFIle.append('clients.config')
let tunnelConfigFile = configDirectory.clone()
tunnelConfigFile.append('i2ptunnel.config')
let clientsConfigFile = configDirectory.clone()
clientsConfigFile.append('clients.config')
// Ensure they exists
if (!routerConfigFile.exists) {
this._write_router_config(routerConfigFile, file => {
if (typeof onCompleteCallback === 'function') onCompleteCallback(file)
const self = this
this.ensureRouterConfigPromise = () => {
return new Promise(resolve => {
if (!routerConfigFile.exists()) {
self._write_router_config(routerConfigFile, file => {
self.mDoesRouterConfigExists = true
self._logger.log(3, 'Wrote router.config')
if (typeof onCompleteCallback === 'function') onCompleteCallback(file)
resolve(routerConfigFile)
})
} else {
self._logger.log(3, 'Found router.config from earlier')
self.mDoesRouterConfigExists = true
resolve(null)
}
})
}
if (!tunnelConfigFIle.exits) {
this._write_tunnel_config(tunnelConfigFIle, tfile => {
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
this.ensureTunnelConfigPromise = () => {
return new Promise(resolve => {
if (!tunnelConfigFile.exists()) {
self._write_tunnel_config(tunnelConfigFile, tfile => {
self._logger.log(3, 'Wrote i2ptunnel.config')
self.mDoesTunnelConfigExists = true
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
resolve(tunnelConfigFile)
})
} else {
self._logger.log(3, 'Found i2ptunnel.config from earlier')
self.mDoesTunnelConfigExists = true
resolve(null)
}
})
}
if (!clientsConfigFIle.exits) {
this._write_tunnel_config(tunnelConfigFIle, tfile => {
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
this.ensureClientsConfigPromise = () => {
return new Promise(resolve => {
if (!clientsConfigFile.exists()) {
self._write_tunnel_config(tunnelConfigFile, tfile => {
self._logger.log(3, 'Wrote clients.config')
self.mDoesClientsConfigExists = true
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
resolve(clientsConfigFile)
})
} else {
self._logger.log(3, 'Found clients.config from earlier')
self.mDoesClientsConfigExists = true
resolve(null)
}
})
}
// Promises are not done but at least done here.
this.mIsChecksDone = true
return Promise.all([
this.ensureRouterConfigPromise(),
this.ensureTunnelConfigPromise(),
this.ensureClientsConfigPromise(),
])
},
}

View File

@ -8,34 +8,34 @@
*
*************************************************************************/
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
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")
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", "resource://gre/modules/FileUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", "resource://gre/modules/FileUtils.jsm")
Cu.import("resource://i2pbutton/modules/default-prefs.js", {}).ensureDefaultPrefs();
//let NoScriptControl = Cu.import("resource://torbutton/modules/noscript-control.js", {});
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";
const kMODULE_CONTRACTID = "@geti2p.net/startup-observer;1";
const kMODULE_CID = Components.ID("06322def-6fde-4c06-aef6-47ae8e799629");
const kMODULE_NAME = "Startup"
const kMODULE_CONTRACTID = "@geti2p.net/startup-observer;1"
const kMODULE_CID = Components.ID("06322def-6fde-4c06-aef6-47ae8e799629")
function StartupObserver() {
this.logger = Cc["@geti2p.net/i2pbutton-logger;1"].getService(Ci.nsISupports).wrappedJSObject;
this._prefs = Services.prefs;
this.logger.log(3, "Startup Observer created");
this.logger = Cc["@geti2p.net/i2pbutton-logger;1"].getService(Ci.nsISupports).wrappedJSObject
this._prefs = Services.prefs
this.logger.log(3, "Startup Observer created")
var env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
var prefName = "browser.startup.homepage";
var env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment)
var prefName = "browser.startup.homepage"
if (env.exists("I2P_DEFAULT_HOMEPAGE")) {
// if the user has set this value in a previous installation, don't override it
if (!this._prefs.prefHasUserValue(prefName)) {
this._prefs.setCharPref(prefName, env.get("I2P_DEFAULT_HOMEPAGE"));
this._prefs.setCharPref(prefName, env.get("I2P_DEFAULT_HOMEPAGE"))
}
}
@ -48,20 +48,16 @@ function StartupObserver() {
}
try {
// XXX: We're in a race with HTTPS-Everywhere to update our proxy settings
// before the initial SSL-Observatory test... If we lose the race, Firefox
// caches the old proxy settings for check.tp.o somehwere, and it never loads :(
this.setProxySettings();
} catch(e) {
this.logger.log(4, "Early proxy change failed. Will try again at profile load. Error: "+e);
}
// Arrange for our about:tor handler to be loaded in the default (chrome)
// Arrange for our about:i2p handler to be loaded in the default (chrome)
// process as well as in each content process.
let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"]
.getService(Ci.nsIProcessScriptLoader);
ppmm.loadProcessScript("resource://i2pbutton/components/aboutI2p.js",
true);
ppmm.loadProcessScript("resource://i2pbutton/components/aboutI2p.js", true)
}
StartupObserver.prototype = {
@ -77,12 +73,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.setCharPref("network.proxy.http", "127.0.0.1");
this._prefs.setIntPref("network.proxy.http_port", 4444);
this._prefs.setIntPref("network.proxy.http_port", 14444);
this._prefs.setCharPref("network.proxy.ssl", "127.0.0.1");
this._prefs.setIntPref("network.proxy.ssl_port", 4445);
this._prefs.setIntPref("network.proxy.ssl_port", 14444);
this._prefs.setCharPref("network.proxy.ftp", "127.0.0.1");
this._prefs.setIntPref("network.proxy.ftp_port", 4444);
this._prefs.setIntPref("network.proxy.ftp_port", 14444);
this._prefs.setCharPref("network.proxy.no_proxies_on", "localhost, 127.0.0.1");
// Force prefs to be synced to disk
@ -97,8 +94,8 @@ StartupObserver.prototype = {
// but only for hackish reasons.
this._prefs.setBoolPref("extensions.i2pbutton.startup", true);
// We need to listen for NoScript before it starts.
//NoScriptControl.initialize();
// We need to listen for NoScript before it starts.
NoScriptControl.initialize();
this.setProxySettings();
}

View File

@ -16,6 +16,10 @@ pref("extensions.i2pbutton.local_i2p_check",true);
// https://developer.mozilla.org/en/Addons/Working_with_AMO
pref("extensions.i2pbutton@geti2p.net.getAddons.cache.enabled", false);
// I2P router control prefs:
pref("extensions.i2pbutton.start_i2p", true);
pref("extensions.i2pbutton.kill_router_on_exit", true);
// State prefs:
pref("extensions.i2pbutton.startup",false);
pref("extensions.i2pbutton.inserted_button",false);
@ -27,9 +31,9 @@ pref("extensions.i2pbutton.cookie_auto_protect",false);
pref("extensions.i2pbutton.clear_http_auth",true);
pref("extensions.i2pbutton.close_newnym",true);
pref("extensions.i2pbutton.resize_new_windows",true);
pref("extensions.i2pbutton.startup_state", 2); // 0=non-tor, 1=tor, 2=last
pref("extensions.i2pbutton.startup_state", 2); // 0=non-i2p, 1=i2p, 2=last
pref("extensions.i2pbutton.i2p_memory_jar",false);
pref("extensions.i2pbutton.nontor_memory_jar",false);
pref("extensions.i2pbutton.noni2p_memory_jar",false);
pref("extensions.i2pbutton.launch_warning",true);
// Security Slider
@ -52,20 +56,9 @@ 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", 7657);
pref("extensions.i2pbutton.console_port_i2pd", 7070);
pref("extensions.i2pbutton.console_port_i2pj", 17657);
pref("extensions.i2pbutton.console_port_i2pd", 17070);
// I2P Implementation
pref("extensions.i2pbutton.i2pimpl_driver", "i2pj");
// The i2p_path is relative to the application directory. On Linux and
// Windows this is the Browser/ directory that contains the firefox
// executables, and on Mac OS it is the I2PBrowser.app directory.
pref("extensions.i2pbutton.i2p_path", "");
// The i2pdatadir_path are relative to the data directory,
// which is I2PBrowser-Data/ if it exists as a sibling of the application
// directory. If I2PBrowser-Data/ does not exist, these paths are relative
// to the I2PBrowser/ directory within the application directory.
pref("extensions.i2pbutton.i2pdatadir_path", "");

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.0</em:version>
<em:version>0.3.2</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

@ -167,7 +167,7 @@ const LauncherUtil = {
getRouterDefaultArgs: function() {
let dataDir = this.getI2PConfigPath(true)
let exeFile = this.getI2PBinary()
let libDir = exeFile.parent.parent.clone()
let libDir = dataDir.clone()
let i2pDir = libDir.clone()
libDir.append('lib')
let args = []
@ -175,18 +175,24 @@ const LauncherUtil = {
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
args.push(`-Dwrapper.logfile=${dataDir.path}/wrapper.log`)
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}`)
args.push(`-Drouter.clientConfigFile=${dataDir.path}/clients.config`)
args.push(`-Drouter.configLocation=${dataDir.path}/router.config`)
let clientConfigFile = dataDir.clone()
clientConfigFile.append('clients.config')
let routerCofigFile = dataDir.clone()
routerCofigFile.append('router.config')
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}/lib`)
args.push(`${i2pDir.path}:${libDir.path}:${dataDir.path}`)
args.push("-Djava.awt.headless=true")
args.push("-Dwrapper.console.loglevel=DEBUG")
// Main class to execute
@ -235,83 +241,68 @@ const LauncherUtil = {
},
getI2PPath: (aI2PFileType, aCreate) => {
return this.getI2PFile(aI2PFileType, aCreate)
return this.getI2PFile(aI2PFileType, aCreate).clone()
},
getI2PConfigPath: (create) => {
// Going backwards from profile works on all OS.
let profDir = Services.dirsvc.get("ProfD", Ci.nsIFile)
let dataDir = profDir.parent.parent.clone()
dataDir.append('I2P')
if (!dataDir.exists() && create) {
dataDir.create(dataDir.DIRECTORY_TYPE, 0o775)
}
return dataDir.clone()
return dataDir
},
getI2PFile: function(aI2PFileType, aCreate) {
if (!aI2PFileType) {
return false
aI2PFileType = 'i2p'
}
let i2pFile
let path = ''
let useAppDir = false
let isRelativePath = true
let isUserData = (aI2PFileType != 'i2p')
let isUserData = false
let appBaseDir = this.appDirectoryObject.clone()
logger.log(2, `appBaseDir => ${appBaseDir.path}`)
if (this.isWindows) {
//
if ("i2p" == aI2PFileType) {
path = "I2PBrowser\\I2P\\bin\\java"
useAppDir = true
} else if ("i2pdatadir" == aI2PFileType) {
path = "I2P"
} else if ("certszip" == aI2PFileType) {
path = "I2PBrowser\\I2P\\certs.zip"
appBaseDir.append('I2P')
appBaseDir.append('bin')
appBaseDir.append('java.exe')
return appBaseDir
}
} else if (this.isMac) {
//
if ("i2p" == aI2PFileType) {
path = "Contents/Resources/I2PBrowser/I2P/bin/java"
} else if ("i2pdatadir" == aI2PFileType) {
path = "I2P"
} else if ("certszip" == aI2PFileType) {
path = "Contents/Resources/I2PBrowser/I2P/certs.zip"
}
} else {
if ("i2p" == aI2PFileType) {
path = "I2PBrowser/I2P/bin/java"
} else if ("i2pdatadir" == aI2PFileType) {
path = "I2P"
} else if ("certszip" == aI2PFileType) {
path = "I2PBrowser/I2P/certs.zip"
appBaseDir.append('I2P')
appBaseDir.append('bin')
appBaseDir.append('java')
return appBaseDir
}
}
logger.log(2, `getI2PFile - Gonna try path ${path}`)
try {
if (path == '' && !useAppDir) {
throw Error('Fatal error: Can\'t resolve directories!')
}
if (useAppDir)
{
i2pFile = LauncherUtilInternal._appDir.clone()
}
// Turn 'path' into an absolute path.
if (LauncherUtilInternal._isUserDataOutsideOfAppDir)
{
let baseDir = isUserData ? LauncherUtilInternal._dataDir : LauncherUtilInternal._appDir
i2pFile = baseDir.clone()
} else {
i2pFile = LauncherUtilInternal._appDir.clone()
i2pFile.append("I2PBrowser")
i2pFile = LauncherUtilInternal._appDir.clone()
if (!this.isMac) {
let lnxpath = i2pFile.clone()
lnxpath.append(path)
return lnxpath
}
//i2pFile.appendRelativePath(path)
logger.log(2, `getI2PFile - Path before append: ${i2pFile.path}`)
i2pFile.appendRelativePath(path)
if (!i2pFile.exists() && aCreate === true) {
logger.log(3, `Requested datadir ${i2pFile.path}, but it wasn't created so we create it now.`)
i2pFile.create(i2pFile.DIRECTORY_TYPE, 0o700)
}
logger.log(2, `getI2PFile - Gonna try path ${i2pFile.path}`)
if (i2pFile.exists()) {
try { i2pFile.normalize() } catch(e) {}
@ -332,10 +323,13 @@ const LauncherUtil = {
return LauncherUtilInternal
},
get dataDirectoryObject() {
return LauncherUtilInternal._dataDir
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
return LauncherUtilInternal._appDir.clone()
},
flushLocalizedStringCache: function()
{

View File

@ -78,7 +78,7 @@ let noscriptSettings = safetyLevel => (
"enforced": true,
"autoAllowTop": false
},
"isTorBrowser": true,
"isI2PBrowser": true,
"tabId": -1
});