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

@ -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");
}
}
}