Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
637ff45592 | |||
78959d60c7 | |||
00283bde24 | |||
2c0666dcf2 | |||
b06dded801 | |||
4bed82f527 | |||
ed36de6cae | |||
676c2348d8 | |||
e7d888c776 | |||
6adb55d048 | |||
4a680de5a2 | |||
79a32618f8 | |||
8d249f4831 | |||
67ed95fc25 | |||
5b6504a11d | |||
832c79f4b5 | |||
988047ec4e | |||
c19ea1d76c |
@ -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"]
|
||||
|
@ -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>
|
||||
|
@ -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 =
|
||||
|
@ -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">
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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(),
|
||||
])
|
||||
},
|
||||
}
|
||||
|
@ -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.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>
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user