source: apps/routerconsole/jsp/index.jsp @ 6462e2a

Last change on this file since 6462e2a was 6462e2a, checked in by zzz <zzz@…>, 21 months ago

MLab/NDT: Prep for connecting to wizard, fixes, cleanups

  • Property mode set to 100644
File size: 1.9 KB
Line 
1<%
2/*
3 * USE CAUTION WHEN EDITING
4 * Trailing whitespace OR NEWLINE on the last line will cause
5 * IllegalStateExceptions !!!
6 *
7 * Do not tag this file for translation.
8 */
9
10    //
11    //  Redirect to either /home or /console, depending on configuration,
12    //  while preserving any query parameters
13    //
14    response.setStatus(307);
15    response.setHeader("Cache-Control","no-cache");
16    String req = request.getRequestURL().toString();
17    StringBuilder buf = new StringBuilder(128);
18    if (req.endsWith("index"))
19        req = req.substring(0, req.length() - 5);
20    else if (req.endsWith("index.jsp"))
21        req = req.substring(0, req.length() - 9);
22    buf.append(req);
23    if (!req.endsWith("/"))
24        buf.append('/');
25    net.i2p.I2PAppContext ctx = net.i2p.I2PAppContext.getGlobalContext();
26    boolean oldHome = ctx.getBooleanProperty("routerconsole.oldHomePage");
27    boolean wizRun = ctx.getBooleanProperty(net.i2p.router.web.helpers.WizardHelper.PROP_COMPLETE);
28    String firstVersion = ctx.getProperty("router.firstVersion");
29    String tgt;
30    final boolean ENABLE_WIZARD_ON_FIRST_RUN = false;
31    if (oldHome) {
32        tgt = "console";
33    } else if (!ENABLE_WIZARD_ON_FIRST_RUN || wizRun || firstVersion == null) {
34        // wizard already run
35        tgt = "home";
36    } else {
37        String version = net.i2p.CoreVersion.VERSION;
38        if (version.equals("0.9.37")) {
39            // dev builds, force everyone to run it once for testing
40            tgt = "welcome";
41        } else if (version.equals(firstVersion)) {
42            // first install 38 or later, still on same version
43            tgt = "welcome";
44        } else {
45            // they already upgraded
46            tgt = "home";
47        }
48    }
49    buf.append(tgt);
50    String query = request.getQueryString();
51    if (query != null)
52        buf.append('?').append(query);
53    response.setHeader("Location", buf.toString());
54    // force commitment
55    response.getOutputStream().close();
56%>
Note: See TracBrowser for help on using the repository browser.