2006-02-15 05:33:17 +00:00
|
|
|
<%
|
2018-03-09 21:02:00 +00:00
|
|
|
/*
|
|
|
|
* USE CAUTION WHEN EDITING
|
|
|
|
* Trailing whitespace OR NEWLINE on the last line will cause
|
|
|
|
* IllegalStateExceptions !!!
|
|
|
|
*
|
|
|
|
* Do not tag this file for translation.
|
|
|
|
*/
|
|
|
|
|
2012-02-20 14:32:48 +00:00
|
|
|
//
|
|
|
|
// Redirect to either /home or /console, depending on configuration,
|
|
|
|
// while preserving any query parameters
|
|
|
|
//
|
2018-02-20 16:53:31 +00:00
|
|
|
response.setStatus(307);
|
2012-02-20 14:32:48 +00:00
|
|
|
String req = request.getRequestURL().toString();
|
|
|
|
StringBuilder buf = new StringBuilder(128);
|
2012-01-25 02:50:42 +00:00
|
|
|
if (req.endsWith("index"))
|
|
|
|
req = req.substring(0, req.length() - 5);
|
|
|
|
else if (req.endsWith("index.jsp"))
|
|
|
|
req = req.substring(0, req.length() - 9);
|
2012-02-20 14:32:48 +00:00
|
|
|
buf.append(req);
|
2012-01-25 02:50:42 +00:00
|
|
|
if (!req.endsWith("/"))
|
2012-02-20 14:32:48 +00:00
|
|
|
buf.append('/');
|
2018-11-13 17:46:18 +00:00
|
|
|
net.i2p.I2PAppContext ctx = net.i2p.I2PAppContext.getGlobalContext();
|
|
|
|
boolean oldHome = ctx.getBooleanProperty("routerconsole.oldHomePage");
|
|
|
|
boolean wizRun = ctx.getBooleanProperty("routerconsole.welcomeWizardComplete");
|
|
|
|
String firstVersion = ctx.getProperty("router.firstVersion");
|
|
|
|
String tgt;
|
|
|
|
final boolean ENABLE_WIZARD_ON_FIRST_RUN = false;
|
|
|
|
if (oldHome) {
|
|
|
|
tgt = "console";
|
|
|
|
} else if (ENABLE_WIZARD_ON_FIRST_RUN && (wizRun || firstVersion == null)) {
|
|
|
|
// wizard already run
|
|
|
|
tgt = "home";
|
|
|
|
} else {
|
|
|
|
String version = net.i2p.CoreVersion.VERSION;
|
|
|
|
if (version.equals("0.9.37")) {
|
|
|
|
// dev builds, force everyone to run it once for testing
|
|
|
|
tgt = "welcome";
|
|
|
|
} else if (version.equals(firstVersion)) {
|
|
|
|
// first install 38 or later, still on same version
|
|
|
|
tgt = "welcome";
|
|
|
|
} else {
|
|
|
|
// they already upgraded
|
|
|
|
tgt = "home";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
buf.append(tgt);
|
2012-02-20 14:32:48 +00:00
|
|
|
String query = request.getQueryString();
|
|
|
|
if (query != null)
|
|
|
|
buf.append('?').append(query);
|
|
|
|
response.setHeader("Location", buf.toString());
|
2018-03-09 21:02:00 +00:00
|
|
|
// force commitment
|
|
|
|
response.getOutputStream().close();
|
|
|
|
%>
|