diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java index 3b667da42..0b1322fd3 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java +++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java @@ -232,7 +232,7 @@ public class I2PSnarkServlet extends DefaultServlet { //out.write("\n"); out.write("\n" + "\n"); @@ -1325,7 +1325,7 @@ public class I2PSnarkServlet extends DefaultServlet { * @return string or null * @since 0.8.4 */ - private String getTrackerLink(String announce, byte[] infohash) { + private String getTrackerLinkUrl(String announce, byte[] infohash) { // temporarily hardcoded for postman* and anonymity, requires bytemonsoon patch for lookup by info_hash if (announce != null && (announce.startsWith("http://YRgrgTLG") || announce.startsWith("http://8EoJZIKr") || announce.startsWith("http://lnQ6yoBT") || announce.startsWith("http://tracker2.postman.i2p/") || @@ -1341,15 +1341,29 @@ public class I2PSnarkServlet extends DefaultServlet { StringBuilder buf = new StringBuilder(128); buf.append("" + - "\"").append(_("Info")).append("\""); + .append("\" title=\"").append(_("Details at {0} tracker", name)).append("\" target=\"_blank\">"); return buf.toString(); } } return null; } + /** + * @return string or null + * @since 0.8.4 + */ + private String getTrackerLink(String announce, byte[] infohash) { + String linkUrl = getTrackerLinkUrl(announce, infohash); + if (linkUrl != null) { + StringBuilder buf = new StringBuilder(128); + buf.append(linkUrl) + .append("\"").append(_("Info")).append("\""); + return buf.toString(); + } + return null; + } + private void writeAddForm(PrintWriter out, HttpServletRequest req) throws IOException { // display incoming parameter if a GET so links will work String newURL = req.getParameter("newURL"); @@ -1560,9 +1574,9 @@ public class I2PSnarkServlet extends DefaultServlet { out.write(": KBps "); out.write(_("Half available bandwidth recommended.")); - out.write("
"); + out.write(" ["); out.write(_("View or change router bandwidth")); - out.write("

\n" + + out.write("]
\n" + ""); out.write(_("Use open trackers also")); @@ -1640,7 +1654,7 @@ public class I2PSnarkServlet extends DefaultServlet { "\"\" "); buf.append(_("Trackers")); buf.append("
\n" + - "
") + "\n"); } - buf.append("" + - "" + - "" + - "" + - "" + - "\n" + - "" + + "" + + "" + + "" + + "\n" + + ""); + // second table - dir info + buf.append("
") //.append(_("Remove")) .append("") .append(_("Name")) @@ -1659,16 +1673,16 @@ public class I2PSnarkServlet extends DefaultServlet { String name = t.name; String homeURL = t.baseURL; String announceURL = t.announceURL.replace("=", "="); - buf.append("
" + - "").append(name) - .append("").append(urlify(homeURL, 35)) - .append("").append(name) + .append("").append(urlify(homeURL, 35)) + .append("" + - "" + - "").append(urlify(announceURL, 35)) + "").append(urlify(announceURL, 35)) .append("
") + buf.append("
") .append(_("Add")).append(":
\n" + + "
\n" + "\n" + "\n" + "\n" + @@ -2049,40 +2063,34 @@ public class I2PSnarkServlet extends DefaultServlet { boolean showPriority = ls != null && snark != null && snark.getStorage() != null && !snark.getStorage().complete(); if (showPriority) buf.append("
\n"); - buf.append(""); if (snark != null) { - // first row - torrent info - // FIXME center - buf.append("
") - .append(_("Torrent")).append(": ").append(snark.getBaseName()); - int pieces = snark.getPieces(); - double completion = (pieces - snark.getNeeded()) / (double) pieces; - if (completion < 1.0) - buf.append("
").append(_("Completion")).append(": ").append((new DecimalFormat("0.00%")).format(completion)); - else - buf.append("
").append(_("Complete")); - // else unknown - long needed = snark.getNeededLength(); - if (needed > 0) - buf.append("
").append(_("Remaining")).append(": ").append(formatSize(needed)); - buf.append("
").append(_("Size")).append(": ").append(formatSize(snark.getTotalLength())); - MetaInfo meta = snark.getMetaInfo(); - if (meta != null) { - List files = meta.getFiles(); - int fileCount = files != null ? files.size() : 1; - buf.append("
").append(_("Files")).append(": ").append(fileCount); - } - buf.append("
").append(_("Pieces")).append(": ").append(pieces); - buf.append("
").append(_("Piece size")).append(": ").append(formatSize(snark.getPieceLength(0))); + // first table - torrent info + buf.append("\n"); + buf.append("\n"); + buf.append("\n"); + + MetaInfo meta = snark.getMetaInfo(); if (meta != null) { String announce = meta.getAnnounce(); if (announce != null) { - buf.append("
"); + buf.append(""); } } String hex = I2PSnarkUtil.toHex(snark.getInfoHash()); if (meta == null || !meta.isPrivate()) { - buf.append("
").append(toImg("magnet", _("Magnet link"))).append(" \n"); } else { - buf.append("
").append(_("Private torrent")); + buf.append("
\n"); } // We don't have the hash of the torrent file - //buf.append("
").append(_("Maggot link")).append(":
") - // .append(MAGGOT).append(hex).append(':').append(hex).append(""); - buf.append("
").append(_("Torrent file")).append(": ").append(snark.getName()); - buf.append(""); + //buf.append(""); + + buf.append("\n"); } else { // shouldn't happen buf.append(""); + .append("\"\n"); } + buf.append("
") + .append(_("Torrent")) + .append(": ") + .append(snark.getBaseName()) + .append("
") + .append("\"\" ") + .append(_("Torrent file")) + .append(": ") + .append(snark.getName()) + .append("
"); String trackerLink = getTrackerLink(announce, snark.getInfoHash()); if (trackerLink != null) buf.append(trackerLink).append(' '); - buf.append(_("Tracker")).append(": "); + buf.append("").append(_("Tracker")).append(": "); + String trackerLinkUrl = getTrackerLinkUrl(announce, snark.getInfoHash()); + if (trackerLinkUrl != null) + buf.append(trackerLinkUrl); if (announce.startsWith("http://")) announce = announce.substring(7); int slsh = announce.indexOf('/'); @@ -2091,53 +2099,110 @@ public class I2PSnarkServlet extends DefaultServlet { if (announce.length() > 67) announce = announce.substring(0, 40) + "…" + announce.substring(announce.length() - 8); buf.append(announce); + if (trackerLinkUrl != null) + buf.append(""); + buf.append("
") - .append(MAGNET_FULL).append(hex).append(""); + .append(toImg("magnet", _("Magnet link"))) + .append(" Magnet: ") + .append(MAGNET_FULL).append(hex).append("") + .append("
") + .append(_("Private torrent")) + .append("
").append(_("Maggot link")).append(": ") + // .append(MAGGOT).append(hex).append(':').append(hex).append("
") + .append("\"\" ") + .append(_("Size")) + .append(": ") + .append(formatSize(snark.getTotalLength())); + int pieces = snark.getPieces(); + double completion = (pieces - snark.getNeeded()) / (double) pieces; + if (completion < 1.0) + buf.append(" \"\" ") + .append(_("Completion")) + .append(": ") + .append((new DecimalFormat("0.00%")).format(completion)); + else + buf.append(" \"\" ") + .append(_("Complete")); + // else unknown + long needed = snark.getNeededLength(); + if (needed > 0) + buf.append(" \"\" ") + .append(_("Remaining")) + .append(": ") + .append(formatSize(needed)); + if (meta != null) { + List files = meta.getFiles(); + int fileCount = files != null ? files.size() : 1; + buf.append(" \"\" ") + .append(_("Files")) + .append(": ") + .append(fileCount); + } + buf.append(" \"\" ") + .append(_("Pieces")) + .append(": ") + .append(pieces); + buf.append(" \"\" ") + .append(_("Piece size")) + .append(": ") + .append(formatSize(snark.getPieceLength(0))) + .append("
Not found
resource=\"").append(r.toString()) .append("\"
base=\"").append(base) .append("\"
torrent=\"").append(torrentName) - .append("\"
\n"); if (ls == null) { // We are only showing the torrent info section - buf.append("
"); + buf.append(""); return buf.toString(); } - // second row - dir info - buf.append("
") - .append("\"\" ") - .append(_("Directory")).append(": ").append(directory).append("") - .append("\"\" ") - .append(_("Size")); - buf.append("") - .append("\"\" ") - .append(_("Status")).append("
\n"); + buf.append("\n") + .append("\n"); + buf.append("\n"); + buf.append("\n"); if (showPriority) buf.append(""); - buf.append("\n"); - buf.append("\n\n"); + buf.append("\n"); + .append(_("Up to higher level directory")) + .append("\n"); //DateFormat dfmt=DateFormat.getDateTimeInstance(DateFormat.MEDIUM, @@ -2153,8 +2218,7 @@ public class I2PSnarkServlet extends DefaultServlet { Resource item = r.addPath(ls[i]); String rowClass = (i % 2 == 0 ? "snarkTorrentEven" : "snarkTorrentOdd"); - buf.append(""); // Get completeness and status string boolean complete = false; @@ -2190,7 +2254,7 @@ public class I2PSnarkServlet extends DefaultServlet { status = toImg("clock_red"); status += " " + (100 * (length - remaining) / length) + "% " + _("complete") + - " (" + DataHelper.formatSize2(remaining) + _("bytes remaining") + ")"; + " (" + DataHelper.formatSize2(remaining) + "B " + _("remaining") + ")"; } } else { status = "Not a file?"; @@ -2206,6 +2270,8 @@ public class I2PSnarkServlet extends DefaultServlet { path=URIUtil.addPaths(path,"/"); String icon = toIcon(item); + buf.append("\n"); } if (showSaveButton) { - buf.append("\n"); } - buf.append("
") + .append("\"\" ") + .append(_("Directory")) + .append(": ") + .append(directory) + .append("") + .append("\"\" ") + .append(_("Size")) + .append("") + .append("\"\" ") + .append(_("Status")) + .append("") - .append("\"\" ") - .append(_("Priority")).append("
 ") + .append(_("Priority")).append("\n"); + buf.append("
\"\" ") - .append(_("Up to higher level directory")).append("
"); + buf.append("
"); if (complete) { buf.append(""); // thumbnail ? @@ -2213,16 +2279,17 @@ public class I2PSnarkServlet extends DefaultServlet { if (plc.endsWith(".jpg") || plc.endsWith(".jpeg") || plc.endsWith(".png") || plc.endsWith(".gif") || plc.endsWith(".ico")) { buf.append("\"\" "); + .append(path).append("\">"); } else { - buf.append(toImg(icon, _("Open"))).append(" "); + buf.append(toImg(icon, _("Open"))).append(""); } - buf.append(""); } else { - buf.append(toImg(icon)).append(' '); + buf.append(toImg(icon)); } + buf.append(""); + if (complete) + buf.append(""); buf.append(ls[i]); if (complete) buf.append(""); @@ -2259,15 +2326,15 @@ public class I2PSnarkServlet extends DefaultServlet { buf.append("
 
 
\n"); + buf.append("
\n"); if (showPriority) - buf.append(""); - buf.append("\n"); - + buf.append(""); + buf.append("\n"); + return buf.toString(); } diff --git a/apps/i2ptunnel/jsp/editClient.jsp b/apps/i2ptunnel/jsp/editClient.jsp index 7aef0ab31..2fcf487f5 100644 --- a/apps/i2ptunnel/jsp/editClient.jsp +++ b/apps/i2ptunnel/jsp/editClient.jsp @@ -19,9 +19,10 @@ <%=intl._("I2P Tunnel Manager - Edit Client Tunnel")%> + <% if (editBean.allowCSS()) { - %> + %> <% } diff --git a/apps/i2ptunnel/jsp/editServer.jsp b/apps/i2ptunnel/jsp/editServer.jsp index eb9e7a1b3..3b7e7b943 100644 --- a/apps/i2ptunnel/jsp/editServer.jsp +++ b/apps/i2ptunnel/jsp/editServer.jsp @@ -19,9 +19,10 @@ <%=intl._("I2P Tunnel Manager - Edit Server Tunnel")%> + <% if (editBean.allowCSS()) { - %> + %> <% } diff --git a/apps/i2ptunnel/jsp/index.jsp b/apps/i2ptunnel/jsp/index.jsp index 41adffc7a..a35826a5c 100644 --- a/apps/i2ptunnel/jsp/index.jsp +++ b/apps/i2ptunnel/jsp/index.jsp @@ -24,7 +24,8 @@ <% if (indexBean.allowCSS()) { - %> + %> + <% } %> diff --git a/apps/i2ptunnel/jsp/wizard.jsp b/apps/i2ptunnel/jsp/wizard.jsp index d9aeb3873..3adac32ea 100644 --- a/apps/i2ptunnel/jsp/wizard.jsp +++ b/apps/i2ptunnel/jsp/wizard.jsp @@ -57,7 +57,8 @@ <% if (editBean.allowCSS()) { - %> + %> + <% } %> diff --git a/apps/routerconsole/java/src/net/i2p/router/web/CSSHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/CSSHelper.java index 3dd724b08..130af3c9d 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/CSSHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/CSSHelper.java @@ -19,6 +19,8 @@ public class CSSHelper extends HelperBase { private static final String FORCE = "classic"; public static final String PROP_REFRESH = "routerconsole.summaryRefresh"; public static final String DEFAULT_REFRESH = "60"; + public static final int MIN_REFRESH = 3; + public static final String PROP_DISABLE_REFRESH = "routerconsole.summaryDisableRefresh"; private static final String PROP_XFRAME = "routerconsole.disableXFrame"; public String getTheme(String userAgent) { @@ -70,12 +72,42 @@ public class CSSHelper extends HelperBase { /** change refresh and save it */ public void setRefresh(String r) { + try { + if (Integer.parseInt(r) < MIN_REFRESH) + r = "" + MIN_REFRESH; + } catch (Exception e) { + } _context.router().saveConfig(PROP_REFRESH, r); } /** @return refresh time in seconds, as a string */ public String getRefresh() { - return _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH); + String r = _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH); + try { + if (Integer.parseInt(r) < MIN_REFRESH) + r = "" + MIN_REFRESH; + } catch (Exception e) { + } + return r; + } + + /** + * change disable refresh boolean and save it + * @since 0.9.1 + */ + public void setDisableRefresh(String r) { + String disableRefresh = "false"; + if ("0".equals(r)) + disableRefresh = "true"; + _context.router().saveConfig(PROP_DISABLE_REFRESH, disableRefresh); + } + + /** + * @return true if refresh is disabled + * @since 0.9.1 + */ + public boolean getDisableRefresh() { + return _context.getBooleanProperty(PROP_DISABLE_REFRESH); } /** translate the title and display consistently */ diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigNavHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigNavHelper.java index eb8d504bb..7a6b032c1 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigNavHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigNavHelper.java @@ -11,12 +11,12 @@ public class ConfigNavHelper extends HelperBase { /** configX.jsp */ private static final String pages[] = - {"", "net", "ui", "home", "service", "update", "tunnels", + {"", "net", "ui", "sidebar", "home", "service", "update", "tunnels", "clients", "peer", "keyring", "logging", "stats", "reseed", "advanced" }; private static final String titles[] = - {_x("Bandwidth"), _x("Network"), _x("UI"), _x("Home Page"), + {_x("Bandwidth"), _x("Network"), _x("UI"), _x("Summary Bar"), _x("Home Page"), _x("Service"), _x("Update"), _x("Tunnels"), _x("Clients"), _x("Peers"), _x("Keyring"), _x("Logging"), _x("Stats"), _x("Reseeding"), _x("Advanced") }; diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigSummaryHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigSummaryHandler.java new file mode 100644 index 000000000..7d5c26776 --- /dev/null +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigSummaryHandler.java @@ -0,0 +1,168 @@ +package net.i2p.router.web; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + +import net.i2p.data.DataHelper; + +/** + * Simple summary bar configuration. + * + * @since 0.9.1 + */ +public class ConfigSummaryHandler extends FormHandler { + + private Map _settings; + + @Override + protected void processForm() { + if (_action == null) return; + String group = getJettyString("group"); + boolean deleting = _action.equals(_("Delete selected")); + boolean adding = _action.equals(_("Add item")); + boolean saving = _action.equals(_("Save order")); + boolean moving = _action.startsWith("move_"); + if (_action.equals(_("Save")) && "0".equals(group)) { + try { + int refreshInterval = Integer.parseInt(getJettyString("refreshInterval")); + if (refreshInterval >= CSSHelper.MIN_REFRESH) { + _context.router().saveConfig(CSSHelper.PROP_REFRESH, "" + refreshInterval); + addFormNotice(_("Refresh interval changed")); + } else + addFormError(_("Refresh interval must be at least {0} seconds", CSSHelper.MIN_REFRESH)); + } catch (java.lang.NumberFormatException e) { + addFormError(_("Refresh interval must be a number")); + return; + } + } else if (_action.equals(_("Restore full default"))) { + _context.router().saveConfig(SummaryHelper.PROP_SUMMARYBAR + "default", SummaryHelper.DEFAULT_FULL); + addFormNotice(_("Full summary bar default restored.") + " " + + _("Summary bar will refresh shortly.")); + } else if (_action.equals(_("Restore minimal default"))) { + _context.router().saveConfig(SummaryHelper.PROP_SUMMARYBAR + "default", SummaryHelper.DEFAULT_MINIMAL); + addFormNotice(_("Minimal summary bar default restored.") + " " + + _("Summary bar will refresh shortly.")); + } else if (adding || deleting || saving || moving) { + Map sections = new TreeMap(); + for (Object o : _settings.keySet()) { + if (!(o instanceof String)) + continue; + String k = (String) o; + if (!k.startsWith("order_")) + continue; + String v = getJettyString(k); + k = k.substring(6); + k = k.substring(k.indexOf('_') + 1); + try { + int order = Integer.parseInt(v); + sections.put(order, k); + } catch (java.lang.NumberFormatException e) { + addFormError(_("Order must be an integer")); + return; + } + } + if (adding) { + String name = getJettyString("name"); + if (name == null || name.length() <= 0) { + addFormError(_("No section selected")); + return; + } + String order = getJettyString("order"); + if (order == null || order.length() <= 0) { + addFormError(_("No order entered")); + return; + } + name = DataHelper.escapeHTML(name).replace(",", ","); + order = DataHelper.escapeHTML(order).replace(",", ","); + try { + int ki = Integer.parseInt(order); + sections.put(ki, name); + addFormNotice(_("Added") + ": " + name); + } catch (java.lang.NumberFormatException e) { + addFormError(_("Order must be an integer")); + return; + } + } else if (deleting) { + Set toDelete = new HashSet(); + for (Object o : _settings.keySet()) { + if (!(o instanceof String)) + continue; + String k = (String) o; + if (!k.startsWith("delete_")) + continue; + k = k.substring(7); + try { + int ki = Integer.parseInt(k); + toDelete.add(ki); + } catch (java.lang.NumberFormatException e) { + continue; + } + } + for (Iterator iter = sections.keySet().iterator(); iter.hasNext(); ) { + int i = iter.next(); + if (toDelete.contains(i)) { + String removedName = sections.get(i); + iter.remove(); + addFormNotice(_("Removed") + ": " + removedName); + } + } + } else if (moving) { + String parts[] = _action.split("_"); + try { + int from = Integer.parseInt(parts[1]); + int to = 0; + if ("up".equals(parts[2])) + to = from - 1; + if ("down".equals(parts[2])) + to = from + 1; + if ("bottom".equals(parts[2])) + to = sections.size() - 1; + int n = -1; + if ("down".equals(parts[2]) || "bottom".equals(parts[2])) + n = 1; + for (int i = from; n * i < n * to; i += n) { + String temp = sections.get(i + n); + sections.put(i + n, sections.get(i)); + sections.put(i, temp); + } + addFormNotice(_("Moved") + ": " + sections.get(to)); + } catch (java.lang.NumberFormatException e) { + addFormError(_("Order must be an integer")); + return; + } + } + SummaryHelper.saveSummaryBarSections(_context, "default", sections); + addFormNotice(_("Saved order of sections.") + " " + + _("Summary bar will refresh shortly.")); + } else { + addFormError(_("Unsupported")); + } + } + + public void setSettings(Map settings) { _settings = new HashMap(settings); } + + /** curses Jetty for returning arrays */ + private String getJettyString(String key) { + String[] arr = (String[]) _settings.get(key); + if (arr == null) + return null; + return arr[0].trim(); + } + + public void setMovingAction() { + for (Object o : _settings.keySet()) { + if (!(o instanceof String)) + continue; + String k = (String) o; + if (k.startsWith("move_") && k.endsWith(".x") && _settings.get(k) != null) { + _action = k.substring(0, k.length() - 2); + break; + } + } + } +} diff --git a/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java index b5d54b411..515171e33 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java @@ -191,7 +191,8 @@ public class GraphHelper extends FormHandler { } // FIXME jrobin doesn't support setting the timezone, will have to mod TimeAxis.java - _out.write("

" + _("All times are UTC.") + "

\n"); + // 0.9.1 - all graphs currently state UTC on them, so this text blurb is unnecessary, + //_out.write("

" + _("All times are UTC.") + "

\n"); } catch (IOException ioe) { ioe.printStackTrace(); } diff --git a/apps/routerconsole/java/src/net/i2p/router/web/HomeHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/HomeHelper.java index 8de58ab32..994e4806c 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/HomeHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/HomeHelper.java @@ -24,14 +24,14 @@ public class HomeHelper extends HelperBase { private static final String PROP_SEARCH = "routerconsole.showSearch"; static final String DEFAULT_SERVICES = - _x("Addressbook") + S + _x("Manage your I2P hosts file here (I2P domain name resolution)") + S + "/susidns/index" + S + I + "book_addresses.png" + S + + _x("Addressbook") + S + _x("Manage your I2P hosts file here (I2P domain name resolution)") + S + "/dns" + S + I + "book_addresses.png" + S + _x("Configure Bandwidth") + S + _x("I2P Bandwidth Configuration") + S + "/config" + S + I + "wrench_orange.png" + S + _x("Configure Language") + S + _x("Console Language Selection") + S + "/configui" + S + I + "wrench_orange.png" + S + _x("Customize Home Page") + S + _x("I2P Home Page Configuration") + S + "/confighome" + S + I + "wrench_orange.png" + S + - _x("Email") + S + _x("Anonymous webmail client") + S + "/susimail/susimail" + S + I + "email.png" + S + + _x("Email") + S + _x("Anonymous webmail client") + S + "/webmail" + S + I + "email.png" + S + _x("Help") + S + _x("I2P Router Help") + S + "/help" + S + I + "help.png" + S + _x("Router Console") + S + _x("I2P Router Console") + S + "/console" + S + I + "wrench_orange.png" + S + - _x("Torrents") + S + _x("Built-in anonymous BitTorrent Client") + S + "/i2psnark/" + S + I + "film.png" + S + + _x("Torrents") + S + _x("Built-in anonymous BitTorrent Client") + S + "/torrents" + S + I + "film.png" + S + _x("Website") + S + _x("Local web server") + S + "http://127.0.0.1:7658/" + S + I + "server.png" + S + ""; diff --git a/apps/routerconsole/java/src/net/i2p/router/web/NewsHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/NewsHelper.java index 709c4505f..d5d702e8f 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/NewsHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/NewsHelper.java @@ -16,7 +16,7 @@ public class NewsHelper extends ContentHelper { if (!news.exists()) _page = (new File(_context.getBaseDir(), "docs/initialNews/initialNews.xml")).getAbsolutePath(); return super.getContent(); - } + } /** @since 0.8.12 */ public boolean shouldShowNews() { diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java index a61e543cc..6327033c9 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java @@ -3,6 +3,10 @@ package net.i2p.router.web; import java.io.File; import java.io.IOException; import java.io.Writer; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import net.i2p.data.DataHelper; import net.i2p.router.RouterContext; @@ -12,6 +16,36 @@ import net.i2p.router.RouterContext; * */ public class SummaryBarRenderer { + // Commented out because broken. Replaced by if-elseif blob below. + /*static final Map ALL_SECTIONS; + static { + Map aMap = new HashMap();; + try { + aMap.put("HelpAndFAQ", SummaryBarRenderer.class.getMethod("renderHelpAndFAQHTML")); + aMap.put("I2PServices", SummaryBarRenderer.class.getMethod("renderI2PServicesHTML")); + aMap.put("I2PInternals", SummaryBarRenderer.class.getMethod("renderI2PInternalsHTML")); + aMap.put("General", SummaryBarRenderer.class.getMethod("renderGeneralHTML")); + aMap.put("ShortGeneral", SummaryBarRenderer.class.getMethod("renderShortGeneralHTML")); + aMap.put("NetworkReachability", SummaryBarRenderer.class.getMethod("renderNetworkReachabilityHTML")); + aMap.put("UpdateStatus", SummaryBarRenderer.class.getMethod("renderUpdateStatusHTML")); + aMap.put("RestartStatus", SummaryBarRenderer.class.getMethod("renderRestartStatusHTMLHTML")); + aMap.put("Peers", SummaryBarRenderer.class.getMethod("renderPeersHTML")); + aMap.put("FirewallAndReseedStatus", SummaryBarRenderer.class.getMethod("renderFirewallAndReseedStatusHTML")); + aMap.put("Bandwidth", SummaryBarRenderer.class.getMethod("renderBandwidthHTML")); + aMap.put("Tunnels", SummaryBarRenderer.class.getMethod("renderTunnelsHTML")); + aMap.put("Congestion", SummaryBarRenderer.class.getMethod("renderCongestionHTML")); + aMap.put("TunnelStatus", SummaryBarRenderer.class.getMethod("renderTunnelStatusHTML")); + aMap.put("Destinations", SummaryBarRenderer.class.getMethod("renderDestinationsHTML")); + aMap.put("NewsHeadings", SummaryBarRenderer.class.getMethod("renderNewsHeadingsHTML")); + } catch (java.lang.NoSuchMethodException e) { + } + ALL_SECTIONS = Collections.unmodifiableMap(aMap); + }*/ + static final String ALL_SECTIONS[] = + {"HelpAndFAQ", "I2PServices", "I2PInternals", "General", "ShortGeneral", "NetworkReachability", + "UpdateStatus", "RestartStatus", "Peers", "FirewallAndReseedStatus", "Bandwidth", "Tunnels", + "Congestion", "TunnelStatus", "Destinations", "NewsHeadings" }; + private final RouterContext _context; private final SummaryHelper _helper; @@ -25,155 +59,199 @@ public class SummaryBarRenderer { * on lower-level directory errors. */ public void renderSummaryHTML(Writer out) throws IOException { + String requestURI = _helper.getRequestURI(); + String page = requestURI.replace("/", "").replace(".jsp", ""); + List sections = _helper.getSummaryBarSections(page); StringBuilder buf = new StringBuilder(8*1024); - String theme = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME); - - // TODO - the bar would render more cleanly if we specified the img height and width here, - // but unfortunately the images in the different themes are different sizes. - // They range in height from 37 to 43 px. But there's a -2 bottom margin... - // So put it in a div. - buf.append("
\"")

") - - .append("

" + i + "
\n" + section); + } + } catch (Exception e) { + out.write("
" +i + " - Exception
\n" + e); + }*/ + buf.setLength(0); + + buf.append("
\n"); + if ("HelpAndFAQ".equals(section)) + buf.append(renderHelpAndFAQHTML()); + else if ("I2PServices".equals(section)) + buf.append(renderI2PServicesHTML()); + else if ("I2PInternals".equals(section)) + buf.append(renderI2PInternalsHTML()); + else if ("General".equals(section)) + buf.append(renderGeneralHTML()); + else if ("ShortGeneral".equals(section)) + buf.append(renderShortGeneralHTML()); + else if ("NetworkReachability".equals(section)) + buf.append(renderNetworkReachabilityHTML()); + else if ("UpdateStatus".equals(section)) + buf.append(renderUpdateStatusHTML()); + else if ("RestartStatus".equals(section)) + buf.append(renderRestartStatusHTML()); + else if ("Peers".equals(section)) + buf.append(renderPeersHTML()); + else if ("FirewallAndReseedStatus".equals(section)) + buf.append(renderFirewallAndReseedStatusHTML()); + else if ("Bandwidth".equals(section)) + buf.append(renderBandwidthHTML()); + else if ("Tunnels".equals(section)) + buf.append(renderTunnelsHTML()); + else if ("Congestion".equals(section)) + buf.append(renderCongestionHTML()); + else if ("TunnelStatus".equals(section)) + buf.append(renderTunnelStatusHTML()); + else if ("Destinations".equals(section)) + buf.append(renderDestinationsHTML()); + else if ("NewsHeadings".equals(section)) + buf.append(renderNewsHeadingsHTML()); + + // Only output section if there's more than the
to print + if (buf.length() > 5) + out.write(buf.toString()); + } + } + + public String renderHelpAndFAQHTML() { + StringBuilder buf = new StringBuilder(512); + buf.append("

") .append(_("Help & FAQ")) - .append("


"); + .append("

"); + return buf.toString(); + } - File lpath = new File(_context.getBaseDir(), "docs/toolbar.html"); - // you better have target="_top" for the links in there... - if (lpath.exists()) { - ContentHelper linkhelper = new ContentHelper(); - linkhelper.setPage(lpath.getAbsolutePath()); - linkhelper.setMaxLines("100"); - buf.append(linkhelper.getContent()); - } else { - buf.append("

") - .append(_("I2P Services")) - .append("

\n" + + public String renderI2PServicesHTML() { + StringBuilder buf = new StringBuilder(512); + buf.append("

") + .append(_("I2P Services")) + .append("

\n" + - "
" + + "
" + - "") - .append(_("Email")) - .append("\n" + + "") + .append(_("Email")) + .append("\n" + - "") - .append(_("Torrents")) - .append("\n" + + "") + .append(_("Torrents")) + .append("\n" + - "") - .append(_("Website")) - .append("\n") + "") + .append(_("Website")) + .append("\n") - .append(NavHelper.getClientAppLinks(_context)) + .append(NavHelper.getClientAppLinks(_context)) - .append("
\n" + + .append("
\n"); + return buf.toString(); + } - "

") - .append(_("I2P Internals")) - .append("


\n" + + public String renderI2PInternalsHTML() { + StringBuilder buf = new StringBuilder(512); + buf.append("

") + .append(_("I2P Internals")) + .append("


\n" + - "
\n" + + "
\n" + - "") - .append(_("Tunnels")) - .append("\n" + + "") + .append(_("Tunnels")) + .append("\n" + - "") - .append(_("Peers")) - .append("\n" + + "") + .append(_("Peers")) + .append("\n" + - "") - .append(_("Profiles")) - .append("\n" + + "") + .append(_("Profiles")) + .append("\n" + - "") - .append(_("NetDB")) - .append("\n" + + "") + .append(_("NetDB")) + .append("\n" + - "") - .append(_("Logs")) - .append("\n"); + "") + .append(_("Logs")) + .append("\n"); - // "") - // .append(_("Jobs")) - // .append("\n" + + // "") + // .append(_("Jobs")) + // .append("\n" + - if (!StatSummarizer.isDisabled()) { - buf.append("") .append(_("Graphs")) .append("\n"); - } - - buf.append("") - .append(_("Stats")) - .append("\n" + - - "") - .append(_("I2PTunnel")) - .append("\n" + - - "") - .append(_("Addressbook")) - .append("\n"); - - File javadoc = new File(_context.getBaseDir(), "docs/javadoc/index.html"); - if (javadoc.exists()) - buf.append("Javadoc\n"); - buf.append("
\n"); - - out.write(buf.toString()); - buf.setLength(0); } + buf.append("") + .append(_("Stats")) + .append("\n" + + "") + .append(_("I2PTunnel")) + .append("\n" + - buf.append("

") + .append(_("Addressbook")) + .append("\n"); + + File javadoc = new File(_context.getBaseDir(), "docs/javadoc/index.html"); + if (javadoc.exists()) + buf.append("Javadoc\n"); + buf.append("

\n"); + return buf.toString(); + } + + public String renderGeneralHTML() { + if (_helper == null) return ""; + StringBuilder buf = new StringBuilder(512); + buf.append("

") .append(_("General")) .append("


\n" + "" + - "" + "\n" + - "" + + "" + "" + "
") + "") .append(_("Local Identity")) .append(":" + @@ -187,7 +265,10 @@ public class SummaryBarRenderer { .append(_("show")) .append("
") + "
") .append(_("Version")) .append(":") @@ -202,24 +283,74 @@ public class SummaryBarRenderer { .append(":") .append(_helper.getUptime()) - .append("
\n" + + .append("\n"); + return buf.toString(); + } - "

" + + "" + + "") + .append(_("Version")) + .append(":" + + "") + .append(_helper.getVersion()) + .append("\n" + + + "" + + "") + .append(_("Uptime")) + .append(":" + + "") + .append(_helper.getUptime()) + .append("\n"); + return buf.toString(); + } + + public String renderNetworkReachabilityHTML() { + if (_helper == null) return ""; + StringBuilder buf = new StringBuilder(512); + buf.append("

") .append(_("Network")) .append(": ") .append(_helper.getReachability()) - .append("


\n") + .append("

\n"); + return buf.toString(); + } + public String renderUpdateStatusHTML() { + if (_helper == null) return ""; + String updateStatus = _helper.getUpdateStatus(); + if ("".equals(updateStatus)) return ""; + StringBuilder buf = new StringBuilder(512); + buf.append("

") + .append(_("I2P Update")) + .append("


\n"); + buf.append(updateStatus); + return buf.toString(); + } - .append(_helper.getUpdateStatus()) + public String renderRestartStatusHTML() { + if (_helper == null) return ""; + StringBuilder buf = new StringBuilder(512); + buf.append(_helper.getRestartStatus()); + return buf.toString(); + } - - .append(_helper.getRestartStatus()) - - - .append("

") .append(_("Peers")) @@ -227,7 +358,10 @@ public class SummaryBarRenderer { "\n" + - "" + + "\n" + - "" + + "\n" + - "" + + "\n" + - "" + + "\n" + - "" + + "\n" + - "
") + "
") .append(_("Active")) .append(":"); int active = _helper.getActivePeers(); @@ -236,38 +370,56 @@ public class SummaryBarRenderer { .append(Math.max(active, _helper.getActiveProfiles())) .append("
") + "
") .append(_("Fast")) .append(":") .append(_helper.getFastPeers()) .append("
") + "
") .append(_("High capacity")) .append(":") .append(_helper.getHighCapacityPeers()) .append("
") + "
") .append(_("Integrated")) .append(":") .append(_helper.getWellIntegratedPeers()) .append("
") + "
") .append(_("Known")) .append(":") .append(_helper.getAllPeers()) .append("

\n"); - - - out.write(buf.toString()); - buf.setLength(0); + "\n"); + return buf.toString(); + } + public String renderFirewallAndReseedStatusHTML() { + if (_helper == null) return ""; + StringBuilder buf = new StringBuilder(512); buf.append(_helper.getFirewallAndReseedStatus()); + return buf.toString(); + } + public String renderBandwidthHTML() { + if (_helper == null) return ""; + StringBuilder buf = new StringBuilder(512); buf.append("

") @@ -303,82 +455,181 @@ public class SummaryBarRenderer { .append(_helper.getInboundTransferred()) .append(SummaryHelper.THINSP) .append(_helper.getOutboundTransferred()) - .append("\n" + + .append("\n" + - "

\n"); + return buf.toString(); + } + + public String renderTunnelsHTML() { + if (_helper == null) return ""; + StringBuilder buf = new StringBuilder(512); + buf.append("

") .append(_("Tunnels")) .append("


" + "\n" + - "" + + "\n" + - "" + + "\n" + - "" + + "\n" + - "" + + "\n" + - "
") + "
") .append(_("Exploratory")) .append(":") .append(_helper.getInboundTunnels() + _helper.getOutboundTunnels()) .append("
") + "
") .append(_("Client")) .append(":") .append(_helper.getInboundClientTunnels() + _helper.getOutboundClientTunnels()) .append("
") + "
") .append(_("Participating")) .append(":") .append(_helper.getParticipatingTunnels()) .append("
") + "
") .append(_("Share ratio")) .append(":") .append(_helper.getShareRatio()) .append("

\n"); + return buf.toString(); + } + + public String renderCongestionHTML() { + if (_helper == null) return ""; + StringBuilder buf = new StringBuilder(512); + buf.append("

") .append(_("Congestion")) .append("


" + "\n" + - "" + + "\n" + - "" + + "\n"); if (!_context.getBooleanPropertyDefaultTrue("router.disableTunnelTesting")) { - buf.append("" + + "\n"); } - buf.append("" + + "\n" + - "
") + "
") .append(_("Job lag")) .append(":") .append(_helper.getJobLag()) .append("
") + "
") .append(_("Message delay")) .append(":") .append(_helper.getMessageDelay()) .append("
") + buf.append("
") .append(_("Tunnel lag")) .append(":") .append(_helper.getTunnelLag()) .append("
") + buf.append("
") .append(_("Backlog")) .append(":") .append(_helper.getInboundBacklog()) .append("

") + "\n"); + return buf.toString(); + } + + public String renderTunnelStatusHTML() { + if (_helper == null) return ""; + StringBuilder buf = new StringBuilder(50); + buf.append("

") .append(_(_helper.getTunnelStatus())) - .append("


\n") + .append("

\n"); + return buf.toString(); + } - .append(_helper.getDestinations()) - .append("
\n"); + public String renderDestinationsHTML() { + if (_helper == null) return ""; + StringBuilder buf = new StringBuilder(512); + buf.append(_helper.getDestinations()); + return buf.toString(); + } - - - out.write(buf.toString()); + /** @since 0.9.1 */ + public String renderNewsHeadingsHTML() { + if (_helper == null) return ""; + NewsHelper newshelper = _helper.getNewsHelper(); + if (newshelper == null || newshelper.shouldShowNews()) return ""; + StringBuilder buf = new StringBuilder(512); + String consoleNonce = System.getProperty("router.consoleNonce"); + if (consoleNonce != null) { + // Set up title and pre-headings stuff. + buf.append("

") + .append(_("News & Updates")) + .append("


\n"); + // Get news content. + String newsContent = newshelper.getContent(); + if (newsContent != "") { + buf.append("
    \n"); + // Parse news content for headings. + int start = newsContent.indexOf("

    "); + while (start >= 0) { + // Add offset to start: + // 4 - gets rid of

    + // 16 - gets rid of the date as well (assuming form "

    yyyy-mm-dd: Foobarbaz...") + newsContent = newsContent.substring(start+16, newsContent.length()); + int end = newsContent.indexOf("

    "); + if (end >= 0) { + String heading = newsContent.substring(0, end); + buf.append("
  • ") + .append(heading) + .append("
  • \n"); + } + start = newsContent.indexOf("

    "); + } + buf.append("

\n"); + // Set up string containing to show news. + String requestURI = _helper.getRequestURI(); + if (requestURI.contains("/home")) { + buf.append("") + .append(_("Show news")) + .append("\n"); + } + } else { + buf.append("
") + .append(_("none")) + .append("
"); + } + // Add post-headings stuff. + buf.append("
\n"); + } + return buf.toString(); } /** translate a string */ diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java index 4e7d2f23f..b5d796041 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java @@ -4,10 +4,13 @@ import java.io.IOException; import java.text.Collator; import java.text.DecimalFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; +import java.util.Map; +import java.util.TreeSet; import net.i2p.data.DataHelper; import net.i2p.data.Destination; @@ -17,6 +20,7 @@ import net.i2p.data.RouterAddress; import net.i2p.data.RouterInfo; import net.i2p.router.CommSystemFacade; import net.i2p.router.Router; +import net.i2p.router.RouterContext; import net.i2p.router.RouterVersion; import net.i2p.router.TunnelPoolSettings; import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade; @@ -35,6 +39,35 @@ public class SummaryHelper extends HelperBase { // Opera 10.63 doesn't have the char, TODO check UA //static final String THINSP = " / "; static final String THINSP = " / "; + private static final char S = ','; + static final String PROP_SUMMARYBAR = "routerconsole.summaryBar."; + + static final String DEFAULT_FULL = + "HelpAndFAQ" + S + + "I2PServices" + S + + "I2PInternals" + S + + "General" + S + + "NetworkReachability" + S + + "UpdateStatus" + S + + "RestartStatus" + S + + "Peers" + S + + "FirewallAndReseedStatus" + S + + "Bandwidth" + S + + "Tunnels" + S + + "Congestion" + S + + "TunnelStatus" + S + + "Destinations" + S + + ""; + + static final String DEFAULT_MINIMAL = + "ShortGeneral" + S + + "NewsHeadings" + S + + "UpdateStatus" + S + + "NetworkReachability" + S + + "FirewallAndReseedStatus" + S + + "Destinations" + S + + "RestartStatus" + S + + ""; /** * Retrieve the shortened 4 character ident for the router located within @@ -375,7 +408,7 @@ public class SummaryHelper extends HelperBase { List clients = new ArrayList(_context.clientManager().listClients()); StringBuilder buf = new StringBuilder(512); - buf.append("

").append(_("Local Destinations")).append("


"); + buf.append("

").append(_("Local Destinations")).append("


"); if (!clients.isEmpty()) { Collections.sort(clients, new AlphaComparator()); buf.append(""); @@ -618,7 +651,7 @@ public class SummaryHelper extends HelperBase { // display all the time so we display the final failure message, and plugin update messages too String status = UpdateHandler.getStatus(); if (status.length() > 0) { - buf.append("

").append(status).append("


\n"); + buf.append("

").append(status).append("

\n"); } if (updateAvailable() || unsignedUpdateAvailable()) { if ("true".equals(System.getProperty(UpdateHandler.PROP_UPDATE_IN_PROGRESS))) { @@ -706,10 +739,31 @@ public class SummaryHelper extends HelperBase { } if (buf.length() <= 0) return ""; - buf.append("
"); return buf.toString(); } + private NewsHelper _newshelper; + public void storeNewsHelper(NewsHelper n) { _newshelper = n; } + public NewsHelper getNewsHelper() { return _newshelper; } + + public List getSummaryBarSections(String page) { + String config = ""; + if ("home".equals(page)) + config = _context.getProperty(PROP_SUMMARYBAR + page, DEFAULT_MINIMAL); + else + config = _context.getProperty(PROP_SUMMARYBAR + page, null); + if (config == null) + config = _context.getProperty(PROP_SUMMARYBAR + "default", DEFAULT_FULL); + return Arrays.asList(config.split("" + S)); + } + + static void saveSummaryBarSections(RouterContext ctx, String page, Map sections) { + StringBuilder buf = new StringBuilder(512); + for(String section : sections.values()) + buf.append(section).append(S); + ctx.router().saveConfig(PROP_SUMMARYBAR + page, buf.toString()); + } + /** output the summary bar to _out */ public void renderSummaryBar() throws IOException { SummaryBarRenderer renderer = new SummaryBarRenderer(_context, this); @@ -733,4 +787,91 @@ public class SummaryHelper extends HelperBase { private String _requestURI; public void setRequestURI(String s) { _requestURI = s; } public String getRequestURI() { return _requestURI; } + + public String getConfigTable() { + String[] allSections = SummaryBarRenderer.ALL_SECTIONS; + List sections = getSummaryBarSections("default"); + TreeSet sortedSections = new TreeSet(); + + for (int i = 0; i < allSections.length; i++) { + String section = allSections[i]; + if (!sections.contains(section)) + sortedSections.add(section); + } + + String theme = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME); + String imgPath = CSSHelper.BASE_THEME_PATH + theme + "/images/"; + + StringBuilder buf = new StringBuilder(2048); + buf.append("
\n"); + for (String section : sections) { + int i = sections.indexOf(section); + buf.append("\n"); + } + buf.append("" + + "") + .append("
") + .append(_("Remove")) + .append("") + .append(_("Name")) + .append("") + .append(_("Order")) + .append("
") + .append(section) + .append(""); + if (i > 0) { + buf.append(""); + buf.append(""); + } + buf.append(""); + if (i < sections.size() - 1) { + buf.append(""); + buf.append(""); + } + buf.append("
" + + "") + .append(_("Add")).append(": " + + "\n" + + "" + + "
\n"); + return buf.toString(); + } } diff --git a/apps/routerconsole/java/src/net/i2p/router/web/UpdateHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/UpdateHandler.java index c7a1f695f..1492f3bb1 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/UpdateHandler.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/UpdateHandler.java @@ -237,14 +237,16 @@ public class UpdateHandler { if (_isPartial) return; StringBuilder buf = new StringBuilder(64); - buf.append("").append(_("Updating")).append(" "); double pct = ((double)alreadyTransferred + (double)currentWrite) / ((double)alreadyTransferred + (double)currentWrite + bytesRemaining); synchronized (_pct) { - buf.append(_pct.format(pct)); + buf.append(_("{0} downloaded", _pct.format(pct))); } - buf.append(":
\n"); - buf.append(_("{0}B transferred", DataHelper.formatSize2(currentWrite + alreadyTransferred))); + buf.append("
\n"); + buf.append(DataHelper.formatSize2(currentWrite + alreadyTransferred)) + .append("B / ") + .append(DataHelper.formatSize2(currentWrite + alreadyTransferred + bytesRemaining)) + .append("B"); updateStatus(buf.toString()); } public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified) { diff --git a/apps/routerconsole/jsp/config.jsp b/apps/routerconsole/jsp/config.jsp index 70c0e64f0..7307dc355 100644 --- a/apps/routerconsole/jsp/config.jsp +++ b/apps/routerconsole/jsp/config.jsp @@ -6,7 +6,13 @@ <%@include file="css.jsi" %> <%=intl.title("configure bandwidth")%> - + + + <%@include file="summary.jsi" %> diff --git a/apps/routerconsole/jsp/configadvanced.jsp b/apps/routerconsole/jsp/configadvanced.jsp index 1dbf23e7d..d684ddccc 100644 --- a/apps/routerconsole/jsp/configadvanced.jsp +++ b/apps/routerconsole/jsp/configadvanced.jsp @@ -6,7 +6,13 @@ <%@include file="css.jsi" %> <%=intl.title("config advanced")%> - + + + <%@include file="summary.jsi" %> diff --git a/apps/routerconsole/jsp/configclients.jsp b/apps/routerconsole/jsp/configclients.jsp index c8575b490..397773e4b 100644 --- a/apps/routerconsole/jsp/configclients.jsp +++ b/apps/routerconsole/jsp/configclients.jsp @@ -10,7 +10,14 @@ button span.hide{ display:none; } input.default { width: 1px; height: 1px; visibility: hidden; } - + + + + <%@include file="summary.jsi" %> diff --git a/apps/routerconsole/jsp/confighome.jsp b/apps/routerconsole/jsp/confighome.jsp index ca0dbdc6c..7a4379f47 100644 --- a/apps/routerconsole/jsp/confighome.jsp +++ b/apps/routerconsole/jsp/confighome.jsp @@ -12,7 +12,13 @@ input.default { visibility: hidden; } - + + + <%@include file="summary.jsi" %>

<%=intl._("I2P Home Page Configuration")%>

diff --git a/apps/routerconsole/jsp/configkeyring.jsp b/apps/routerconsole/jsp/configkeyring.jsp index 7acdf1126..612e6c590 100644 --- a/apps/routerconsole/jsp/configkeyring.jsp +++ b/apps/routerconsole/jsp/configkeyring.jsp @@ -5,7 +5,13 @@ <%@include file="css.jsi" %> <%=intl.title("config keyring")%> - + + + <%@include file="summary.jsi" %>

<%=intl._("I2P Keyring Configuration")%>

diff --git a/apps/routerconsole/jsp/configlogging.jsp b/apps/routerconsole/jsp/configlogging.jsp index 8274fcb43..77da61dc8 100644 --- a/apps/routerconsole/jsp/configlogging.jsp +++ b/apps/routerconsole/jsp/configlogging.jsp @@ -6,7 +6,13 @@ <%@include file="css.jsi" %> <%=intl.title("config logging")%> - + + + " /> diff --git a/apps/routerconsole/jsp/confignet.jsp b/apps/routerconsole/jsp/confignet.jsp index 6e340a659..134460eb4 100644 --- a/apps/routerconsole/jsp/confignet.jsp +++ b/apps/routerconsole/jsp/confignet.jsp @@ -5,7 +5,13 @@ <%@include file="css.jsi" %> <%=intl.title("config networking")%> - + + + <%@include file="summary.jsi" %> diff --git a/apps/routerconsole/jsp/configpeer.jsp b/apps/routerconsole/jsp/configpeer.jsp index b5968abed..3e98487b8 100644 --- a/apps/routerconsole/jsp/configpeer.jsp +++ b/apps/routerconsole/jsp/configpeer.jsp @@ -5,7 +5,13 @@ <%@include file="css.jsi" %> <%=intl.title("config peers")%> - + + + <%@include file="summary.jsi" %>

<%=intl._("I2P Peer Configuration")%>

diff --git a/apps/routerconsole/jsp/configreseed.jsp b/apps/routerconsole/jsp/configreseed.jsp index 67d2334c9..88c8f46a1 100644 --- a/apps/routerconsole/jsp/configreseed.jsp +++ b/apps/routerconsole/jsp/configreseed.jsp @@ -5,7 +5,13 @@ <%@include file="css.jsi" %> <%=intl.title("config reseeding")%> - + + + <%@include file="summary.jsi" %> diff --git a/apps/routerconsole/jsp/configservice.jsp b/apps/routerconsole/jsp/configservice.jsp index 3ee1ef796..7a5ea2e33 100644 --- a/apps/routerconsole/jsp/configservice.jsp +++ b/apps/routerconsole/jsp/configservice.jsp @@ -5,7 +5,13 @@ <%@include file="css.jsi" %> <%=intl.title("config service")%> - + + + <%@include file="summary.jsi" %>

<%=intl._("I2P Service Configuration")%>

diff --git a/apps/routerconsole/jsp/configsidebar.jsp b/apps/routerconsole/jsp/configsidebar.jsp new file mode 100644 index 000000000..4fe7ef3ec --- /dev/null +++ b/apps/routerconsole/jsp/configsidebar.jsp @@ -0,0 +1,62 @@ +<%@page contentType="text/html"%> +<%@page pageEncoding="UTF-8"%> + + + +<%@include file="css.jsi" %> +<%=intl.title("config summary bar")%> + + + + + +<%@include file="summary.jsi" %> +

<%=intl._("I2P Summary Bar Configuration")%>

+
+<%@include file="confignav.jsi" %> + + +<% formhandler.storeMethod(request.getMethod()); %> + +" /> + +<% + formhandler.setMovingAction(); +%> + +<% + String pageNonce = formhandler.getNewNonce(); +%> + +" /> + +

<%=intl._("Refresh Interval")%>

+
+ + + " > + <%=intl._("seconds")%> + " > +
+ +

<%=intl._("Customise Summary Bar")%>

+
+ + + +
+ " > + " > +
+ +
diff --git a/apps/routerconsole/jsp/configstats.jsp b/apps/routerconsole/jsp/configstats.jsp index d380d7783..9ba18c3d9 100644 --- a/apps/routerconsole/jsp/configstats.jsp +++ b/apps/routerconsole/jsp/configstats.jsp @@ -6,10 +6,17 @@ <%@include file="css.jsi" %> <%=intl.title("config stats")%> + + + + <%@include file="summary.jsi" %> diff --git a/apps/routerconsole/jsp/configui.jsp b/apps/routerconsole/jsp/configui.jsp index 4a214c852..886151087 100644 --- a/apps/routerconsole/jsp/configui.jsp +++ b/apps/routerconsole/jsp/configui.jsp @@ -6,7 +6,13 @@ <%@include file="css.jsi" %> <%=intl.title("config UI")%> - + + + <%@include file="summary.jsi" %> diff --git a/apps/routerconsole/jsp/configupdate.jsp b/apps/routerconsole/jsp/configupdate.jsp index e2bd49ab2..2cad3ec6a 100644 --- a/apps/routerconsole/jsp/configupdate.jsp +++ b/apps/routerconsole/jsp/configupdate.jsp @@ -6,7 +6,13 @@ <%@include file="css.jsi" %> <%=intl.title("config update")%> - + + + <%@include file="summary.jsi" %>

<%=intl._("I2P Update Configuration")%>

diff --git a/apps/routerconsole/jsp/console.jsp b/apps/routerconsole/jsp/console.jsp index 15d3a5272..cc0156b13 100644 --- a/apps/routerconsole/jsp/console.jsp +++ b/apps/routerconsole/jsp/console.jsp @@ -6,7 +6,13 @@ <%@include file="css.jsi" %> <%=intl.title("home")%> - + + + <% String consoleNonce = System.getProperty("router.consoleNonce"); if (consoleNonce == null) { @@ -15,16 +21,13 @@ } %> -<%@include file="summary.jsi" %>

<%=intl._("I2P Router Console")%>

+<%@include file="summary.jsi" %> + +

<%=intl._("I2P Router Console")%>

- - " /> <% if (newshelper.shouldShowNews()) { - java.io.File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml"); %> - -
<% diff --git a/apps/routerconsole/jsp/css.jsi b/apps/routerconsole/jsp/css.jsi index 434b67cae..f37b6a0c8 100644 --- a/apps/routerconsole/jsp/css.jsi +++ b/apps/routerconsole/jsp/css.jsi @@ -28,6 +28,7 @@ " /> +images/favicon.ico"> <% // clickjacking if (intl.shouldSendXFrame()) diff --git a/apps/routerconsole/jsp/debug.jsp b/apps/routerconsole/jsp/debug.jsp index b9e66345f..609308fd5 100644 --- a/apps/routerconsole/jsp/debug.jsp +++ b/apps/routerconsole/jsp/debug.jsp @@ -9,7 +9,13 @@ %> I2P Router Console - Debug <%@include file="css.jsi" %> - + + + <%@include file="summary.jsi" %>

Router SKM

diff --git a/apps/routerconsole/jsp/dns.jsp b/apps/routerconsole/jsp/dns.jsp new file mode 100644 index 000000000..ab29f4008 --- /dev/null +++ b/apps/routerconsole/jsp/dns.jsp @@ -0,0 +1,78 @@ +<%@page contentType="text/html"%> +<%@page trimDirectiveWhitespaces="true"%> +<%@page pageEncoding="UTF-8"%> + +" /> +<% + // CSSHelper is also pulled in by css.jsi below... + boolean testIFrame = tester.allowIFrame(request.getHeader("User-Agent")); + if (!testIFrame) { + response.setStatus(302, "Moved"); + response.setHeader("Location", "/susidns/index"); + } else { +%> + + + +<%@include file="css.jsi" %> +<%=intl.title("addressbook")%> + + + + +<%@include file="summary.jsi" %> + +

<%=intl._("I2P Addressbook")%> ">images/newtab.png" />

+
+ +
+<% + } +%> diff --git a/apps/routerconsole/jsp/error.jsp b/apps/routerconsole/jsp/error.jsp index 69f9fbfa3..630da0851 100644 --- a/apps/routerconsole/jsp/error.jsp +++ b/apps/routerconsole/jsp/error.jsp @@ -16,10 +16,16 @@ <%@include file="css.jsi" %> <%=intl.title("Page Not Found")%> - + + + <%@include file="summary.jsi" %> -

<%=ERROR_CODE%> <%=ERROR_MESSAGE%>

+

<%=ERROR_CODE%> <%=ERROR_MESSAGE%>

<%=intl._("Sorry! You appear to be requesting a non-existent Router Console page or resource.")%>
-<%=intl._("Error 404")%>: <%=ERROR_URI%> <%=intl._("not found")%>. +<%=intl._("Error 404")%>: <%=ERROR_URI%> <%=intl._("not found")%>.
diff --git a/apps/routerconsole/jsp/graph.jsp b/apps/routerconsole/jsp/graph.jsp index 6147fd96d..487f91fd6 100644 --- a/apps/routerconsole/jsp/graph.jsp +++ b/apps/routerconsole/jsp/graph.jsp @@ -12,7 +12,13 @@ <% graphHelper.storeWriter(out); %> - + + + <%@include file="summary.jsi" %>

<%=intl._("I2P Performance Graphs")%>

diff --git a/apps/routerconsole/jsp/graphs.jsp b/apps/routerconsole/jsp/graphs.jsp index 4b65cca75..e78720012 100644 --- a/apps/routerconsole/jsp/graphs.jsp +++ b/apps/routerconsole/jsp/graphs.jsp @@ -19,7 +19,13 @@ out.print(graphHelper.getRefreshMeta()); } %> - + + + <%@include file="summary.jsi" %>

<%=intl._("I2P Performance Graphs")%>

diff --git a/apps/routerconsole/jsp/help.jsp b/apps/routerconsole/jsp/help.jsp index 265bbfb62..49d138c27 100644 --- a/apps/routerconsole/jsp/help.jsp +++ b/apps/routerconsole/jsp/help.jsp @@ -9,7 +9,13 @@ %> I2P Router Console - help <%@include file="css.jsi" %> - + + + <%@include file="summary.jsi" %>

I2P Router Help & Support

diff --git a/apps/routerconsole/jsp/help_ar.jsp b/apps/routerconsole/jsp/help_ar.jsp index 4b471f594..b63f509ca 100644 --- a/apps/routerconsole/jsp/help_ar.jsp +++ b/apps/routerconsole/jsp/help_ar.jsp @@ -9,7 +9,13 @@ %> I2P مساعدة لوحة التحكم <%@include file="css.jsi" %> - + + + <%@include file="summary.jsi" %>

I2P مساعدة لوحة التحكم

diff --git a/apps/routerconsole/jsp/help_fr.jsp b/apps/routerconsole/jsp/help_fr.jsp index fd0f8bc26..56167fe0e 100644 --- a/apps/routerconsole/jsp/help_fr.jsp +++ b/apps/routerconsole/jsp/help_fr.jsp @@ -9,7 +9,13 @@ %> Console du routeur I2P - Aide <%@include file="css.jsi" %> - + + + <%@include file="summary.jsi" %> Traduction de mars 2011 (magma@mail.i2p)

Aide et assistance du routeur I2P

diff --git a/apps/routerconsole/jsp/help_nl.jsp b/apps/routerconsole/jsp/help_nl.jsp index 944e65e7b..9db466eb1 100644 --- a/apps/routerconsole/jsp/help_nl.jsp +++ b/apps/routerconsole/jsp/help_nl.jsp @@ -9,7 +9,13 @@ %> I2P Router Console - help <%@include file="css.jsi" %> - + + + <%@include file="summary.jsi" %>

I2P Router Help & Support

diff --git a/apps/routerconsole/jsp/help_ru.jsp b/apps/routerconsole/jsp/help_ru.jsp index d14da0138..7c49a5fb6 100644 --- a/apps/routerconsole/jsp/help_ru.jsp +++ b/apps/routerconsole/jsp/help_ru.jsp @@ -9,7 +9,13 @@ %> Консоль маршрутизатора I2P - справка <%@include file="css.jsi" %> - + + + <%@include file="summary.jsi" %>

Справка маршрутизатора I2P

diff --git a/apps/routerconsole/jsp/home.jsp b/apps/routerconsole/jsp/home.jsp index 27fb11edc..e0f22453f 100644 --- a/apps/routerconsole/jsp/home.jsp +++ b/apps/routerconsole/jsp/home.jsp @@ -6,9 +6,9 @@ <%=intl.title("home")%> <% @@ -20,6 +20,11 @@ %> " /> +<% + java.io.File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml"); +%> + + " /> @@ -28,19 +33,10 @@ -
<%@include file="xhr1.jsi" %>
-<% - if (!newshelper.shouldShowNews()) { -%> -

<%=intl._("News")%>


- -<% - } // !shouldShowNews() -%>
@@ -48,11 +44,8 @@ <% if (newshelper.shouldShowNews()) { - java.io.File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml"); %>
- -

diff --git a/apps/routerconsole/jsp/i2ptunnelmgr.jsp b/apps/routerconsole/jsp/i2ptunnelmgr.jsp new file mode 100644 index 000000000..b45947633 --- /dev/null +++ b/apps/routerconsole/jsp/i2ptunnelmgr.jsp @@ -0,0 +1,96 @@ +<%@page contentType="text/html"%> +<%@page trimDirectiveWhitespaces="true"%> +<%@page pageEncoding="UTF-8"%> + +" /> +<% + // CSSHelper is also pulled in by css.jsi below... + boolean testIFrame = tester.allowIFrame(request.getHeader("User-Agent")); + if (!testIFrame) { + response.setStatus(302, "Moved"); + response.setHeader("Location", "/i2ptunnel/"); + } else { +%> + + + +<%@include file="css.jsi" %> +<%=intl.title("i2p tunnel manager")%> + + + + +<%@include file="summary.jsi" %> + +

<%=intl._("I2P Tunnel Manager")%> ">images/newtab.png" />

+
+ +
+<% + } +%> diff --git a/apps/routerconsole/jsp/jars.jsp b/apps/routerconsole/jsp/jars.jsp index 4fa200b70..7da2e8690 100644 --- a/apps/routerconsole/jsp/jars.jsp +++ b/apps/routerconsole/jsp/jars.jsp @@ -5,7 +5,13 @@ <%@include file="css.jsi" %> <%=intl.title("Jar File Dump")%> - + + + <%@include file="summary.jsi" %>

Jar File Dump

diff --git a/apps/routerconsole/jsp/jobs.jsp b/apps/routerconsole/jsp/jobs.jsp index 2e2e71248..c668951b9 100644 --- a/apps/routerconsole/jsp/jobs.jsp +++ b/apps/routerconsole/jsp/jobs.jsp @@ -6,7 +6,13 @@ <%@include file="css.jsi" %> <%=intl.title("job queue")%> - + + + <%@include file="summary.jsi" %>

<%=intl._("I2P Router Job Queue")%>

diff --git a/apps/routerconsole/jsp/logs.jsp b/apps/routerconsole/jsp/logs.jsp index 373e386eb..bd6d85722 100644 --- a/apps/routerconsole/jsp/logs.jsp +++ b/apps/routerconsole/jsp/logs.jsp @@ -5,7 +5,13 @@ <%@include file="css.jsi" %> <%=intl.title("logs")%> - + + + <%@include file="summary.jsi" %>

<%=intl._("I2P Router Logs")%>

@@ -33,8 +39,10 @@

<%=intl._("Note that system information, log timestamps, and log messages may provide clues to your location; please review everything you include in a bug report.")%>

<%=intl._("Critical Logs")%>

+

<%=intl._("Router Logs")%> (<%=intl._("configure")%>)

+

<%=intl._("Service (Wrapper) Logs")%>


diff --git a/apps/routerconsole/jsp/netdb.jsp b/apps/routerconsole/jsp/netdb.jsp index 1a7a42999..ba2185062 100644 --- a/apps/routerconsole/jsp/netdb.jsp +++ b/apps/routerconsole/jsp/netdb.jsp @@ -6,7 +6,13 @@ <%@include file="css.jsi" %> <%=intl.title("network database")%> - + + + <%@include file="summary.jsi" %>

<%=intl._("I2P Network Database")%>

diff --git a/apps/routerconsole/jsp/nowebapp.jsp b/apps/routerconsole/jsp/nowebapp.jsp index f62ae6b16..b61808a9d 100644 --- a/apps/routerconsole/jsp/nowebapp.jsp +++ b/apps/routerconsole/jsp/nowebapp.jsp @@ -7,7 +7,13 @@ <%@include file="css.jsi" %> <%=intl.title("WebApp Not Found")%> - + + + <%@include file="summary.jsi" %>

<%=intl._("Web Application Not Running")%>

diff --git a/apps/routerconsole/jsp/oldconsole.jsp b/apps/routerconsole/jsp/oldconsole.jsp index 7edb76240..825388a7a 100644 --- a/apps/routerconsole/jsp/oldconsole.jsp +++ b/apps/routerconsole/jsp/oldconsole.jsp @@ -9,7 +9,13 @@ %> I2P Router Console - internals <%@include file="css.jsi" %> - + + + <%@include file="summary.jsi" %> " /> diff --git a/apps/routerconsole/jsp/peers.jsp b/apps/routerconsole/jsp/peers.jsp index 6b0ed6b67..934de432b 100644 --- a/apps/routerconsole/jsp/peers.jsp +++ b/apps/routerconsole/jsp/peers.jsp @@ -6,7 +6,13 @@ <%@include file="css.jsi" %> <%=intl.title("peer connections")%> - + + + <%@include file="summary.jsi" %>

<%=intl._("I2P Network Peers")%>

diff --git a/apps/routerconsole/jsp/profiles.jsp b/apps/routerconsole/jsp/profiles.jsp index 4c33bb1fe..f5be72a83 100644 --- a/apps/routerconsole/jsp/profiles.jsp +++ b/apps/routerconsole/jsp/profiles.jsp @@ -6,7 +6,14 @@ <%@include file="css.jsi" %> <%=intl.title("peer profiles")%> -<%@include file="summary.jsi" %> + + + +<%@include file="summary.jsi" %>

<%=intl._("I2P Network Peer Profiles")%>

diff --git a/apps/routerconsole/jsp/stats.jsp b/apps/routerconsole/jsp/stats.jsp index c0596f796..b5255775b 100644 --- a/apps/routerconsole/jsp/stats.jsp +++ b/apps/routerconsole/jsp/stats.jsp @@ -6,7 +6,13 @@ <%@include file="css.jsi" %> <%=intl.title("statistics")%> - + + + <%@include file="summary.jsi" %> " /> diff --git a/apps/routerconsole/jsp/summary.jsi b/apps/routerconsole/jsp/summary.jsi index 847e42d52..6a388b817 100644 --- a/apps/routerconsole/jsp/summary.jsi +++ b/apps/routerconsole/jsp/summary.jsi @@ -1,3 +1,10 @@ + +" /> +<% + java.io.File newspath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml"); +%> + +
<% // The refresh delay, 0 to disable @@ -13,9 +20,11 @@ d = net.i2p.data.DataHelper.stripHTML(d); // XSS // pass the new delay parameter to the iframe newDelay = "?refresh=" + d; + // update disable boolean + intl.setDisableRefresh(d); } - if (!"0".equals(d)) - out.print("\n"); + if (!intl.getDisableRefresh()) { + out.print("
\n"); } else if (allowIFrame) { // since we don't have an iframe this will reload the base page, and // the new delay will be passed to the iframe above - out.print("
\n" + + out.print("
\n"); + "
\n"); } else { out.print("
\n"); } diff --git a/apps/routerconsole/jsp/summaryframe.jsp b/apps/routerconsole/jsp/summaryframe.jsp index bdd4a8cbc..4af6be78f 100644 --- a/apps/routerconsole/jsp/summaryframe.jsp +++ b/apps/routerconsole/jsp/summaryframe.jsp @@ -26,10 +26,11 @@ } else { d = net.i2p.data.DataHelper.stripHTML(d); // XSS intl.setRefresh(d); + intl.setDisableRefresh(d); } // we probably don't get here if d == "0" since caught in summary.jsi, but just // to be sure... - if (!"0".equals(d)) { + if (!intl.getDisableRefresh()) { // doesn't work for restart or shutdown with no expl. tunnels, // since the call to ConfigRestartBean.renderStatus() hasn't happened yet... // So we delay slightly @@ -52,12 +53,19 @@ } %>
+ +" /> +<% + java.io.File newspath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml"); +%> + + <%@include file="summarynoframe.jsi" %> <% // d and shutdownSoon defined above if (!shutdownSoon) { - out.print("
\n"); - if ("0".equals(d)) { + out.print("
\n
\n"); + if (intl.getDisableRefresh()) { out.print(""); out.print(intl._("Refresh (s)")); out.print(": \n"); diff --git a/apps/routerconsole/jsp/summarynoframe.jsi b/apps/routerconsole/jsp/summarynoframe.jsi index 63c39e6e5..6fae7c901 100644 --- a/apps/routerconsole/jsp/summarynoframe.jsi +++ b/apps/routerconsole/jsp/summarynoframe.jsi @@ -1,35 +1,17 @@ -<%@page import="net.i2p.router.web.SummaryHelper" %> <% /* - * Note: - * This is included almost 30 times, so keep whitespace etc. to a minimum. + * TODO - the bar would render more cleanly if we specified the img height and width here, + * but unfortunately the images in the different themes are different sizes. + * They range in height from 37 to 43 px. But there's a -2 bottom margin... + * So put it in a div. */ %> - -" /> -" /> -" /> -" /> - -<% helper.storeWriter(out); %> -<% -/* - * The following is required for the reseed button to work, although we probably - * only need the reseedNonce property. - */ -%> - - -<% -/* - * The following is required for the update buttons to work, although we probably - * only need the updateNonce property. - */ -%> - - -" /> -<% - // moved to java for ease of translation and to avoid 30 copies - helper.renderSummaryBar(); -%> + +
+ +<%@include file="xhr1.jsi" %> +
diff --git a/apps/routerconsole/jsp/torrents.jsp b/apps/routerconsole/jsp/torrents.jsp new file mode 100644 index 000000000..665f03985 --- /dev/null +++ b/apps/routerconsole/jsp/torrents.jsp @@ -0,0 +1,78 @@ +<%@page contentType="text/html"%> +<%@page trimDirectiveWhitespaces="true"%> +<%@page pageEncoding="UTF-8"%> + +" /> +<% + // CSSHelper is also pulled in by css.jsi below... + boolean testIFrame = tester.allowIFrame(request.getHeader("User-Agent")); + if (!testIFrame) { + response.setStatus(302, "Moved"); + response.setHeader("Location", "/i2psnark/"); + } else { +%> + + + +<%@include file="css.jsi" %> +<%=intl.title("torrents")%> + + + + +<%@include file="summary.jsi" %> + +

<%=intl._("I2P Torrent Downloader")%> ">images/newtab.png" />

+
+ +
+<% + } +%> diff --git a/apps/routerconsole/jsp/tunnels.jsp b/apps/routerconsole/jsp/tunnels.jsp index 32f86475a..5ccfd0778 100644 --- a/apps/routerconsole/jsp/tunnels.jsp +++ b/apps/routerconsole/jsp/tunnels.jsp @@ -6,7 +6,13 @@ <%@include file="css.jsi" %> <%=intl.title("tunnel summary")%> - + + + <%@include file="summary.jsi" %>

<%=intl._("I2P Tunnel Summary")%>

diff --git a/apps/routerconsole/jsp/viewprofile.jsp b/apps/routerconsole/jsp/viewprofile.jsp index 8747a6d88..96f2e1df4 100644 --- a/apps/routerconsole/jsp/viewprofile.jsp +++ b/apps/routerconsole/jsp/viewprofile.jsp @@ -6,7 +6,13 @@ <%@include file="css.jsi" %> <%=intl.title("Peer Profile")%> - + + + <%@include file="summary.jsi" %>

<%=intl._("Peer Profile")%>

diff --git a/apps/routerconsole/jsp/webmail.jsp b/apps/routerconsole/jsp/webmail.jsp new file mode 100644 index 000000000..1d9ae1cd6 --- /dev/null +++ b/apps/routerconsole/jsp/webmail.jsp @@ -0,0 +1,78 @@ +<%@page contentType="text/html"%> +<%@page trimDirectiveWhitespaces="true"%> +<%@page pageEncoding="UTF-8"%> + +" /> +<% + // CSSHelper is also pulled in by css.jsi below... + boolean testIFrame = tester.allowIFrame(request.getHeader("User-Agent")); + if (!testIFrame) { + response.setStatus(302, "Moved"); + response.setHeader("Location", "/susimail/susimail"); + } else { +%> + + + +<%@include file="css.jsi" %> +<%=intl.title("webmail")%> + + + + +<%@include file="summary.jsi" %> + +

<%=intl._("I2P Webmail")%> ">images/newtab.png" />

+
+ +
+<% + } +%> diff --git a/apps/routerconsole/jsp/xhr1.jsi b/apps/routerconsole/jsp/xhr1.jsi index a171d0c85..d6b9e62eb 100644 --- a/apps/routerconsole/jsp/xhr1.jsi +++ b/apps/routerconsole/jsp/xhr1.jsi @@ -1,24 +1,41 @@ +<%@page import="net.i2p.router.web.SummaryHelper" %> +<% +/* + * Note: + * This is included on every refresh, so keep whitespace etc. to a minimum. + */ +%> " /> " /> -
<%=intl._("Version")%>: - -
<%=intl._("Uptime")%>: - -

" /> " /> <% String reqURI = request.getRequestURI(); - if (reqURI != null) - reqURI = reqURI.replace("/xhr1.jsp", "/home"); + if (reqURI.contains("/xhr1")) + reqURI = request.getParameter("requestURI"); helper.setRequestURI(reqURI); %> -

"><%=intl._("Network")%>: -

-
- - -
- - +<% helper.storeWriter(out); %> +<% helper.storeNewsHelper(newshelper); %> +<% +/* + * The following is required for the reseed button to work, although we probably + * only need the reseedNonce property. + */ +%> + + +<% +/* + * The following is required for the update buttons to work, although we probably + * only need the updateNonce property. + */ +%> + + +" /> +<% + // moved to java for ease of translation + helper.renderSummaryBar(); +%> diff --git a/apps/routerconsole/jsp/xhr1.jsp b/apps/routerconsole/jsp/xhr1.jsp index 95c27683b..b48e82442 100644 --- a/apps/routerconsole/jsp/xhr1.jsp +++ b/apps/routerconsole/jsp/xhr1.jsp @@ -11,4 +11,11 @@ %> " /> + +" /> +<% + java.io.File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml"); +%> + + <%@include file="xhr1.jsi" %> diff --git a/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java b/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java index 93729cad1..883184ee1 100644 --- a/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java +++ b/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java @@ -40,11 +40,10 @@ import net.i2p.data.DataHelper; import net.i2p.data.Destination; import net.i2p.util.SecureFileOutputStream; -public class AddressbookBean +public class AddressbookBean extends BaseBean { protected String book, action, serial, lastSerial, filter, search, hostname, destination; protected int beginIndex, endIndex; - protected final Properties properties; private Properties addressbook; private int trClass; protected final LinkedList deletionMarks; @@ -82,41 +81,12 @@ public class AddressbookBean public AddressbookBean() { - properties = new Properties(); + super(); deletionMarks = new LinkedList(); beginIndex = 0; endIndex = DISPLAY_SIZE - 1; } - private long configLastLoaded = 0; - private static final String PRIVATE_BOOK = "private_addressbook"; - private static final String DEFAULT_PRIVATE_BOOK = "../privatehosts.txt"; - - protected void loadConfig() - { - long currentTime = System.currentTimeMillis(); - - if( !properties.isEmpty() && currentTime - configLastLoaded < 10000 ) - return; - - FileInputStream fis = null; - try { - properties.clear(); - fis = new FileInputStream( ConfigBean.configFileName ); - properties.load( fis ); - // added in 0.5, for compatibility with 0.4 config.txt - if( properties.getProperty(PRIVATE_BOOK) == null) - properties.setProperty(PRIVATE_BOOK, DEFAULT_PRIVATE_BOOK); - configLastLoaded = currentTime; - } - catch (Exception e) { - Debug.debug( e.getClass().getName() + ": " + e.getMessage() ); - } finally { - if (fis != null) - try { fis.close(); } catch (IOException ioe) {} - } - } - public String getFileName() { loadConfig(); diff --git a/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java b/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java new file mode 100644 index 000000000..a5cc49e2d --- /dev/null +++ b/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java @@ -0,0 +1,64 @@ +package i2p.susi.dns; + +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; + +/** + * Holds methods common to several Beans. + * @since 0.9.1 + */ +public class BaseBean +{ + protected final Properties properties; + + private long configLastLoaded = 0; + private static final String PRIVATE_BOOK = "private_addressbook"; + private static final String DEFAULT_PRIVATE_BOOK = "../privatehosts.txt"; + + public static final String PROP_THEME_NAME = "theme"; + public static final String DEFAULT_THEME = "light"; + public static final String BASE_THEME_PATH = "/themes/susidns/"; + + public BaseBean() + { + properties = new Properties(); + } + + protected void loadConfig() + { + long currentTime = System.currentTimeMillis(); + + if( !properties.isEmpty() && currentTime - configLastLoaded < 10000 ) + return; + + FileInputStream fis = null; + try { + properties.clear(); + fis = new FileInputStream( ConfigBean.configFileName ); + properties.load( fis ); + // added in 0.5, for compatibility with 0.4 config.txt + if( properties.getProperty(PRIVATE_BOOK) == null) + properties.setProperty(PRIVATE_BOOK, DEFAULT_PRIVATE_BOOK); + configLastLoaded = currentTime; + } + catch (Exception e) { + Debug.debug( e.getClass().getName() + ": " + e.getMessage() ); + } finally { + if (fis != null) + try { fis.close(); } catch (IOException ioe) {} + } + } + + /** + * Returns the theme path + * @since 0.9.1 + */ + public String getTheme() { + loadConfig(); + String url = BASE_THEME_PATH; + String theme = properties.getProperty(PROP_THEME_NAME, DEFAULT_THEME); + url += theme + "/"; + return url; + } +} diff --git a/apps/susidns/src/java/src/i2p/susi/dns/SubscriptionsBean.java b/apps/susidns/src/java/src/i2p/susi/dns/SubscriptionsBean.java index 69597f270..8675613c5 100644 --- a/apps/susidns/src/java/src/i2p/susi/dns/SubscriptionsBean.java +++ b/apps/susidns/src/java/src/i2p/susi/dns/SubscriptionsBean.java @@ -36,38 +36,10 @@ import java.util.Properties; import net.i2p.I2PAppContext; import net.i2p.util.SecureFileOutputStream; -public class SubscriptionsBean +public class SubscriptionsBean extends BaseBean { private String action, fileName, content, serial, lastSerial; - Properties properties; - - public SubscriptionsBean() - { - properties = new Properties(); - } - private long configLastLoaded = 0; - private void loadConfig() - { - long currentTime = System.currentTimeMillis(); - - if( !properties.isEmpty() && currentTime - configLastLoaded < 10000 ) - return; - - FileInputStream fis = null; - try { - properties.clear(); - fis = new FileInputStream( ConfigBean.configFileName ); - properties.load( fis ); - configLastLoaded = currentTime; - } - catch (Exception e) { - Debug.debug( e.getClass().getName() + ": " + e.getMessage() ); - } finally { - if (fis != null) - try { fis.close(); } catch (IOException ioe) {} - } - } public String getAction() { return action; } diff --git a/apps/susidns/src/jsp/addressbook.jsp b/apps/susidns/src/jsp/addressbook.jsp index fe9666473..61487f811 100644 --- a/apps/susidns/src/jsp/addressbook.jsp +++ b/apps/susidns/src/jsp/addressbook.jsp @@ -47,12 +47,12 @@ ${book.book} <%=intl._("address book")%> - susidns - +