forked from I2P_Developers/i2p.i2p
i2ptunnel, systray: Replace hardcoded console URL in more places (ticket #2160)
This commit is contained in:
@@ -766,23 +766,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
Hash h1 = ConvertToHash.getHash(requestURI.getHost());
|
||||
Hash h2 = ConvertToHash.getHash(ahelperKey);
|
||||
if (h1 != null && h2 != null) {
|
||||
// Do we need to replace http://127.0.0.1:7657
|
||||
// Get the registered host and port from the PortMapper.
|
||||
final String unset = "*unset*";
|
||||
final String httpHost = _context.portMapper().getActualHost(PortMapper.SVC_CONSOLE, unset);
|
||||
final String httpsHost = _context.portMapper().getActualHost(PortMapper.SVC_HTTPS_CONSOLE, unset);
|
||||
final int httpPort = _context.portMapper().getPort(PortMapper.SVC_CONSOLE, 7657);
|
||||
final int httpsPort = _context.portMapper().getPort(PortMapper.SVC_HTTPS_CONSOLE, -1);
|
||||
final boolean httpsOnly = httpsPort > 0 && httpHost.equals(unset) && !httpsHost.equals(unset);
|
||||
final int cport = httpsOnly ? httpsPort : httpPort;
|
||||
String chost = httpsOnly ? httpsHost : httpHost;
|
||||
if (chost.equals(unset))
|
||||
chost = "127.0.0.1";
|
||||
String chostport;
|
||||
if (httpsOnly || cport != 7657 || !chost.equals("127.0.0.1"))
|
||||
chostport = (httpsOnly ? "https://" : "http://") + chost + ':' + cport;
|
||||
else
|
||||
chostport = "http://127.0.0.1:7657";
|
||||
String conURL = _context.portMapper().getConsoleURL();
|
||||
out.write(("\n<table class=\"conflict\"><tr><th align=\"center\">" +
|
||||
"<a href=\"" + trustedURL + "\">").getBytes("UTF-8"));
|
||||
out.write(_t("Destination for {0} in address book", requestURI.getHost()).getBytes("UTF-8"));
|
||||
@@ -792,13 +776,13 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
out.write(("</a></th></tr>\n<tr><td align=\"center\">" +
|
||||
"<a href=\"" + trustedURL + "\">" +
|
||||
"<img src=\"" +
|
||||
chostport + "/imagegen/id?s=160&c=" +
|
||||
conURL + "imagegen/id?s=160&c=" +
|
||||
h1.toBase64().replace("=", "%3d") +
|
||||
"\" width=\"160\" height=\"160\"></a>\n").getBytes("UTF-8"));
|
||||
out.write(("</td>\n<td align=\"center\">" +
|
||||
"<a href=\"" + conflictURL + "\">" +
|
||||
"<img src=\"" +
|
||||
chostport + "/imagegen/id?s=160&c=" +
|
||||
conURL + "imagegen/id?s=160&c=" +
|
||||
h2.toBase64().replace("=", "%3d") +
|
||||
"\" width=\"160\" height=\"160\"></a>\n").getBytes("UTF-8"));
|
||||
out.write("</td></tr></table>".getBytes("UTF-8"));
|
||||
|
@@ -198,6 +198,8 @@ public abstract class LocalHTTPServer {
|
||||
tbook = _t("private");
|
||||
else
|
||||
tbook = book;
|
||||
|
||||
String conURL = I2PAppContext.getGlobalContext().portMapper().getConsoleURL();
|
||||
out.write(("HTTP/1.1 200 OK\r\n"+
|
||||
"Content-Type: text/html; charset=UTF-8\r\n"+
|
||||
"Referrer-Policy: no-referrer\r\n"+
|
||||
@@ -211,8 +213,8 @@ public abstract class LocalHTTPServer {
|
||||
"<meta http-equiv=\"Refresh\" content=\"1; url=" + url + "\">\n" +
|
||||
"</head><body>\n" +
|
||||
"<div class=logo>\n" +
|
||||
"<a href=\"http://127.0.0.1:7657/\" title=\"" + _t("Router Console") + "\"><img src=\"http://proxy.i2p/themes/console/images/i2plogo.png\" alt=\"I2P Router Console\" border=\"0\"></a><hr>\n" +
|
||||
"<a href=\"http://127.0.0.1:7657/config\">" + _t("Configuration") + "</a> <a href=\"http://127.0.0.1:7657/help.jsp\">" + _t("Help") + "</a> <a href=\"http://127.0.0.1:7657/susidns/index\">" + _t("Addressbook") + "</a>\n" +
|
||||
"<a href=\"" + conURL + "\" title=\"" + _t("Router Console") + "\"><img src=\"http://proxy.i2p/themes/console/images/i2plogo.png\" alt=\"I2P Router Console\" border=\"0\"></a><hr>\n" +
|
||||
"<a href=\"" + conURL + "config\">" + _t("Configuration") + "</a> <a href=\"" + conURL + "help.jsp\">" + _t("Help") + "</a> <a href=\"" + conURL + "susidns/index\">" + _t("Addressbook") + "</a>\n" +
|
||||
"</div>" +
|
||||
"<div class=warning id=warning>\n" +
|
||||
"<h3>" +
|
||||
|
Reference in New Issue
Block a user