diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java
index 6b92b1b03f..fa108a0b8e 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java
@@ -274,6 +274,13 @@ public class EditBean extends IndexBean {
return true;
}
+ /** @since 0.9.46 */
+ public boolean canChangePort(int tunnel) {
+ if (tunnel < 0)
+ return true;
+ return getTunnelStatus(tunnel) == GeneralHelper.NOT_RUNNING;
+ }
+
/**
* @param encType code
* @since 0.9.44
diff --git a/apps/i2ptunnel/jsp/editClient.jsi b/apps/i2ptunnel/jsp/editClient.jsi
index 589bde8859..2727973380 100644
--- a/apps/i2ptunnel/jsp/editClient.jsi
+++ b/apps/i2ptunnel/jsp/editClient.jsi
@@ -62,7 +62,16 @@
<%=intl._t("Automatically start tunnel when router starts")%>
-
+<%
+ String aStopFirst = intl._t("Tunnel and all other shared client tunnels must be stopped to change this configuration");
+ String bStopFirst = intl._t("Tunnel must be stopped to change this configuration");
+ String stopFirst = editBean.isSharedClient(curTunnel) ? aStopFirst : bStopFirst;
+ boolean canChangePort = editBean.canChangePort(curTunnel);
+ String tastopFirst = " title=\"" + aStopFirst + "\" ";
+ String tbstopFirst = " title=\"" + bStopFirst + "\" ";
+ String phdisabled = canChangePort ? "" : tbstopFirst;
+%>
+ >
<% if ("streamrclient".equals(tunnelType)) { %>
<%=intl._t("Target")%>
<% } else { %>
@@ -79,8 +88,11 @@
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 ? "" : " disabled=\"disabled\" ";
%>
- " value="<%=editBean.getClientPort(curTunnel)%>" class="freetext port" placeholder="required" />
+ />
<%
if ("streamrclient".equals(tunnelType)) {
@@ -99,10 +111,12 @@
<%
} else {
+ String ihelp = intl._t("Local interface (ip address) the client tunnel will be reachable from");
+ String itext = canChangePort ? ihelp : bStopFirst;
%>
<%=intl._t("Reachable by")%>:
- " class="selectbox">
+ >
<%
String clientInterface = editBean.getClientInterface(curTunnel);
for (String ifc : editBean.interfaceSet()) {
@@ -494,9 +508,6 @@
int currentSigType = editBean.getSigType(curTunnel, tunnelType);
boolean canChangeSigType = editBean.canChangeSigType(curTunnel);
- String stopFirst = editBean.isSharedClient(curTunnel) ?
- intl._t("Tunnel and all other shared client tunnels must be stopped to change this configuration") :
- intl._t("Tunnel must be stopped to change this configuration");
String tstopFirst = " title=\"" + stopFirst + "\" ";
String shdisabled = canChangeSigType ? "" : tstopFirst;
String disabled = canChangeSigType ? "" : " disabled=\"disabled\" ";
diff --git a/apps/i2ptunnel/jsp/editServer.jsi b/apps/i2ptunnel/jsp/editServer.jsi
index 6e203066c6..431ad426be 100644
--- a/apps/i2ptunnel/jsp/editServer.jsi
+++ b/apps/i2ptunnel/jsp/editServer.jsi
@@ -61,15 +61,27 @@
<%=intl._t("Automatically start tunnel when router starts")%>
-
- <% if ("streamrserver".equals(tunnelType)) { %>
+<%
+ String stopFirst = intl._t("Tunnel must be stopped to change this configuration");
+ String tstopFirst = " title=\"" + stopFirst + "\" ";
+ boolean canChangeDest = editBean.canChangePort(curTunnel);
+ boolean isStreamrServer = "streamrserver".equals(tunnelType);
+ boolean isBidirServer = "httpbidirserver".equals(tunnelType);
+ boolean canChangePort = canChangeDest || !(isStreamrServer || isBidirServer);
+ String phdisabled = canChangePort ? "" : tstopFirst;
+%>
+ >
+<%
+ if (isStreamrServer) { %>
<%=intl._t("Access Point")%>
<% } else { %>
<%=intl._t("Target")%>
<% } %>
- <% if (!"streamrserver".equals(tunnelType)) { %>
+<%
+ if (!isStreamrServer) {
+%>
<%=intl._t("Host")%>:
" value="<%=editBean.getTargetHost(curTunnel)%>" class="freetext host" />
@@ -83,16 +95,20 @@
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 ? "" : " disabled=\"disabled\" ";
%>
- " value="<%=editBean.getTargetPort(curTunnel)%>" class="freetext port" placeholder="required" />
-<% if (!"streamrserver".equals(tunnelType)) { %>
+ />
+<% if (!isStreamrServer) { %>
"> class="tickbox" />
<%=intl._t("Use SSL to connect to target")%>
<% } /* !streamrserver */ %>
-<% if ("httpbidirserver".equals(tunnelType)) { %>
+<% if (isBidirServer) { %>
-
+ >
<%=intl._t("Access Point")%>
@@ -105,16 +121,21 @@
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;
%>
- " value="<%=editBean.getClientPort(curTunnel)%>" class="freetext port" placeholder="required" />
+ />
<% } /* httpbidirserver */
- if ("httpbidirserver".equals(tunnelType) || "streamrserver".equals(tunnelType)) {
+ if (isBidirServer || isStreamrServer) {
%>
<%=intl._t("Reachable by")%>:
-
- " class="selectbox">
+<%
+ String esphelp = intl._t("Listening interface (IP address) for client access (normally 127.0.0.1)");
+ String fsphelp = canChangePort ? esphelp : stopFirst;
+%>
+ >
<%
String clientInterface = editBean.getClientInterface(curTunnel);
for (String ifc : editBean.interfaceSet()) {
@@ -132,7 +153,7 @@
<% } /* httpbidirserver || streamrserver */ %>
-<% if (("httpserver".equals(tunnelType)) || ("httpbidirserver".equals(tunnelType))) {
+<% if ("httpserver".equals(tunnelType) || isBidirServer) {
%>
@@ -150,26 +171,33 @@
<%=intl._t("Local destination")%>
-
+<%
+ String dhdisable = canChangeDest ? "" : tstopFirst;
+%>
+ >
<%=intl._t("Private key file")%>
" tabindex="0" onblur="resetScrollLeft(this)"><%=editBean.getDestinationBase64(curTunnel)%>
- <% String value3 = editBean.getPrivateKeyFile(curTunnel);
+<%
+ String value3 = editBean.getPrivateKeyFile(curTunnel);
if (value3 == null || "".equals(value3.trim())) {
out.write(" (");
out.write(intl._t("required"));
out.write(") ");
}
- %>
- " value="<%=editBean.getPrivateKeyFile(curTunnel)%>" class="freetext" placeholder="required" />
+ String htext = intl._t("Path to Private Key File");
+ String dtext = canChangeDest ? htext : stopFirst;
+ String ddisabled = canChangeDest ? "" : " disabled=\"disabled\" ";
+%>
+ />
<%
/******
- if (("httpserver".equals(tunnelType)) || ("httpbidirserver".equals(tunnelType))) {
+ if ("httpserver".equals(tunnelType) || isBidirServer) {
String sig = editBean.getNameSignature(curTunnel);
if (sig.length() > 0) {
%>
@@ -212,7 +240,7 @@
%>
" href="register?tunnel=<%=curTunnel%>"><%=intl._t("Registration Authentication")%>
<%
- if (("httpserver".equals(tunnelType)) || ("httpbidirserver".equals(tunnelType))) {
+ if ("httpserver".equals(tunnelType) || isBidirServer) {
%>
" href="ssl?tunnel=<%=curTunnel%>"><%=intl._t("SSL Wizard")%>
<%
@@ -407,8 +435,6 @@
%>
<%
boolean canChangeEncType = editBean.canChangeEncType(curTunnel);
- String stopFirst = intl._t("Tunnel must be stopped to change this configuration");
- String tstopFirst = " title=\"" + stopFirst + "\" ";
String ehdisabled = canChangeEncType ? "" : tstopFirst;
// TODO, encrypted + offline is unimplemented
@@ -499,8 +525,10 @@
<%
if (allowBlinding /* && editBean.isAdvanced() */) {
- String pwTitle = "title=\"" + intl._t("Set password required to access this service") +
- (canChangeEncType ? "" : (" - " + stopFirst)) + '"';
+ String pwTitle = "title=\"" +
+ (canChangeEncType ?
+ intl._t("Set password required to access this service") :
+ stopFirst) + '"';
%>
value="<%=editBean.getBlindedPassword(curTunnel)%>" class="freetext password" <%=bdisabled%>/>
<%
@@ -687,7 +715,7 @@
<%
/* alternate dest, only if current dest is set and is DSA_SHA1 */
- if (currentSigType == 0 && !"".equals(b64) && !"streamrserver".equals(tunnelType)) {
+ if (currentSigType == 0 && !"".equals(b64) && !isStreamrServer) {
%>
@@ -794,7 +822,7 @@
<%
- if (("httpserver".equals(tunnelType)) || ("httpbidirserver".equals(tunnelType))) {
+ if ("httpserver".equals(tunnelType) || isBidirServer) {
%>
@@ -831,7 +859,7 @@
<%
- if (!"streamrserver".equals(tunnelType)) {
+ if (!isStreamrServer) {
%>
@@ -871,7 +899,7 @@
<%
- if (("httpserver".equals(tunnelType)) || ("httpbidirserver".equals(tunnelType))) {
+ if ("httpserver".equals(tunnelType) || isBidirServer) {
%>