Disable I2CP host/port options when in router context
This commit is contained in:
@ -270,7 +270,14 @@ public class EditBean extends IndexBean {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @since 0.8.3 */
|
||||||
|
public boolean isRouterContext() {
|
||||||
|
return _context.isRouterContext();
|
||||||
|
}
|
||||||
|
|
||||||
public String getI2CPHost(int tunnel) {
|
public String getI2CPHost(int tunnel) {
|
||||||
|
if (_context.isRouterContext())
|
||||||
|
return _("internal");
|
||||||
TunnelController tun = getController(tunnel);
|
TunnelController tun = getController(tunnel);
|
||||||
if (tun != null)
|
if (tun != null)
|
||||||
return tun.getI2CPHost();
|
return tun.getI2CPHost();
|
||||||
@ -279,6 +286,8 @@ public class EditBean extends IndexBean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getI2CPPort(int tunnel) {
|
public String getI2CPPort(int tunnel) {
|
||||||
|
if (_context.isRouterContext())
|
||||||
|
return _("internal");
|
||||||
TunnelController tun = getController(tunnel);
|
TunnelController tun = getController(tunnel);
|
||||||
if (tun != null)
|
if (tun != null)
|
||||||
return tun.getI2CPPort();
|
return tun.getI2CPPort();
|
||||||
|
@ -537,11 +537,11 @@ public class IndexBean {
|
|||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
_description = (description != null ? description.trim() : null);
|
_description = (description != null ? description.trim() : null);
|
||||||
}
|
}
|
||||||
/** I2CP host the router is on */
|
/** I2CP host the router is on, ignored when in router context */
|
||||||
public void setClientHost(String host) {
|
public void setClientHost(String host) {
|
||||||
_i2cpHost = (host != null ? host.trim() : null);
|
_i2cpHost = (host != null ? host.trim() : null);
|
||||||
}
|
}
|
||||||
/** I2CP port the router is on */
|
/** I2CP port the router is on, ignored when in router context */
|
||||||
public void setClientport(String port) {
|
public void setClientport(String port) {
|
||||||
_i2cpPort = (port != null ? port.trim() : null);
|
_i2cpPort = (port != null ? port.trim() : null);
|
||||||
}
|
}
|
||||||
@ -929,12 +929,14 @@ public class IndexBean {
|
|||||||
config.setProperty("name", _name);
|
config.setProperty("name", _name);
|
||||||
if (_description != null)
|
if (_description != null)
|
||||||
config.setProperty("description", _description);
|
config.setProperty("description", _description);
|
||||||
if (_i2cpHost != null)
|
if (!_context.isRouterContext()) {
|
||||||
config.setProperty("i2cpHost", _i2cpHost);
|
if (_i2cpHost != null)
|
||||||
if ( (_i2cpPort != null) && (_i2cpPort.trim().length() > 0) ) {
|
config.setProperty("i2cpHost", _i2cpHost);
|
||||||
config.setProperty("i2cpPort", _i2cpPort);
|
if ( (_i2cpPort != null) && (_i2cpPort.trim().length() > 0) ) {
|
||||||
} else {
|
config.setProperty("i2cpPort", _i2cpPort);
|
||||||
config.setProperty("i2cpPort", "7654");
|
} else {
|
||||||
|
config.setProperty("i2cpPort", "7654");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (_privKeyFile != null)
|
if (_privKeyFile != null)
|
||||||
config.setProperty("privKeyFile", _privKeyFile);
|
config.setProperty("privKeyFile", _privKeyFile);
|
||||||
@ -1020,7 +1022,7 @@ public class IndexBean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String _(String key) {
|
protected String _(String key) {
|
||||||
return Messages._(key, _context);
|
return Messages._(key, _context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -286,19 +286,19 @@
|
|||||||
<% } // !streamrclient %>
|
<% } // !streamrclient %>
|
||||||
|
|
||||||
<div id="optionsField" class="rowItem">
|
<div id="optionsField" class="rowItem">
|
||||||
<label><%=intl._("I2CP Options")%>:</label>
|
<label><%=intl._("Router I2CP Address")%>:</label>
|
||||||
</div>
|
</div>
|
||||||
<div id="optionsHostField" class="rowItem">
|
<div id="optionsHostField" class="rowItem">
|
||||||
<label for="clientHost" accesskey="o">
|
<label for="clientHost" accesskey="o">
|
||||||
<%=intl._("Host")%>(<span class="accessKey">o</span>):
|
<%=intl._("Host")%>(<span class="accessKey">o</span>):
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="clientHost" name="clientHost" size="20" title="I2CP Hostname or IP" value="<%=editBean.getI2CPHost(curTunnel)%>" class="freetext" />
|
<input type="text" id="clientHost" name="clientHost" size="20" title="I2CP Hostname or IP" value="<%=editBean.getI2CPHost(curTunnel)%>" class="freetext" <% if (editBean.isRouterContext()) { %> readonly="readonly" <% } %> />
|
||||||
</div>
|
</div>
|
||||||
<div id="optionsPortField" class="rowItem">
|
<div id="optionsPortField" class="rowItem">
|
||||||
<label for="clientPort" accesskey="r">
|
<label for="clientPort" accesskey="r">
|
||||||
<%=intl._("Port")%>(<span class="accessKey">r</span>):
|
<%=intl._("Port")%>(<span class="accessKey">r</span>):
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="port" name="clientport" size="20" title="I2CP Port Number" value="<%=editBean.getI2CPPort(curTunnel)%>" class="freetext" />
|
<input type="text" id="clientPort" name="clientport" size="20" title="I2CP Port Number" value="<%=editBean.getI2CPPort(curTunnel)%>" class="freetext" <% if (editBean.isRouterContext()) { %> readonly="readonly" <% } %> />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if (!"streamrclient".equals(tunnelType)) { // streamr client sends pings so it will never be idle %>
|
<% if (!"streamrclient".equals(tunnelType)) { // streamr client sends pings so it will never be idle %>
|
||||||
|
@ -305,19 +305,19 @@
|
|||||||
<% } // !streamrserver %>
|
<% } // !streamrserver %>
|
||||||
|
|
||||||
<div id="optionsField" class="rowItem">
|
<div id="optionsField" class="rowItem">
|
||||||
<label><%=intl._("I2CP Options")%>:</label>
|
<label><%=intl._("Router I2CP Address")%>:</label>
|
||||||
</div>
|
</div>
|
||||||
<div id="optionsHostField" class="rowItem">
|
<div id="optionsHostField" class="rowItem">
|
||||||
<label for="clientHost" accesskey="o">
|
<label for="clientHost" accesskey="o">
|
||||||
<%=intl._("Host")%>(<span class="accessKey">o</span>):
|
<%=intl._("Host")%>(<span class="accessKey">o</span>):
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="clientHost" name="clientHost" size="20" title="I2CP Hostname or IP" value="<%=editBean.getI2CPHost(curTunnel)%>" class="freetext" />
|
<input type="text" id="clientHost" name="clientHost" size="20" title="I2CP Hostname or IP" value="<%=editBean.getI2CPHost(curTunnel)%>" class="freetext" <% if (editBean.isRouterContext()) { %> readonly="readonly" <% } %> />
|
||||||
</div>
|
</div>
|
||||||
<div id="optionsPortField" class="rowItem">
|
<div id="optionsPortField" class="rowItem">
|
||||||
<label for="clientPort" accesskey="r">
|
<label for="clientPort" accesskey="r">
|
||||||
<%=intl._("Port")%>(<span class="accessKey">r</span>):
|
<%=intl._("Port")%>(<span class="accessKey">r</span>):
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="clientPort" name="clientport" size="20" title="I2CP Port Number" value="<%=editBean.getI2CPPort(curTunnel)%>" class="freetext" />
|
<input type="text" id="clientPort" name="clientport" size="20" title="I2CP Port Number" value="<%=editBean.getI2CPPort(curTunnel)%>" class="freetext" <% if (editBean.isRouterContext()) { %> readonly="readonly" <% } %> />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="subdivider">
|
<div class="subdivider">
|
||||||
|
Reference in New Issue
Block a user