From b13d9f9769c27c2d40f262bb54f6939ad7a146bc Mon Sep 17 00:00:00 2001 From: zzz Date: Fri, 17 Nov 2023 18:17:52 +0000 Subject: [PATCH] i2ptunnel: Edit and wizard form improvements --- apps/i2ptunnel/jsp/editClient.jsi | 34 ++-- apps/i2ptunnel/jsp/editServer.jsi | 36 ++--- apps/i2ptunnel/jsp/ssl.jsp | 7 +- apps/i2ptunnel/jsp/themes/dark/i2ptunnel.css | 34 ---- apps/i2ptunnel/jsp/themes/light/i2ptunnel.css | 32 ---- apps/i2ptunnel/jsp/wizard.jsp | 145 ++++++++---------- 6 files changed, 94 insertions(+), 194 deletions(-) diff --git a/apps/i2ptunnel/jsp/editClient.jsi b/apps/i2ptunnel/jsp/editClient.jsi index f89f7423c..3c70a586e 100644 --- a/apps/i2ptunnel/jsp/editClient.jsi +++ b/apps/i2ptunnel/jsp/editClient.jsi @@ -85,17 +85,11 @@ <%=intl._t("Port")%>: <% - String value = editBean.getClientPort(curTunnel); - if (value == null || "".equals(value.trim())) { - out.write(" ("); - out.write(intl._t("required")); - out.write(")"); - } String phelp = intl._t("Specify the local port this service should be accessible from"); String ptext = canChangePort ? phelp : bStopFirst; String pdisabled = canChangePort ? "" : " readonly=\"readonly\" "; %> - /> + " required <%=pdisabled%>/> <% if ("streamrclient".equals(tunnelType)) { @@ -104,13 +98,8 @@ <%=intl._t("Host")%>: <% String targetHost = editBean.getTargetHost(curTunnel); - if (targetHost == null || "".equals(targetHost.trim())) { - out.write(" ("); - out.write(intl._t("required")); - out.write(")"); - } %> - " value="<%=targetHost%>" class="freetext host" placeholder="required" /> + " value="<%=targetHost%>" class="freetext host" placeholder="<%=intl._t("required")%>" required /> <% } else { @@ -221,14 +210,7 @@ - <% String value2 = editBean.getClientDestination(curTunnel); - if (value2 == null || "".equals(value2.trim())) { - out.write(" ("); - out.write(intl._t("required")); - out.write(")"); - } -%> -  <%=intl._t("For a random selection from a pool, separate with commas e.g. server1.i2p,server2.i2p")%>" value="<%=editBean.getClientDestination(curTunnel)%>" class="freetext destination" placeholder="required" /> +  <%=intl._t("For a random selection from a pool, separate with commas e.g. server1.i2p,server2.i2p")%>" value="<%=editBean.getClientDestination(curTunnel)%>" class="freetext destination" placeholder="<%=intl._t("required")%>" required /> <%=intl._t("name, name:port, or destination")%> <% if ("streamrclient".equals(tunnelType)) { @@ -746,9 +728,15 @@ + <%=intl._t("Cancel")%> +<% + if (curTunnel >= 0) { +%> - - + +<% + } +%> diff --git a/apps/i2ptunnel/jsp/editServer.jsi b/apps/i2ptunnel/jsp/editServer.jsi index 51b3dcfc0..7f24218fe 100644 --- a/apps/i2ptunnel/jsp/editServer.jsi +++ b/apps/i2ptunnel/jsp/editServer.jsi @@ -89,18 +89,13 @@ <% } /* !streamrserver */ %> <%=intl._t("Port")%>: - <% String value = editBean.getTargetPort(curTunnel); - if (value == null || "".equals(value.trim())) { - out.write(" ("); - out.write(intl._t("required")); - out.write(")"); - } +<% String asphelp = intl._t("Specify the local port this service should be accessible from"); String bsphelp = intl._t("Specify the port the server is running on"); String ptext = canChangePort ? (isStreamrServer ? asphelp : bsphelp) : stopFirst; String pdisabled = canChangePort ? "" : " readonly=\"readonly\" "; %> - /> + " required <%=pdisabled%> /> <% if (!isStreamrServer) { %> @@ -115,16 +110,11 @@ <%=intl._t("Port")%>: -<% String value4 = editBean.getClientPort(curTunnel); - if (value4 == null || "".equals(value4.trim())) { - out.write(" ("); - out.write(intl._t("required")); - out.write(")"); - } +<% String csphelp = intl._t("Port required to access service (this can be a different port to the port the service is hosted on)"); String dsphelp = canChangePort ? csphelp : stopFirst; %> - /> + " required <%=pdisabled%> /> <% } /* httpbidirserver */ if (isBidirServer || isStreamrServer) { @@ -184,17 +174,11 @@
" tabindex="0"><%=editBean.getDestinationBase64(curTunnel)%>
<% - String value3 = editBean.getPrivateKeyFile(curTunnel); - if (value3 == null || "".equals(value3.trim())) { - out.write(" ("); - out.write(intl._t("required")); - out.write(")"); - } String htext = intl._t("Path to Private Key File"); String dtext = canChangeDest ? htext : stopFirst; String ddisabled = canChangeDest ? "" : " readonly=\"readonly\" "; %> - /> + " required <%=ddisabled%> /> <% @@ -1024,9 +1008,15 @@ + <%=intl._t("Cancel")%> +<% + if (curTunnel >= 0) { +%> - - + +<% + } +%> diff --git a/apps/i2ptunnel/jsp/ssl.jsp b/apps/i2ptunnel/jsp/ssl.jsp index 296d77de1..1b91e4a00 100644 --- a/apps/i2ptunnel/jsp/ssl.jsp +++ b/apps/i2ptunnel/jsp/ssl.jsp @@ -2,8 +2,7 @@ %><%@page pageEncoding="UTF-8" %><%@page contentType="text/html" import="java.io.File,java.io.IOException,net.i2p.crypto.KeyStoreUtil,net.i2p.data.DataHelper,net.i2p.jetty.JettyXmlConfigurationParser" %><%@page -%> - +%> <% /* right now using EditBean instead of IndexBean for getSpoofedHost() */ /* but might want to POST to it anyway ??? */ @@ -557,14 +556,14 @@ input.default { width: 1px; height: 1px; visibility: hidden; } <%-- <%=intl._t("Add Port Routing")%> - " value="" class="freetext port" placeholder="required" /> + " value="" class="freetext port" placeholder="<%=intl._t("required")%>" required /> " value="<%=name%>" class="freetext" /> " value="<%=targetHost%>" class="freetext host" /> : - " value="" class="freetext port" placeholder="required" /> + " value="" class="freetext port" placeholder="<%=intl._t("required")%>" required /> --%> diff --git a/apps/i2ptunnel/jsp/themes/dark/i2ptunnel.css b/apps/i2ptunnel/jsp/themes/dark/i2ptunnel.css index 1cdec3b3f..c425c7dee 100644 --- a/apps/i2ptunnel/jsp/themes/dark/i2ptunnel.css +++ b/apps/i2ptunnel/jsp/themes/dark/i2ptunnel.css @@ -909,30 +909,6 @@ td.blankColumn { padding: 0; } -.required:not(old) { - display: none; -} - -input::-moz-placeholder { - color: #f00; - font-weight: bold; - opacity: 1; -} - -::-webkit-input-placeholder { - color: #f00; - font-weight: bold; - opacity: 1; -} - -input:focus::-moz-placeholder { - opacity: 0; -} - -:focus::-webkit-input-placeholder { - opacity: 0; -} - input.tunnelName, input.tunnelDescriptionText, #userAgents { width: 80%; min-width: 280px; @@ -1051,16 +1027,6 @@ input.tunnelName, input.tunnelDescriptionText, #userAgents { line-height: 140%; } -#wizardPanel input::-moz-placeholder { - color: #bb7; - font-weight: normal; -} - -#wizardPanel ::-webkit-input-placeholder { - color: #bb7; - font-weight: normal; -} - #wizardPanel .options { padding: 10px; } diff --git a/apps/i2ptunnel/jsp/themes/light/i2ptunnel.css b/apps/i2ptunnel/jsp/themes/light/i2ptunnel.css index 9ad8ce61a..83e949d2c 100644 --- a/apps/i2ptunnel/jsp/themes/light/i2ptunnel.css +++ b/apps/i2ptunnel/jsp/themes/light/i2ptunnel.css @@ -785,28 +785,6 @@ table#statusMessages textarea, table#statusMessages textarea:active { padding: 0; } -.required:not(old) { - display: none; -} - -input::-moz-placeholder { - color: #f00; - opacity: 1; -} - -input:focus::-moz-placeholder { - opacity: 0; -} - -::-webkit-input-placeholder { - color: #f00; - opacity: 1; -} - -:focus::-webkit-input-placeholder { - opacity: 0; -} - input.tunnelName, input.tunnelDescriptionText, #userAgents, .freetext.tunnelDescription { width: 80%; min-width: 280px !important; @@ -919,16 +897,6 @@ input.tunnelName, input.tunnelDescriptionText, #userAgents, .freetext.tunnelDesc text-align: justify; } -#wizardPanel input::-moz-placeholder { - color: #999; - font-weight: normal; -} - -#wizardPanel ::-webkit-input-placeholder { - color: #999; - font-weight: normal; -} - #wizardPanel .options { padding: 10px; } diff --git a/apps/i2ptunnel/jsp/wizard.jsp b/apps/i2ptunnel/jsp/wizard.jsp index 2c2739b10..7640243e3 100644 --- a/apps/i2ptunnel/jsp/wizard.jsp +++ b/apps/i2ptunnel/jsp/wizard.jsp @@ -1,8 +1,7 @@ <%@include file="headers.jsi" %><%@page pageEncoding="UTF-8" %><%@page contentType="text/html" import="net.i2p.i2ptunnel.web.EditBean" -%> - +%> <% String pageStr = request.getParameter("page"); @@ -49,11 +48,8 @@ -
"> -
- <% if (curPage == 1) { %>

<%=intl._t("Server or client tunnel?")%>

<% @@ -73,8 +69,60 @@ - - + <% + /* hidden form data from other pages */ + if (curPage != 1) { + %><% + } + if (curPage != 2) { + %><% + } + if (curPage != 3) { + String name = net.i2p.data.DataHelper.stripHTML(request.getParameter("nofilter_name")); + if (name.length() == 0) + name = "New tunnel"; + %> + " /><% + } + if (curPage != 4 && tunnelIsClient && + ("httpclient".equals(tunnelType) || "connectclient".equals(tunnelType) || "sockstunnel".equals(tunnelType) || "socksirctunnel".equals(tunnelType))) { + %>" /> + " /><% + } + if (curPage != 5) { + if (tunnelIsClient) { + %>" /> + " /><% + } else { + String ip = net.i2p.data.DataHelper.stripHTML(request.getParameter("targetHost")); + if (ip.length() == 0) + ip = "127.0.0.1"; + %> + " /><% + } + } + if (curPage != 6 && + "1".equals(request.getParameter("startOnLoad"))) { + %>" /><% + } + if (curPage == 7) { + /* defaults */ + %> + + + + + + + <% + if (tunnelIsClient) { /* Client-only defaults */ + %> + <% + } else { /* Server-only defaults */ + %><% + } + } + %> <% /* Page 1 - Whether to make a client or server tunnel */ @@ -106,8 +154,6 @@ <% - } else { - %><% } /* curPage 1 */ /* End page 1 */ %> @@ -197,8 +243,6 @@ <% - } else { - %><% } /* curPage 2 */ /* End page 2 */ %> @@ -218,19 +262,16 @@ <% - } else { - %>" /> - " /><% } /* curPage 3 */ /* End page 3 */ %> @@ -252,12 +293,10 @@ <% - } else { - %>" /><% } /* curPage 4 */ } else if ("client".equals(tunnelType) || "ircclient".equals(tunnelType)) { if (curPage == 4) { @@ -273,14 +312,12 @@ <% - } else { - %>" /><% } /* curPage 4 */ } } /* tunnelIsClient */ @@ -303,18 +340,9 @@ - <% - } else { - %>" /><% - } /* curPage 5 */ - } /* streamrclient or !streamrserver */ %> - <% - if (!tunnelIsClient) { - if (curPage == 5) { - %> <% - } else { - %>" /><% } /* curPage 5 */ } /* !tunnelIsClient */ %> <% @@ -347,18 +373,9 @@ - <% - } else { - %>" /><% - } /* curPage 5 */ - } /* tunnelIsClient or httpbidirserver */ %> - <% - if (tunnelIsClient) { - if (curPage == 5) { - %> <% - } else { - %>" /><% } /* curPage 5 */ - } /* (tunnelIsClient && !streamrclient) || httpbidirserver || streamrserver */ + } /* tunnelIsClient */ /* End page 5 */ %> @@ -419,10 +434,6 @@ <% - } else { - if ("1".equals(request.getParameter("startOnLoad"))) { - %>" /><% - } } /* curPage 6 */ /* End page 6 */ %> @@ -486,15 +497,11 @@ <% if (!tunnelIsClient) { %> <% - } - if (!tunnelIsClient) { %> + <%=net.i2p.data.DataHelper.stripHTML(request.getParameter("targetHost"))%><% } if (tunnelIsClient) { %> - <% - } - if (tunnelIsClient) { %> + <% } %> <% - } /* tunnelIsClient */ } /* curPage 7 */ /* End page 7 */ %> @@ -539,7 +530,7 @@
<%=intl._t("Name")%>: - " value="<%=(!"null".equals(request.getParameter("nofilter_name")) ? net.i2p.data.DataHelper.stripHTML(request.getParameter("nofilter_name")) : "" ) %>" class="freetext" /> + " value="<%=net.i2p.data.DataHelper.stripHTML(request.getParameter("nofilter_name"))%>" class="freetext" />
<%=intl._t("Description")%>: - " value="<%=(!"null".equals(request.getParameter("nofilter_description")) ? net.i2p.data.DataHelper.stripHTML(request.getParameter("nofilter_description")) : "" ) %>" class="freetext" /> + " value="<%=net.i2p.data.DataHelper.stripHTML(request.getParameter("nofilter_description"))%>" class="freetext" />
<%=intl._t("Outproxies")%>: - " value="<%=(!"null".equals(request.getParameter("proxyList")) ? net.i2p.data.DataHelper.stripHTML(request.getParameter("proxyList")) : "" ) %>" class="freetext" /> + " value="<%=net.i2p.data.DataHelper.stripHTML(request.getParameter("proxyList"))%>" class="freetext" />
<%=intl._t("Tunnel Destination")%>: - " value="<%=(!"null".equals(request.getParameter("targetDestination")) ? net.i2p.data.DataHelper.stripHTML(request.getParameter("targetDestination")) : "" ) %>" class="freetext" /> + " value="<%=net.i2p.data.DataHelper.stripHTML(request.getParameter("targetDestination")) %>" class="freetext" placeholder="<%=intl._t("required")%>" required />  (<%=intl._t("name, name:port, or destination")%> )
<%=intl._t("Host")%>: - " placeholder="127.0.0.1" value="<%=(!"null".equals(request.getParameter("targetHost")) ? net.i2p.data.DataHelper.stripHTML(request.getParameter("targetHost")) : "127.0.0.1" ) %>" class="freetext" /> + " placeholder="<%=intl._t("required")%>" required value="<%=net.i2p.data.DataHelper.stripHTML(request.getParameter("targetHost"))%>" class="freetext" />

@@ -325,12 +353,10 @@

<%=intl._t("Port")%>: - " value="<%=(!"null".equals(request.getParameter("targetPort")) ? net.i2p.data.DataHelper.stripHTML(request.getParameter("targetPort")) : "" ) %>" class="freetext" /> + " value="<%=net.i2p.data.DataHelper.stripHTML(request.getParameter("targetPort"))%>" class="freetext" placeholder="<%=intl._t("required")%>" required />
<%=intl._t("Port")%>: - " value="<%=(!"null".equals(request.getParameter("port")) ? net.i2p.data.DataHelper.stripHTML(request.getParameter("port")) : "" ) %>" class="freetext" /> + " value="<%=net.i2p.data.DataHelper.stripHTML(request.getParameter("port"))%>" class="freetext" placeholder="<%=intl._t("required")%>" required />

@@ -375,7 +392,7 @@

<%=intl._t("Binding address")%> - <%=net.i2p.data.DataHelper.stripHTML(request.getParameter("targetHost"))%>
<%=intl._t("Tunnel port")%><%=net.i2p.data.DataHelper.stripHTML(request.getParameter("targetPort"))%>
<%=intl._t("Port")%><%=net.i2p.data.DataHelper.stripHTML(request.getParameter("port"))%>
<%=intl._t("Port")%><%=net.i2p.data.DataHelper.stripHTML(request.getParameter("port"))%>
<%=intl._t("Reachable by")%><%=net.i2p.data.DataHelper.stripHTML(request.getParameter("reachableBy"))%>
<%=intl._t("Tunnel auto-start")%><% @@ -513,25 +520,9 @@ <%=intl._t("Alongside these basic settings, there are a number of advanced options for tunnel configuration.")%> <%=intl._t("The wizard will set reasonably sensible default values for these, but you can view and/or edit these by clicking on the tunnel's name in the main I2PTunnel page.")%>

- - - - - - - - - <% - - if (tunnelIsClient) { /* Client-only defaults */ - %> - <% - } else { /* Server-only defaults */ - %>
" href="list"><%=intl._t("Cancel")%> <% if (curPage != 1 && curPage != 7) { - %><% + %><% } %> <% if (curPage == 7) { %><% @@ -552,8 +543,6 @@
-
-