From 8bd99f699f586e510df574a9e4bd3d33999f31f6 Mon Sep 17 00:00:00 2001
From: jrandom
Date: Thu, 25 Nov 2004 21:57:19 +0000
Subject: [PATCH] 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)
------------------------------------------------
---
.../i2p/client/streaming/ByteCollector.java | 2 +-
.../streaming/I2PSocketManagerImpl.java | 2 +-
.../streaming/I2PSocketOptionsImpl.java | 2 +-
.../net/i2p/router/web/ConfigNetHandler.java | 5 +-
.../i2p/router/web/ConfigServiceHandler.java | 90 ++++++++++++++
.../src/net/i2p/router/web/ContentHelper.java | 9 +-
.../src/net/i2p/router/web/LogsHelper.java | 2 +-
apps/routerconsole/jsp/configservice.jsp | 8 ++
apps/routerconsole/jsp/help.jsp | 11 +-
.../src/net/i2p/apps/systray/SysTray.java | 4 +-
.../src/net/i2p/apps/systray/UrlLauncher.java | 10 ++
build.xml | 15 ++-
core/java/src/net/i2p/util/Clock.java | 4 +-
core/java/src/net/i2p/util/Copy.java | 11 ++
core/java/src/net/i2p/util/Delete.java | 11 ++
core/java/src/net/i2p/util/Exec.java | 25 ++++
core/java/src/net/i2p/util/FileUtil.java | 63 +++++++++-
core/java/src/net/i2p/util/ShellCommand.java | 4 +-
history.txt | 20 ++-
installer/install.xml | 86 ++++++++++++-
installer/resources/ProcessPanel.Spec.xml | 16 ---
installer/resources/clients.config | 9 +-
installer/resources/console.ico | Bin 0 -> 7406 bytes
installer/resources/favicon.ico | Bin 0 -> 1406 bytes
installer/resources/i2prouter_win9x.bat | 3 -
installer/resources/shortcutSpec.xml | 33 +++++
installer/resources/start.ico | Bin 0 -> 7406 bytes
installer/resources/startconsole.html | 6 +
installer/resources/uninstall.ico | Bin 0 -> 7406 bytes
installer/resources/wrapper.config | 1 +
readme.html | 117 ++++++++----------
router/java/src/net/i2p/router/Router.java | 11 ++
.../src/net/i2p/router/RouterVersion.java | 4 +-
.../i2p/router/startup/LoadClientAppsJob.java | 15 ++-
.../i2p/router/startup/VerifyClasspath.java | 87 +++++++++++++
.../transport/tcp/ConnectionBuilder.java | 4 +-
.../i2p/router/transport/tcp/TCPListener.java | 2 +-
37 files changed, 577 insertions(+), 115 deletions(-)
create mode 100644 core/java/src/net/i2p/util/Copy.java
create mode 100644 core/java/src/net/i2p/util/Delete.java
create mode 100644 core/java/src/net/i2p/util/Exec.java
delete mode 100644 installer/resources/ProcessPanel.Spec.xml
create mode 100644 installer/resources/console.ico
create mode 100644 installer/resources/favicon.ico
delete mode 100644 installer/resources/i2prouter_win9x.bat
create mode 100644 installer/resources/shortcutSpec.xml
create mode 100644 installer/resources/start.ico
create mode 100644 installer/resources/startconsole.html
create mode 100644 installer/resources/uninstall.ico
create mode 100644 router/java/src/net/i2p/router/startup/VerifyClasspath.java
diff --git a/apps/ministreaming/java/src/net/i2p/client/streaming/ByteCollector.java b/apps/ministreaming/java/src/net/i2p/client/streaming/ByteCollector.java
index 2f0a69080..629684eb0 100644
--- a/apps/ministreaming/java/src/net/i2p/client/streaming/ByteCollector.java
+++ b/apps/ministreaming/java/src/net/i2p/client/streaming/ByteCollector.java
@@ -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;
diff --git a/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketManagerImpl.java b/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketManagerImpl.java
index 4af292085..87cc67861 100644
--- a/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketManagerImpl.java
+++ b/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketManagerImpl.java
@@ -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;
diff --git a/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketOptionsImpl.java b/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketOptionsImpl.java
index e8700a01a..6eb405f55 100644
--- a/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketOptionsImpl.java
+++ b/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketOptionsImpl.java
@@ -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;
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHandler.java
index 64f9ce98f..fbc28ab38 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHandler.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHandler.java
@@ -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;
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigServiceHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigServiceHandler.java
index 8133aadb4..392329f01 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigServiceHandler.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigServiceHandler.java
@@ -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");
+ }
+ }
}
\ No newline at end of file
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ContentHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ContentHelper.java
index a59ad50e4..bf515c82d 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/ContentHelper.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/ContentHelper.java
@@ -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
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/LogsHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/LogsHelper.java
index 93893c283..83bd62e33 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/LogsHelper.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/LogsHelper.java
@@ -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
diff --git a/apps/routerconsole/jsp/configservice.jsp b/apps/routerconsole/jsp/configservice.jsp
index 1a705caca..36bc76307 100644
--- a/apps/routerconsole/jsp/configservice.jsp
+++ b/apps/routerconsole/jsp/configservice.jsp
@@ -67,6 +67,14 @@
please select the following option and review the thread dumped to
wrapper.log.
+
+
Launch browser on router startup?
+
I2P's main configuration interface is this web console, so for your convenience
+ I2P can launch a web browser pointing at
+ http://localhost:7657/index.jsp whenever
+ the router starts up.
+
+
diff --git a/apps/routerconsole/jsp/help.jsp b/apps/routerconsole/jsp/help.jsp
index 00e56fe71..6449ec93a 100644
--- a/apps/routerconsole/jsp/help.jsp
+++ b/apps/routerconsole/jsp/help.jsp
@@ -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).
The router by default also includes human's public domain SAM bridge,
-which other client applications (such as aum's stasher) can use. For
+which other client applications (such the bittorrent port) can use.
+There is also an optimized library for doing large number calculations - jbigi - which in turn uses the
+LGPL licensed GMP library, tuned for various PC architectures. For
details on other applications available, as well as their licenses, please see the
license policy. Source for the I2P code and most bundled
client applications can be found on our download page, and is
@@ -47,7 +49,14 @@ in cvs.
+
+
+
+ A more complete list of updates can be found
+ online
+ (anonymously)
+