Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
67ed95fc25 | |||
5b6504a11d | |||
832c79f4b5 | |||
988047ec4e | |||
6fa1736321 | |||
890438ffe9 | |||
ebf6f2577a |
@ -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)
|
||||
|
@ -180,6 +180,55 @@ RouterConfigManager.prototype = {
|
||||
})
|
||||
},
|
||||
|
||||
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, 0o775)
|
||||
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, 0o775)
|
||||
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) {
|
||||
this.mHasChecksStarted = true
|
||||
@ -192,6 +241,39 @@ RouterConfigManager.prototype = {
|
||||
let clientsConfigFile = configDirectory.clone()
|
||||
clientsConfigFile.append('clients.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, 0o775)
|
||||
orgDir.append('eclipse')
|
||||
orgDir.create(orgDir.DIRECTORY_TYPE, 0o775)
|
||||
orgDir.append('jetty')
|
||||
orgDir.create(orgDir.DIRECTORY_TYPE, 0o775)
|
||||
orgDir.append('webapp')
|
||||
orgDir.create(orgDir.DIRECTORY_TYPE, 0o775)
|
||||
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 +314,7 @@ RouterConfigManager.prototype = {
|
||||
this.ensureClientsConfigPromise = () => {
|
||||
return new Promise(resolve => {
|
||||
if (!clientsConfigFile.exists()) {
|
||||
self._write_tunnel_config(tunnelConfigFile, tfile => {
|
||||
self._write_clients_config(tunnelConfigFile, tfile => {
|
||||
self._logger.log(3, 'Wrote clients.config')
|
||||
self.mDoesClientsConfigExists = true
|
||||
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
|
||||
|
@ -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.3</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>
|
||||
|
@ -290,18 +290,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}`)
|
||||
|
||||
|
Reference in New Issue
Block a user