2004-11-25 jrandom

* Revised the installer to include start menu and desktop shortcuts for
      windows platforms, including pretty icons (thanks DrWoo!)
    * Allow clients specified in clients.config to have an explicit startup
      delay.
    * Update the default install to launch a browser pointing at the console
      whenever I2P starts up, rather than only the first time it starts up
      (configurable on /configservice.jsp, or in clients.config)
    * Bugfix to the clock skew checking code to monitor the delta between
      offsets, not the offset itself (duh)
    * Router console html update
    * New (and uuuuugly) code to verify that the wrapper.config contains
      the necessary classpath entries on update.  If it has to update the
      wrapper.config, it will stop the JVM and service completely, since the
      java service wrapper doesn't reread the wrapper.config on JVM restart -
      requiring the user to manually restart the service after an update.
    * Increase the TCP connection timeout to 30s (which is obscenely long)
------------------------------------------------
This commit is contained in:
jrandom
2004-11-25 21:57:19 +00:00
committed by zzz
parent b0513fff8a
commit 8bd99f699f
37 changed files with 577 additions and 115 deletions

View File

@ -5,7 +5,7 @@ package net.i2p.client.streaming;
* so care should be taken when using in a multithreaded environment.
*
*/
public class ByteCollector {
class ByteCollector {
byte[] contents;
int size;

View File

@ -35,7 +35,7 @@ import net.i2p.util.Log;
* or receive any messages with its .receiveMessage
*
*/
public class I2PSocketManagerImpl implements I2PSocketManager, I2PSessionListener {
class I2PSocketManagerImpl implements I2PSocketManager, I2PSessionListener {
private I2PAppContext _context;
private Log _log;
private I2PSession _session;

View File

@ -7,7 +7,7 @@ import java.util.Properties;
* Define the configuration for streaming and verifying data on the socket.
*
*/
public class I2PSocketOptionsImpl implements I2PSocketOptions {
class I2PSocketOptionsImpl implements I2PSocketOptions {
private long _connectTimeout;
private long _readTimeout;
private long _writeTimeout;

View File

@ -217,7 +217,10 @@ public class ConfigNetHandler extends FormHandler {
}
if ( (_port != null) && (_port.length() > 0) ) {
String oldPort = _context.router().getConfigSetting(ConfigNetHelper.PROP_I2NP_TCP_PORT);
if ( (oldPort == null) || (!oldPort.equalsIgnoreCase(_port)) ) {
if ( (oldPort == null) && (_port.equals("8887")) ) {
// still on default.. noop
} else if ( (oldPort == null) || (!oldPort.equalsIgnoreCase(_port)) ) {
// its not the default OR it has changed
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_TCP_PORT, _port);
addFormNotice("Updating TCP port from " + oldPort + " to " + _port);
restartRequired = true;

View File

@ -1,10 +1,17 @@
package net.i2p.router.web;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Iterator;
import java.util.Properties;
import java.util.TreeMap;
import net.i2p.data.DataHelper;
import net.i2p.router.ClientTunnelSettings;
import net.i2p.router.Router;
import net.i2p.apps.systray.SysTray;
import net.i2p.apps.systray.UrlLauncher;
import org.tanukisoftware.wrapper.WrapperManager;
/**
@ -86,6 +93,12 @@ public class ConfigServiceHandler extends FormHandler {
} catch (Throwable t) {
addFormError("Warning: unable to contact the systray manager - " + t.getMessage());
}
} else if ("View console on startup".equals(_action)) {
browseOnStartup(true);
addFormNotice("Console is to be shown on startup");
} else if ("Do not view console on startup".equals(_action)) {
browseOnStartup(false);
addFormNotice("Console is not to be shown on startup");
} else {
addFormNotice("Blah blah blah. whatever. I'm not going to " + _action);
}
@ -107,4 +120,81 @@ public class ConfigServiceHandler extends FormHandler {
addFormError("Warning: unable to remove the service - " + ioe.getMessage());
}
}
private final static String NL = System.getProperty("line.separator");
private void browseOnStartup(boolean shouldLaunchBrowser) {
File f = new File("clients.config");
Properties p = new Properties();
try {
DataHelper.loadProps(p, f);
int i = 0;
int launchIndex = -1;
while (true) {
String className = p.getProperty("clientApp." + i + ".main");
if (className == null) break;
if (UrlLauncher.class.getName().equals(className)) {
launchIndex = i;
break;
}
i++;
}
if ((launchIndex >= 0) && shouldLaunchBrowser)
return;
if ((launchIndex < 0) && !shouldLaunchBrowser)
return;
if (shouldLaunchBrowser) {
p.setProperty("clientApp." + i + ".main", UrlLauncher.class.getName());
p.setProperty("clientApp." + i + ".name", "BrowserLauncher");
p.setProperty("clientApp." + i + ".args", "http://localhost:7657/index.jsp");
p.setProperty("clientApp." + i + ".delay", "5");
} else {
p.remove("clientApp." + launchIndex + ".main");
p.remove("clientApp." + launchIndex + ".name");
p.remove("clientApp." + launchIndex + ".args");
p.remove("clientApp." + launchIndex + ".onBoot");
p.remove("clientApp." + launchIndex + ".delay");
i = launchIndex + 1;
while (true) {
String main = p.getProperty("clientApp." + i + ".main");
String name = p.getProperty("clientApp." + i + ".name");
String args = p.getProperty("clientApp." + i + ".args");
String boot = p.getProperty("clientApp." + i + ".onBoot");
String delay= p.getProperty("clientApp." + i + ".delay");
if (main == null) break;
p.setProperty("clientApp." + (i-1) + ".main", main);
p.setProperty("clientApp." + (i-1) + ".name", name);
p.setProperty("clientApp." + (i-1) + ".args", args);
if (boot != null)
p.setProperty("clientApp." + (i-1) + ".onBoot", boot);
if (delay != null)
p.setProperty("clientApp." + (i-1) + ".delay", delay);
p.remove("clientApp." + i + ".main");
p.remove("clientApp." + i + ".name");
p.remove("clientApp." + i + ".args");
p.remove("clientApp." + i + ".onBoot");
p.remove("clientApp." + i + ".delay");
i++;
}
}
TreeMap sorted = new TreeMap(p);
FileWriter out = new FileWriter(f);
for (Iterator iter = sorted.keySet().iterator(); iter.hasNext(); ) {
String name = (String)iter.next();
String val = (String)sorted.get(name);
out.write(name + "=" + val + NL);
}
out.close();
} catch (IOException ioe) {
addFormError("Error updating the client config");
}
}
}

View File

@ -10,6 +10,7 @@ import net.i2p.util.FileUtil;
public class ContentHelper {
private String _page;
private int _maxLines;
private boolean _startAtBeginning;
private RouterContext _context;
/**
* Configure this bean to query a particular router context
@ -28,6 +29,10 @@ public class ContentHelper {
public ContentHelper() {}
public void setPage(String page) { _page = page; }
public void setStartAtBeginning(String moo) {
_startAtBeginning = Boolean.valueOf(""+moo).booleanValue();
}
public void setMaxLines(String lines) {
if (lines != null) {
try {
@ -40,14 +45,14 @@ public class ContentHelper {
}
}
public String getContent() {
String str = FileUtil.readTextFile(_page, _maxLines);
String str = FileUtil.readTextFile(_page, _maxLines, _startAtBeginning);
if (str == null)
return "";
else
return str;
}
public String getTextContent() {
String str = FileUtil.readTextFile(_page, _maxLines);
String str = FileUtil.readTextFile(_page, _maxLines, _startAtBeginning);
if (str == null)
return "";
else

View File

@ -42,7 +42,7 @@ public class LogsHelper {
}
public String getServiceLogs() {
String str = FileUtil.readTextFile("wrapper.log", 500);
String str = FileUtil.readTextFile("wrapper.log", 500, false);
if (str == null)
return "";
else

View File

@ -67,6 +67,14 @@
please select the following option and review the thread dumped to
<a href="logs.jsp#servicelogs">wrapper.log</a>.</p>
<input type="submit" name="action" value="Dump threads" />
<h4>Launch browser on router startup?</h4>
<p>I2P's main configuration interface is this web console, so for your convenience
I2P can launch a web browser pointing at
<a href="http://localhost:7657/index.jsp">http://localhost:7657/index.jsp</a> whenever
the router starts up.</p>
<input type="submit" name="action" value="View console on startup" />
<input type="submit" name="action" value="Do not view console on startup" />
</form>
</div>

View File

@ -37,7 +37,9 @@ by their binary code license. This product includes software developed by the A
lets you tunnel normal TCP/IP traffic over I2P (such as the eepproxy and the irc proxy).</p>
<p>The router by default also includes human's public domain <a href="http://www.i2p.net/sam">SAM</a> bridge,
which other client applications (such as aum's <a href="http://stasher.i2p/">stasher</a>) can use. For
which other client applications (such the <a href="http://duck.i2p/i2p-bt/">bittorrent port</a>) can use.
There is also an optimized library for doing large number calculations - jbigi - which in turn uses the
LGPL licensed <a href="http://swox.com/gmp/">GMP</a> library, tuned for various PC architectures. For
details on other applications available, as well as their licenses, please see the
<a href="http://www.i2p.net/licenses">license policy</a>. Source for the I2P code and most bundled
client applications can be found on our <a href="http://www.i2p.net/download">download page</a>, and is
@ -47,7 +49,14 @@ in <a href="http://www.i2p.net/cvs">cvs</a>.</p>
<jsp:useBean class="net.i2p.router.web.ContentHelper" id="contenthelper" scope="request" />
<jsp:setProperty name="contenthelper" property="page" value="history.txt" />
<jsp:setProperty name="contenthelper" property="maxLines" value="500" />
<jsp:setProperty name="contenthelper" property="startAtBeginning" value="true" />
<jsp:getProperty name="contenthelper" property="textContent" />
<p>
A more complete list of updates can be found
<a href="http://dev.i2p.net/cgi-bin/cvsweb.cgi/i2p/history.txt?rev=HEAD">online</a>
(<a href="http://dev.i2p/cgi-bin/cvsweb.cgi/i2p/history.txt?rev=HEAD">anonymously</a>)
</p>
</div>
</body>

View File

@ -46,8 +46,8 @@ public class SysTray implements SysTrayMenuListener {
_portString = _configFile.getProperty("port", "7657");
_showIcon = Boolean.valueOf(_configFile.getProperty("visible", "true")).booleanValue();
if (!(new File("router.config")).exists())
openRouterConsole("http://localhost:" + _portString + "/index.jsp");
//if (!(new File("router.config")).exists())
// openRouterConsole("http://localhost:" + _portString + "/index.jsp");
if ( (System.getProperty("os.name").startsWith("Windows")) && (!Boolean.getBoolean("systray.disable")) )
_instance = new SysTray();

View File

@ -147,4 +147,14 @@ public class UrlLauncher {
}
return true;
}
public static void main(String args[]) {
UrlLauncher launcher = new UrlLauncher();
try {
if (args.length > 0)
launcher.openUrl(args[0]);
else
launcher.openUrl("http://localhost:7657/index.jsp");
} catch (Exception e) {}
}
}