21 Commits
0.3.1 ... 0.3.5

Author SHA1 Message Date
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
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
idk
c19ea1d76c Merge branch 'master' of https://github.com/mikalv/i2pbutton 2019-09-06 13:25:41 -04:00
10 changed files with 161 additions and 26 deletions

View File

@ -99,7 +99,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

@ -33,9 +33,12 @@ window.addEventListener("pageshow", function() {
<div class='content'>
<div class='section-header'>
<h1>&aboutI2p.browser_name;</h1>
</div>
</div>
<div id="i2pbrowser-version"></div>
<p>
&aboutI2p.browser_name; ( &aboutI2p.browser_short_name; ) &aboutI2p.browser_description;
&aboutI2p.browser_name; ( &aboutI2p.browser_short_name; ) &aboutI2p.browser_description; <br />
&aboutI2p.startup; <a href="&aboutI2p.routerconsole;">&aboutI2p.rc;</a> &aboutI2p.startup_b;
<h3>&aboutI2p.links;</h3>
<p>
<ul>

View File

@ -21,6 +21,7 @@ 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 checkI2P(callback,proxyCallback) {
let req = checkSvc.createCheckConsoleRequest(true);
@ -50,10 +51,14 @@ 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()
{
// 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)
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
}
var i2pbutton_unique_pref_observer =

View File

@ -31,6 +31,10 @@
<!ENTITY aboutI2p.refresh_link "Refresh">
<!ENTITY aboutI2p.site "http://i2p-projekt.i2p/en">
<!ENTITY aboutI2p.routerconsole "http://localhost:7657">
<!ENTITY aboutI2p.routerconsole "http://localhost:17657">
<!ENTITY aboutI2p.github "https://github.com/mikalv">
<!ENTITY aboutI2p.trac "http://trac.i2p2.i2p">
<!ENTITY aboutI2p.startup "Sometimes it takes a minute or two for I2P to get started for the first time. While you wait, visit the">
<!ENTITY aboutI2p.startup_b "to get acquainted with all the capabilities of I2P.">
<!ENTITY aboutI2p.rc "Router Console">

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)

View File

@ -98,7 +98,7 @@ I2PProcessService.prototype =
this._isConsoleRunning(function(res) {
if (res!=4) {
// Yes, 4 is success
let canStartPromise = this._config_checker.ensure_config()
let canStartPromise = self._config_checker.ensure_config()
canStartPromise.then(() => {
self._logger.log(3, 'Starting the router')
self.I2PStartAndControlI2P(true)
@ -276,7 +276,7 @@ I2PProcessService.prototype =
// 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;
@ -297,8 +297,6 @@ I2PProcessService.prototype =
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)

View File

@ -158,7 +158,7 @@ I2pbuttonLogger.prototype =
true);
} else if (Services.prefs.
getIntPref("extensions.i2plauncher.logmethod", 3) !== 0) {
// If Tor Launcher is not available or its log method is not 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);

View File

@ -25,6 +25,12 @@ XPCOMUtils.defineLazyModuleGetter(this, "LauncherUtil", "resource://i2pbutton/mo
let consolePort = Services.prefs.getIntPref("extensions.i2pbutton.console_port_i2pj", 17657)
let httpProxyPort = Services.prefs.getIntPref("network.proxy.http_port", 14444)
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
tunnel.0.interface=127.0.0.1
@ -125,6 +131,10 @@ i2p.reseedURL=https://download.xxlspeed.com/,https://i2p.mooo.com/netDb/,https:/
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
`
@ -149,6 +159,7 @@ RouterConfigManager.prototype = {
mDoesRouterConfigExists: false,
mDoesClientsConfigExists: false,
mDoesTunnelConfigExists: false,
mDoesWebappsConfigExists: false,
mHasChecksStarted: false,
mIsChecksDone: false,
@ -179,6 +190,61 @@ RouterConfigManager.prototype = {
this._logger.log(6,`Can't write clients config file :( - path was ${configfile.path}`)
})
},
_write_webapps_config: function(configfile,onComplete) {
const self = this
LauncherUtil.writeFileWithData(configfile, defaultWebappsConfig, file => { onComplete(file) }, (err) => {
this._logger.log(6,`Can't write webapps 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)
}
}
},
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}`)
}
}
}
},
ensure_config: async function(onCompleteCallback) {
@ -191,6 +257,41 @@ RouterConfigManager.prototype = {
tunnelConfigFile.append('i2ptunnel.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, '')
}
this.ensure_docs()
this.ensure_webapps()
// Ensure they exists
const self = this
@ -232,7 +333,7 @@ RouterConfigManager.prototype = {
this.ensureClientsConfigPromise = () => {
return new Promise(resolve => {
if (!clientsConfigFile.exists()) {
self._write_tunnel_config(tunnelConfigFile, tfile => {
self._write_clients_config(clientsConfigFile, tfile => {
self._logger.log(3, 'Wrote clients.config')
self.mDoesClientsConfigExists = true
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
@ -246,12 +347,30 @@ RouterConfigManager.prototype = {
})
}
this.ensureWebappsConfigPromise = () => {
return new Promise(resolve => {
if (!webappsConfigFile.exists()) {
self._write_webapps_config(webappsConfigFile, 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.ensureClientsConfigPromise(),
this.ensureWebappsConfigPromise(),
])
},
}

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.1</em:version>
<em:version>0.3.4</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

@ -100,8 +100,8 @@ const LauncherUtil = {
return;
}
const kSettingsURL = "chrome://i2pbutton/content/network-settings.xul";
const kWizardURL = "chrome://i2pbutton/content/network-settings-wizard.xul";
const kSettingsURL = "chrome://i2pbutton/chrome/content/network-settings.xul";
const kWizardURL = "chrome://i2pbutton/chrome/content/network-settings-wizard.xul";
var wwSvc = Cc["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Ci.nsIWindowWatcher);
@ -109,8 +109,8 @@ const LauncherUtil = {
var argsArray = this._createOpenWindowArgsArray(aIsInitialBootstrap,
aStartAtWizardPanel);
let isProgress = (this.kWizardProgressPageID == aStartAtWizardPanel);
let url = (aIsInitialBootstrap || isProgress) ? kWizardURL : kSettingsURL;
wwSvc.openWindow(null, url, "_blank", winFeatures, argsArray);
//let url = (aIsInitialBootstrap || isProgress) ? kWizardURL : kSettingsURL;
wwSvc.openWindow(null, kWizardURL, "_blank", winFeatures, argsArray);
},
// Returns true if user confirms; false if not.
@ -179,6 +179,7 @@ const LauncherUtil = {
logFile.append('wrapper.log')
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}`)
@ -250,7 +251,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
@ -290,18 +291,17 @@ const LauncherUtil = {
}
}
i2pFile = LauncherUtilInternal._appDir.clone()
try {
// Turn 'path' into an absolute path.
i2pFile = LauncherUtilInternal._appDir.clone()
if (this.isMac) {
i2pFile.append("I2PBrowser")
} else {
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)
logger.log(2, `getI2PFile - Gonna try path ${i2pFile.path}`)