forked from I2P_Developers/i2p.i2p
Console: Hide links to webapps that are not running (ticket #2161)
Hide link to /configplugins if disabled
This commit is contained in:
@ -14,6 +14,8 @@ import net.i2p.router.web.ConfigUpdateHandler;
|
||||
import net.i2p.router.web.HelperBase;
|
||||
import net.i2p.router.web.Messages;
|
||||
import net.i2p.router.web.NavHelper;
|
||||
import net.i2p.router.web.PluginStarter;
|
||||
import net.i2p.router.web.WebAppStarter;
|
||||
import net.i2p.util.PortMapper;
|
||||
|
||||
/**
|
||||
@ -194,6 +196,20 @@ public class HomeHelper extends HelperBase {
|
||||
':' + _context.portMapper().getPort(PortMapper.SVC_EEPSITE, 7658) + '/';
|
||||
} else {
|
||||
url = app.url;
|
||||
// check for disabled webapps and other things
|
||||
if (url.equals("/dns")) {
|
||||
if (!WebAppStarter.isWebAppRunning("susidns"))
|
||||
continue;
|
||||
} else if (url.equals("/webmail")) {
|
||||
if (!WebAppStarter.isWebAppRunning("susimail"))
|
||||
continue;
|
||||
} else if (url.equals("/torrents")) {
|
||||
if (!WebAppStarter.isWebAppRunning("i2psnark"))
|
||||
continue;
|
||||
} else if (url.equals("/configplugins")) {
|
||||
if (!PluginStarter.pluginsEnabled(_context))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
buf.append("\n<div class=\"app\">\n" +
|
||||
"<div class=\"appimg\">" +
|
||||
|
@ -38,6 +38,7 @@ import net.i2p.router.TunnelPoolSettings;
|
||||
import net.i2p.router.util.HashDistance; // debug
|
||||
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
|
||||
import net.i2p.router.web.Messages;
|
||||
import net.i2p.router.web.WebAppStarter;
|
||||
import net.i2p.util.Log;
|
||||
import net.i2p.util.ObjectCounter;
|
||||
import net.i2p.util.Translate;
|
||||
@ -289,6 +290,7 @@ class NetDbRenderer {
|
||||
medianCount = rapCount / 2;
|
||||
}
|
||||
|
||||
boolean linkSusi = WebAppStarter.isWebAppRunning("susidns");
|
||||
long now = _context.clock().now();
|
||||
buf.append("<div class=\"leasesets_container\">");
|
||||
for (LeaseSet ls : leases) {
|
||||
@ -318,13 +320,13 @@ class NetDbRenderer {
|
||||
if (!unpublished) {
|
||||
host = _context.namingService().reverseLookup(dest);
|
||||
}
|
||||
if (unpublished || host != null) {
|
||||
if (unpublished || host != null || !linkSusi) {
|
||||
buf.append(" colspan=\"2\"");
|
||||
}
|
||||
buf.append(">");
|
||||
String b32 = dest.toBase32();
|
||||
buf.append("<a href=\"http://").append(b32).append("\">").append(b32).append("</a></td>");
|
||||
if (!unpublished) {
|
||||
if (linkSusi && !unpublished) {
|
||||
if (host == null) {
|
||||
buf.append("<td class=\"addtobook\" colspan=\"2\">").append("<a title=\"").append(_t("Add to addressbook"))
|
||||
.append("\" href=\"/susidns/addressbook.jsp?book=private&destination=")
|
||||
@ -339,11 +341,15 @@ class NetDbRenderer {
|
||||
} else {
|
||||
String b32 = dest.toBase32();
|
||||
buf.append("<code>").append(dest.toBase64().substring(0, 6)).append("</code></th>")
|
||||
.append("</tr>\n<tr>")
|
||||
.append("<td><a href=\"http://").append(b32).append("\">").append(b32).append("</a></td>\n")
|
||||
.append("<td class=\"addtobook\"><a title=\"").append(_t("Add to addressbook"))
|
||||
.append("</tr>\n<tr><td");
|
||||
if (!linkSusi)
|
||||
buf.append(" colspan=\"2\"");
|
||||
buf.append("><a href=\"http://").append(b32).append("\">").append(b32).append("</a></td>\n");
|
||||
if (linkSusi) {
|
||||
buf.append("<td class=\"addtobook\"><a title=\"").append(_t("Add to addressbook"))
|
||||
.append("\" href=\"/susidns/addressbook.jsp?book=private&destination=")
|
||||
.append(dest.toBase64()).append("#add\">").append(_t("Add to local addressbook")).append("</a></td>");
|
||||
}
|
||||
}
|
||||
}
|
||||
buf.append("</tr>\n<tr><td colspan=\"2\">\n");
|
||||
|
@ -21,6 +21,7 @@ import net.i2p.router.web.Messages;
|
||||
import net.i2p.router.web.NavHelper;
|
||||
import net.i2p.router.web.NewsHelper;
|
||||
import net.i2p.router.web.StatSummarizer;
|
||||
import net.i2p.router.web.WebAppStarter;
|
||||
import net.i2p.util.PortMapper;
|
||||
import net.i2p.util.SystemVersion;
|
||||
|
||||
@ -211,21 +212,25 @@ class SummaryBarRenderer {
|
||||
.append(_t("I2P Services"))
|
||||
.append("</a></h3>\n" +
|
||||
|
||||
"<hr class=\"b\"><table id=\"sb_services\"><tr><td>" +
|
||||
"<hr class=\"b\"><table id=\"sb_services\"><tr><td>");
|
||||
|
||||
"<a href=\"/webmail\" target=\"_top\" title=\"")
|
||||
if (WebAppStarter.isWebAppRunning("susimail")) {
|
||||
buf.append("<a href=\"/webmail\" target=\"_top\" title=\"")
|
||||
.append(_t("Anonymous webmail client"))
|
||||
.append("\">")
|
||||
.append(nbsp(_t("Email")))
|
||||
.append("</a>\n" +
|
||||
.append("</a>\n");
|
||||
}
|
||||
|
||||
"<a href=\"/torrents\" target=\"_top\" title=\"")
|
||||
if (WebAppStarter.isWebAppRunning("i2psnark")) {
|
||||
buf.append("<a href=\"/torrents\" target=\"_top\" title=\"")
|
||||
.append(_t("Built-in anonymous BitTorrent Client"))
|
||||
.append("\">")
|
||||
.append(nbsp(_t("Torrents")))
|
||||
.append("</a>\n" +
|
||||
.append("</a>\n");
|
||||
}
|
||||
|
||||
"<a href=\"http://")
|
||||
buf.append("<a href=\"http://")
|
||||
.append(_context.portMapper().getActualHost(PortMapper.SVC_EEPSITE, "127.0.0.1"))
|
||||
.append(':')
|
||||
.append(_context.portMapper().getPort(PortMapper.SVC_EEPSITE, 7658))
|
||||
@ -249,13 +254,15 @@ class SummaryBarRenderer {
|
||||
.append(_t("I2P Internals"))
|
||||
.append("</a></h3><hr class=\"b\">\n" +
|
||||
|
||||
"<table id=\"sb_internals\"><tr><td>\n" +
|
||||
"<table id=\"sb_internals\"><tr><td>\n");
|
||||
|
||||
"<a href=\"/dns\" target=\"_top\" title=\"")
|
||||
if (WebAppStarter.isWebAppRunning("susidns")) {
|
||||
buf.append("<a href=\"/dns\" target=\"_top\" title=\"")
|
||||
.append(_t("Manage your I2P hosts file here (I2P domain name resolution)"))
|
||||
.append("\">")
|
||||
.append(nbsp(_t("Addressbook")))
|
||||
.append("</a>\n");
|
||||
}
|
||||
|
||||
if (!StatSummarizer.isDisabled()) {
|
||||
buf.append("<a href=\"/graphs\" target=\"_top\" title=\"")
|
||||
@ -269,15 +276,17 @@ class SummaryBarRenderer {
|
||||
.append(_t("Router Help and FAQ"))
|
||||
.append("\">")
|
||||
.append(nbsp(_t("Help")))
|
||||
.append("</a>\n" +
|
||||
.append("</a>\n");
|
||||
|
||||
"<a href=\"/i2ptunnelmgr\" target=\"_top\" title=\"")
|
||||
if (WebAppStarter.isWebAppRunning("i2ptunnel")) {
|
||||
buf.append("<a href=\"/i2ptunnelmgr\" target=\"_top\" title=\"")
|
||||
.append(_t("Local Tunnels"))
|
||||
.append("\">")
|
||||
.append(nbsp(_t("Hidden Services Manager")))
|
||||
.append("</a>\n" +
|
||||
.append("</a>\n");
|
||||
}
|
||||
|
||||
"<a href=\"/logs\" target=\"_top\" title=\"")
|
||||
buf.append("<a href=\"/logs\" target=\"_top\" title=\"")
|
||||
.append(_t("Health Report"))
|
||||
.append("\">")
|
||||
.append(nbsp(_t("Logs")))
|
||||
|
@ -28,6 +28,7 @@ import net.i2p.router.transport.TransportUtil;
|
||||
import net.i2p.router.web.CSSHelper;
|
||||
import net.i2p.router.web.HelperBase;
|
||||
import net.i2p.router.web.NewsHelper;
|
||||
import net.i2p.router.web.WebAppStarter;
|
||||
import net.i2p.servlet.util.ServletUtil;
|
||||
import net.i2p.stat.Rate;
|
||||
import net.i2p.stat.RateStat;
|
||||
@ -557,10 +558,18 @@ public class SummaryHelper extends HelperBase {
|
||||
List<Destination> clients = new ArrayList<Destination>(_context.clientManager().listClients());
|
||||
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/i2ptunnelmgr\" target=\"_top\" title=\"")
|
||||
boolean link = WebAppStarter.isWebAppRunning("i2ptunnel");
|
||||
buf.append("<h3>");
|
||||
if (link) {
|
||||
buf.append("<a href=\"/i2ptunnelmgr\" target=\"_top\" title=\"")
|
||||
.append(_t("Add/remove/edit & control your client and server tunnels"))
|
||||
.append("\">").append(_t("Local Tunnels"))
|
||||
.append("</a></h3><hr class=\"b\">");
|
||||
.append("\">");
|
||||
}
|
||||
buf.append(_t("Local Tunnels"));
|
||||
if (link) {
|
||||
buf.append("</a>");
|
||||
}
|
||||
buf.append("</h3><hr class=\"b\">");
|
||||
if (!clients.isEmpty()) {
|
||||
Collections.sort(clients, new AlphaComparator());
|
||||
buf.append("<table id=\"sb_localtunnels\">");
|
||||
|
Reference in New Issue
Block a user