handle missing fields in i2ptunnel edit pages better
This commit is contained in:
@ -41,11 +41,11 @@ public class EditBean extends IndexBean {
|
|||||||
if (tun != null)
|
if (tun != null)
|
||||||
return tun.getTargetHost();
|
return tun.getTargetHost();
|
||||||
else
|
else
|
||||||
return "";
|
return "127.0.0.1";
|
||||||
}
|
}
|
||||||
public String getTargetPort(int tunnel) {
|
public String getTargetPort(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
TunnelController tun = getController(tunnel);
|
||||||
if (tun != null)
|
if (tun != null && tun.getTargetPort() != null)
|
||||||
return tun.getTargetPort();
|
return tun.getTargetPort();
|
||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
@ -59,7 +59,7 @@ public class EditBean extends IndexBean {
|
|||||||
}
|
}
|
||||||
public String getPrivateKeyFile(int tunnel) {
|
public String getPrivateKeyFile(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
TunnelController tun = getController(tunnel);
|
||||||
if (tun != null)
|
if (tun != null && tun.getPrivKeyFile() != null)
|
||||||
return tun.getPrivKeyFile();
|
return tun.getPrivKeyFile();
|
||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
@ -266,4 +266,4 @@ public class EditBean extends IndexBean {
|
|||||||
}
|
}
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,7 @@ public class IndexBean {
|
|||||||
_curNonce = -1;
|
_curNonce = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPassphrase(String phrase) {
|
public void setPassphrase(String phrase) {
|
||||||
_passphrase = phrase;
|
_passphrase = phrase;
|
||||||
}
|
}
|
||||||
@ -332,15 +333,15 @@ public class IndexBean {
|
|||||||
|
|
||||||
public String getTunnelName(int tunnel) {
|
public String getTunnelName(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
TunnelController tun = getController(tunnel);
|
||||||
if (tun != null)
|
if (tun != null && tun.getName() != null)
|
||||||
return tun.getName();
|
return tun.getName();
|
||||||
else
|
else
|
||||||
return "";
|
return "New Tunnel";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getClientPort(int tunnel) {
|
public String getClientPort(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
TunnelController tun = getController(tunnel);
|
||||||
if (tun != null)
|
if (tun != null && tun.getListenPort() != null)
|
||||||
return tun.getListenPort();
|
return tun.getListenPort();
|
||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
@ -389,7 +390,7 @@ public class IndexBean {
|
|||||||
|
|
||||||
public String getTunnelDescription(int tunnel) {
|
public String getTunnelDescription(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
TunnelController tun = getController(tunnel);
|
||||||
if (tun != null)
|
if (tun != null && tun.getDescription() != null)
|
||||||
return tun.getDescription();
|
return tun.getDescription();
|
||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
@ -406,7 +407,12 @@ public class IndexBean {
|
|||||||
public String getClientDestination(int tunnel) {
|
public String getClientDestination(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
TunnelController tun = getController(tunnel);
|
||||||
if (tun == null) return "";
|
if (tun == null) return "";
|
||||||
if ("client".equals(tun.getType())||"ircclient".equals(tun.getType())) return tun.getTargetDestination();
|
if ("client".equals(tun.getType())||"ircclient".equals(tun.getType())) {
|
||||||
|
if (tun.getTargetDestination() != null)
|
||||||
|
return tun.getTargetDestination();
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
else return tun.getProxyList();
|
else return tun.getProxyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,10 @@
|
|||||||
<div id="portField" class="rowItem">
|
<div id="portField" class="rowItem">
|
||||||
<label for="port" accesskey="P">
|
<label for="port" accesskey="P">
|
||||||
<span class="accessKey">P</span>ort:
|
<span class="accessKey">P</span>ort:
|
||||||
|
<% String value = editBean.getClientPort(curTunnel);
|
||||||
|
if (value == null || "".equals(value.trim()))
|
||||||
|
out.write(" <font color=\"red\">(required)</font>");
|
||||||
|
%>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" size="6" maxlength="5" id="port" name="port" title="Access Port Number" value="<%=editBean.getClientPort(curTunnel)%>" class="freetext" />
|
<input type="text" size="6" maxlength="5" id="port" name="port" title="Access Port Number" value="<%=editBean.getClientPort(curTunnel)%>" class="freetext" />
|
||||||
</div>
|
</div>
|
||||||
@ -123,6 +127,10 @@
|
|||||||
%><div id="destinationField" class="rowItem">
|
%><div id="destinationField" class="rowItem">
|
||||||
<label for="targetDestination" accesskey="T">
|
<label for="targetDestination" accesskey="T">
|
||||||
<span class="accessKey">T</span>unnel Destination:
|
<span class="accessKey">T</span>unnel Destination:
|
||||||
|
<% String value2 = editBean.getClientDestination(curTunnel);
|
||||||
|
if (value2 == null || "".equals(value2.trim()))
|
||||||
|
out.write(" <font color=\"red\">(required)</font>");
|
||||||
|
%>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" size="30" id="targetDestination" name="targetDestination" title="Destination of the Tunnel" value="<%=editBean.getClientDestination(curTunnel)%>" class="freetext" />
|
<input type="text" size="30" id="targetDestination" name="targetDestination" title="Destination of the Tunnel" value="<%=editBean.getClientDestination(curTunnel)%>" class="freetext" />
|
||||||
<span class="comment">(name or destination)</span>
|
<span class="comment">(name or destination)</span>
|
||||||
|
@ -93,6 +93,10 @@
|
|||||||
<div id="portField" class="rowItem">
|
<div id="portField" class="rowItem">
|
||||||
<label for="targetPort" accesskey="P">
|
<label for="targetPort" accesskey="P">
|
||||||
<span class="accessKey">P</span>ort:
|
<span class="accessKey">P</span>ort:
|
||||||
|
<% String value = editBean.getTargetPort(curTunnel);
|
||||||
|
if (value == null || "".equals(value.trim()))
|
||||||
|
out.write(" <font color=\"red\">(required)</font>");
|
||||||
|
%>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" size="6" maxlength="5" id="targetPort" name="targetPort" title="Target Port Number" value="<%=editBean.getTargetPort(curTunnel)%>" class="freetext" />
|
<input type="text" size="6" maxlength="5" id="targetPort" name="targetPort" title="Target Port Number" value="<%=editBean.getTargetPort(curTunnel)%>" class="freetext" />
|
||||||
</div>
|
</div>
|
||||||
@ -112,6 +116,10 @@
|
|||||||
%><div id="privKeyField" class="rowItem">
|
%><div id="privKeyField" class="rowItem">
|
||||||
<label for="privKeyFile" accesskey="k">
|
<label for="privKeyFile" accesskey="k">
|
||||||
Private <span class="accessKey">k</span>ey file:
|
Private <span class="accessKey">k</span>ey file:
|
||||||
|
<% String value2 = editBean.getPrivateKeyFile(curTunnel);
|
||||||
|
if (value2 == null || "".equals(value2.trim()))
|
||||||
|
out.write(" <font color=\"red\">(required)</font>");
|
||||||
|
%>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" size="30" id="privKeyFile" name="privKeyFile" title="Path to Private Key File" value="<%=editBean.getPrivateKeyFile(curTunnel)%>" class="freetext" />
|
<input type="text" size="30" id="privKeyFile" name="privKeyFile" title="Path to Private Key File" value="<%=editBean.getPrivateKeyFile(curTunnel)%>" class="freetext" />
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user