diff --git a/apps/i2ptunnel/java/build.xml b/apps/i2ptunnel/java/build.xml index e944e5d3c4..e0cc3dc806 100644 --- a/apps/i2ptunnel/java/build.xml +++ b/apps/i2ptunnel/java/build.xml @@ -270,6 +270,8 @@ + + @@ -299,6 +301,8 @@ + + diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/Messages.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/Messages.java index 88911b041d..1ae4636a1e 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/Messages.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/Messages.java @@ -40,6 +40,11 @@ public class Messages { return Translate.getString(s, o, _context, BUNDLE_NAME); } + /** @since 0.9.26 */ + public String _t(String s, Object o1, Object o2) { + return Translate.getString(s, o1, o2, _context, BUNDLE_NAME); + } + /** translate (ngettext) * @since 0.9.7 */ diff --git a/apps/i2ptunnel/jsp/register.jsp b/apps/i2ptunnel/jsp/register.jsp index f7f874a447..e16e3ad346 100644 --- a/apps/i2ptunnel/jsp/register.jsp +++ b/apps/i2ptunnel/jsp/register.jsp @@ -1,4 +1,4 @@ -<%@page contentType="text/html" import="net.i2p.i2ptunnel.web.EditBean,net.i2p.client.naming.HostTxtEntry,net.i2p.data.SigningPrivateKey,net.i2p.util.OrderedProperties" +<%@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 trimDirectiveWhitespaces="true" %> @@ -8,7 +8,9 @@ %> -<% String tun = request.getParameter("tunnel"); +<% + RequestWrapper wrequest = new RequestWrapper(request); + String tun = wrequest.getParameter("tunnel"); int curTunnel = -1; if (tun != null) { try { @@ -43,8 +45,7 @@ input.default { width: 1px; height: 1px; visibility: hidden; } if (editBean.isInitialized()) { %> -
- +
<% @@ -73,26 +74,23 @@ input.default { width: 1px; height: 1px; visibility: hidden; } <% if (!"new".equals(tunnelType)) { %> + + <%=intl._t("Please be sure to select, copy, and paste the entire contents of the appropriate authentication data into the form of your favorite registration site")%> +

-
<%=editBean.getTunnelName(curTunnel)%>
-
- - <%=tunnelTypeName%> -
- <% if (("httpserver".equals(tunnelType)) || ("httpbidirserver".equals(tunnelType))) { %>
<%=editBean.getSpoofedHost(curTunnel)%>
@@ -101,7 +99,7 @@ input.default { width: 1px; height: 1px; visibility: hidden; } %>
@@ -126,16 +124,17 @@ input.default { width: 1px; height: 1px; visibility: hidden; } OrderedProperties props = new OrderedProperties(); HostTxtEntry he = new HostTxtEntry(name, b64, props); he.sign(spk); - %>
- - <%=intl._t("Select and copy the entire contents of the appropriate box")%> -
-
+ %>
+
+
+
+

<%=intl._t("Advanced authentication strings")%>

+
<% props.remove(HostTxtEntry.PROP_SIG); props.setProperty(HostTxtEntry.PROP_ACTION, HostTxtEntry.ACTION_REMOVE); @@ -145,16 +144,157 @@ input.default { width: 1px; height: 1px; visibility: hidden; } <%=intl._t("Authentication for removing host")%> + <%=intl._t("This will remove the entry for {0}", name)%>
+
+
+
+<% + String oldname = wrequest.getParameter("oldname"); + String olddestfile = wrequest.getFilename("olddestfile"); + SigningPrivateKey spk2 = null; + String olddest = null; + if (olddestfile != null) { + InputStream destIn = wrequest.getInputStream("olddestfile"); + if (destIn.available() > 0) { + try { + PrivateKeyFile pkf2 = new PrivateKeyFile(destIn); + String oldb64 = pkf2.getDestination().toBase64(); + if (!b64.equals(oldb64)) { + // disallow dup + olddest = b64; + spk2 = pkf2.getSigningPrivKey(); + } + } catch (I2PSessionException ise) { + throw new IllegalStateException("Unable to open private key file " + olddestfile, ise); + } + } + } + props.remove(HostTxtEntry.PROP_SIG); + %>
+ +<% + if (oldname != null && oldname.length() > 0 && !oldname.equals(name)) { + props.setProperty(HostTxtEntry.PROP_ACTION, HostTxtEntry.ACTION_CHANGENAME); + props.setProperty(HostTxtEntry.PROP_OLDNAME, oldname); + he.sign(spk); + %> + <%=intl._t("This will change the name from {0} to {1}, using the same destination", oldname, name)%> +<% + } else { + %><%=intl._t("This tunnel must be configured with the new host name.")%> + <%=intl._t("Enter old host name below.")%> +<% + } + %>
+
+
+
+<% + props.remove(HostTxtEntry.PROP_SIG); + %>
+ +<% + if (oldname != null && oldname.length() > 0 && !oldname.equals(name)) { + props.setProperty(HostTxtEntry.PROP_ACTION, HostTxtEntry.ACTION_ADDNAME); + props.setProperty(HostTxtEntry.PROP_OLDNAME, oldname); + he.sign(spk); + %> + <%=intl._t("This will add an alias {0} for {1}, using the same destination", name, oldname)%> +<% + } else { + %><%=intl._t("This tunnel must be configured with the new host name.")%> + <%=intl._t("Enter old host name below.")%> +<% + } + %>
+
+
+
+<% + props.remove(HostTxtEntry.PROP_SIG); + %>
+ +<% + if (spk2 != null) { + props.setProperty(HostTxtEntry.PROP_ACTION, HostTxtEntry.ACTION_CHANGEDEST); + props.setProperty(HostTxtEntry.PROP_OLDDEST, olddest); + he.signInner(spk2); + he.sign(spk); + %> + <%=intl._t("This will change the destination for {0}", name)%> +<% + } else { + %><%=intl._t("This tunnel must be configured with the new destination.")%> + <%=intl._t("Enter old destination below.")%> +<% + } + %>
+
+
+
+<% + props.remove(HostTxtEntry.PROP_SIG); + props.remove(HostTxtEntry.PROP_OLDSIG); + %>
+ +<% + if (spk2 != null) { + props.setProperty(HostTxtEntry.PROP_ACTION, HostTxtEntry.ACTION_ADDDEST); + props.setProperty(HostTxtEntry.PROP_OLDDEST, olddest); + he.signInner(spk2); + he.sign(spk); + %> + <%=intl._t("This will add an alternate destination for {0}", name)%> +<% + } else { + %><%=intl._t("This tunnel must be configured with the new destination.")%> + <%=intl._t("Enter old destination below.")%> +<% + } + %>
+
+
+
+<% + props.remove(HostTxtEntry.PROP_SIG); + props.remove(HostTxtEntry.PROP_OLDSIG); + %>
+ +<% + if (oldname != null && oldname.length() > 0 && !oldname.equals(name) && spk2 != null) { + props.setProperty(HostTxtEntry.PROP_ACTION, HostTxtEntry.ACTION_ADDSUBDOMAIN); + props.setProperty(HostTxtEntry.PROP_OLDNAME, oldname); + props.setProperty(HostTxtEntry.PROP_OLDDEST, olddest); + he.signInner(spk2); + he.sign(spk); + %> + <%=intl._t("This will add a subdomain {0} of {1}, with a different destination", name, oldname)%> +<% + } else { + %><%=intl._t("This tunnel must be configured with the new subdomain and destination.")%> + <%=intl._t("Enter higher-level domain and destination below.")%> +<% + } + %>
- -