source: apps/routerconsole/jsp/index.jsp @ f8f6375

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

New install setup wizard
Work in progress, run on first install disabled.
Language and bw settings should work,
other panes todo.

  • 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    String req = request.getRequestURL().toString();
16    StringBuilder buf = new StringBuilder(128);
17    if (req.endsWith("index"))
18        req = req.substring(0, req.length() - 5);
19    else if (req.endsWith("index.jsp"))
20        req = req.substring(0, req.length() - 9);
21    buf.append(req);
22    if (!req.endsWith("/"))
23        buf.append('/');
24    net.i2p.I2PAppContext ctx = net.i2p.I2PAppContext.getGlobalContext();
25    boolean oldHome = ctx.getBooleanProperty("routerconsole.oldHomePage");
26    boolean wizRun = ctx.getBooleanProperty("routerconsole.welcomeWizardComplete");
27    String firstVersion = ctx.getProperty("router.firstVersion");
28    String tgt;
29    final boolean ENABLE_WIZARD_ON_FIRST_RUN = false;
30    if (oldHome) {
31        tgt = "console";
32    } else if (ENABLE_WIZARD_ON_FIRST_RUN && (wizRun || firstVersion == null)) {
33        // wizard already run
34        tgt = "home";
35    } else {
36        String version = net.i2p.CoreVersion.VERSION;
37        if (version.equals("0.9.37")) {
38            // dev builds, force everyone to run it once for testing
39            tgt = "welcome";
40        } else if (version.equals(firstVersion)) {
41            // first install 38 or later, still on same version
42            tgt = "welcome";
43        } else {
44            // they already upgraded
45            tgt = "home";
46        }
47    }
48    buf.append(tgt);
49    String query = request.getQueryString();
50    if (query != null)
51        buf.append('?').append(query);
52    response.setHeader("Location", buf.toString());
53    // force commitment
54    response.getOutputStream().close();
55%>
Note: See TracBrowser for help on using the repository browser.