diff --git a/apps/i2ptunnel/java/build.xml b/apps/i2ptunnel/java/build.xml index c9a3a74c1..95f99b014 100644 --- a/apps/i2ptunnel/java/build.xml +++ b/apps/i2ptunnel/java/build.xml @@ -238,7 +238,7 @@ + basedir="../jsp/" excludes="web.xml, web-fragment.xml, web-out.xml, **/*.java, *.jsp, *.jsi"> @@ -253,7 +253,7 @@ - + @@ -337,7 +337,7 @@ - + diff --git a/apps/i2ptunnel/jsp/edit.jsp b/apps/i2ptunnel/jsp/edit.jsp index c1030a5c7..c6c0b1af5 100644 --- a/apps/i2ptunnel/jsp/edit.jsp +++ b/apps/i2ptunnel/jsp/edit.jsp @@ -12,25 +12,56 @@ %><%@page trimDirectiveWhitespaces="true" %><%@page contentType="text/html" import="net.i2p.i2ptunnel.web.EditBean" %><% +boolean __isClient = false; +boolean __invalid = false; +int curTunnel = -1; String tun = request.getParameter("tunnel"); if (tun != null) { try { - int curTunnel = Integer.parseInt(tun); - if (EditBean.staticIsClient(curTunnel)) { - %><% - } else { - %><% - } + curTunnel = Integer.parseInt(tun); + __isClient = EditBean.staticIsClient(curTunnel); } catch (NumberFormatException nfe) { - %>Invalid tunnel parameter<% + __invalid = true; } } else { String type = request.getParameter("type"); - int curTunnel = -1; - if (EditBean.isClient(type)) { - %><% - } else { - %><% - } + __isClient = EditBean.isClient(type); +} +%> + + + + + + <%=intl._t("Hidden Services Manager")%> - <%=intl._t("Edit Client Tunnel")%> + + + + <% if (editBean.allowCSS()) { + %> + + <% } + %> + + + + +<% +if (__invalid) { + %>Invalid tunnel parameter<% +} else { + if (editBean.isInitialized()) { + if (__isClient) { + %><%@include file="editClient.jsi" %><% + } else { + %><%@include file="editServer.jsi" %><% + } + } else { + %>
<%=intl._t("Tunnels not initialized yet; please retry in a few moments.")%>
<% + } // isInitialized() } %> + + diff --git a/apps/i2ptunnel/jsp/editClient.jsp b/apps/i2ptunnel/jsp/editClient.jsi similarity index 94% rename from apps/i2ptunnel/jsp/editClient.jsp rename to apps/i2ptunnel/jsp/editClient.jsi index a0f0d40d1..d4a1472e6 100644 --- a/apps/i2ptunnel/jsp/editClient.jsp +++ b/apps/i2ptunnel/jsp/editClient.jsi @@ -1,48 +1,3 @@ -<%@page contentType="text/html" import="net.i2p.i2ptunnel.web.EditBean" -%><%@page trimDirectiveWhitespaces="true" -%> - - - -<% String tun = request.getParameter("tunnel"); - int curTunnel = -1; - if (tun != null) { - try { - curTunnel = Integer.parseInt(tun); - } catch (NumberFormatException nfe) { - curTunnel = -1; - } - } -%> - -<% - response.setHeader("Content-Security-Policy", "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'"); -%> - - - - <%=intl._t("Hidden Services Manager")%> - <%=intl._t("Edit Client Tunnel")%> - - - - - <% if (editBean.allowCSS()) { - %> - - <% } - %> - - - - - -<% - - if (editBean.isInitialized()) { - -%>
@@ -731,13 +686,3 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
- -<% - - } else { - %>
<%=intl._t("Tunnels not initialized yet; please retry in a few moments.")%>
<% - } // isInitialized() - -%> - - diff --git a/apps/i2ptunnel/jsp/editServer.jsp b/apps/i2ptunnel/jsp/editServer.jsi similarity index 96% rename from apps/i2ptunnel/jsp/editServer.jsp rename to apps/i2ptunnel/jsp/editServer.jsi index 7a39d7555..f1c45cef9 100644 --- a/apps/i2ptunnel/jsp/editServer.jsp +++ b/apps/i2ptunnel/jsp/editServer.jsi @@ -1,48 +1,3 @@ -<%@page contentType="text/html" import="net.i2p.i2ptunnel.web.EditBean" -%><%@page trimDirectiveWhitespaces="true" -%> - - - -<% String tun = request.getParameter("tunnel"); - int curTunnel = -1; - if (tun != null) { - try { - curTunnel = Integer.parseInt(tun); - } catch (NumberFormatException nfe) { - curTunnel = -1; - } - } -%> - -<% - response.setHeader("Content-Security-Policy", "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'"); -%> - - - - <%=intl._t("Hidden Services Manager")%> - <%=intl._t("Edit Hidden Service")%> - - - - - <% if (editBean.allowCSS()) { - %> - - <% } - %> - - - - - -<% - - if (editBean.isInitialized()) { - -%>
@@ -977,13 +932,3 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
- -<% - - } else { - %>
<%=intl._t("Tunnels not initialized yet; please retry in a few moments.")%>
<% - } // isInitialized() - -%> - - diff --git a/apps/i2ptunnel/jsp/index.jsp b/apps/i2ptunnel/jsp/index.jsp index eddee6702..b0b1f5f6e 100644 --- a/apps/i2ptunnel/jsp/index.jsp +++ b/apps/i2ptunnel/jsp/index.jsp @@ -24,7 +24,6 @@ <%=intl._t("Hidden Services Manager")%> - <% if (indexBean.allowCSS()) { diff --git a/apps/i2ptunnel/jsp/register.jsp b/apps/i2ptunnel/jsp/register.jsp index 7f0e3a1a2..4f928464c 100644 --- a/apps/i2ptunnel/jsp/register.jsp +++ b/apps/i2ptunnel/jsp/register.jsp @@ -1,4 +1,15 @@ -<%@page contentType="text/html" import="java.io.InputStream,net.i2p.i2ptunnel.web.EditBean,net.i2p.servlet.RequestWrapper,net.i2p.client.I2PSessionException,net.i2p.client.naming.HostTxtEntry,net.i2p.data.PrivateKeyFile,net.i2p.data.SigningPrivateKey,net.i2p.util.OrderedProperties" +<% + // NOTE: Do the header carefully so there is no whitespace before the <%@page pageEncoding="UTF-8" +%><%@page contentType="text/html" import="java.io.InputStream,net.i2p.i2ptunnel.web.EditBean,net.i2p.servlet.RequestWrapper,net.i2p.client.I2PSessionException,net.i2p.client.naming.HostTxtEntry,net.i2p.data.PrivateKeyFile,net.i2p.data.SigningPrivateKey,net.i2p.util.OrderedProperties" %><%@page %> @@ -24,7 +35,6 @@ <%=intl._t("Hidden Services Manager")%> - <%=intl._t("Registration Helper")%> - <% if (editBean.allowCSS()) { diff --git a/apps/i2ptunnel/jsp/wizard.jsp b/apps/i2ptunnel/jsp/wizard.jsp index 74d8d91e8..a641b0691 100644 --- a/apps/i2ptunnel/jsp/wizard.jsp +++ b/apps/i2ptunnel/jsp/wizard.jsp @@ -58,7 +58,6 @@ <%=intl._t("I2P Tunnel Manager - Tunnel Creation Wizard")%> - <% if (editBean.allowCSS()) { diff --git a/history.txt b/history.txt index 1e229ee63..e4b896389 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,11 @@ +2018-01-17 zzz + * i2ptunnel: + - Set defaults for limits + - Change include style for edit jsps + +2018-01-16 zzz + * i2ptunnel: Fix NPE stopping TCG + 2018-01-14 zzz * Keyring (ticket #2108): - Separate local and remote dests on /configkeyring diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 43dca9240..9319fc01c 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 21; + public final static long BUILD = 22; /** for example "-test" */ public final static String EXTRA = "";