- Tweak display name of HTTP client tunnel

- Show outproxy plugin status on i2ptunnel index page
This commit is contained in:
zzz
2014-01-25 17:56:35 +00:00
parent d00be4ceee
commit 0f862124fe
3 changed files with 37 additions and 9 deletions

View File

@@ -22,6 +22,8 @@ import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentHashMap;
import net.i2p.I2PAppContext;
import net.i2p.app.ClientAppManager;
import net.i2p.app.Outproxy;
import net.i2p.data.Base32;
import net.i2p.data.Certificate;
import net.i2p.data.Destination;
@@ -502,7 +504,7 @@ public class IndexBean {
public String getTypeName(String internalType) {
if ("client".equals(internalType)) return _("Standard client");
else if ("httpclient".equals(internalType)) return _("HTTP client");
else if ("httpclient".equals(internalType)) return _("HTTP/HTTPS client");
else if ("ircclient".equals(internalType)) return _("IRC client");
else if ("server".equals(internalType)) return _("Standard server");
else if ("httpserver".equals(internalType)) return _("HTTP server");
@@ -644,6 +646,26 @@ public class IndexBean {
return "";
}
/**
* For index.jsp
* @return true if the plugin is enabled, installed, and running
* @since 0.9.11
*/
public boolean getIsUsingOutproxyPlugin(int tunnel) {
TunnelController tun = getController(tunnel);
if (tun != null) {
if ("httpclient".equals(tun.getType())) {
Properties opts = tun.getClientOptionProps();
if (Boolean.parseBoolean(opts.getProperty(I2PTunnelHTTPClient.PROP_USE_OUTPROXY_PLUGIN, "true"))) {
ClientAppManager mgr = _context.clientAppManager();
if (mgr != null)
return mgr.getRegisteredApp(Outproxy.NAME) != null;
}
}
}
return false;
}
///
/// bean props for form submission
///

View File

@@ -302,16 +302,22 @@
<% } %>
</label>
<div class="text">
<% String cdest = indexBean.getClientDestination(curClient);
if (cdest.length() > 70) { // Probably a B64 (a B32 is 60 chars) so truncate
%><%=cdest.substring(0, 45)%>&hellip;<%=cdest.substring(cdest.length() - 15, cdest.length())%><%
} else if (cdest.length() > 0) {
%><%=cdest%><%
<%
if (indexBean.getIsUsingOutproxyPlugin(curClient)) {
%><%=intl._("internal plugin")%><%
} else {
%><i><%=intl._("none")%></i><%
String cdest = indexBean.getClientDestination(curClient);
if (cdest.length() > 70) { // Probably a B64 (a B32 is 60 chars) so truncate
%><%=cdest.substring(0, 45)%>&hellip;<%=cdest.substring(cdest.length() - 15, cdest.length())%><%
} else if (cdest.length() > 0) {
%><%=cdest%><%
} else {
%><i><%=intl._("none")%></i><%
}
} %>
</div>
</div>
<% /* TODO SSL outproxy for httpclient if plugin not present */ %>
<div class="descriptionField rowItem">
<label><%=intl._("Description")%>:</label>
@@ -335,7 +341,7 @@
<label><%=intl._("New client tunnel")%>:</label>
<select name="type">
<option value="client"><%=intl._("Standard")%></option>
<option value="httpclient">HTTP</option>
<option value="httpclient">HTTP/CONNECT</option>
<option value="ircclient">IRC</option>
<option value="sockstunnel">SOCKS 4/4a/5</option>
<option value="socksirctunnel">SOCKS IRC</option>

View File

@@ -190,7 +190,7 @@
if (tunnelIsClient) {
%><select name="type">
<option value="client"><%=intl._("Standard")%></option>
<option value="httpclient">HTTP</option>
<option value="httpclient">HTTP/CONNECT</option>
<option value="ircclient">IRC</option>
<option value="sockstunnel">SOCKS 4/4a/5</option>
<option value="socksirctunnel">SOCKS IRC</option>