forked from I2P_Developers/i2p.i2p
PortMapper: Fix URL generation for IPv6 hosts
Console: Remove i2pwiki.i2p (ticket #2626)
This commit is contained in:
@ -63,7 +63,7 @@ public class HomeHelper extends HelperBase {
|
||||
_x("I2P Forum") + S + _x("Community forum") + S + "http://i2pforum.i2p/" + S + I + "group.png" + S +
|
||||
//"git.repo.i2p" + S + _x("A public anonymous Git hosting site - supports pulling via Git and HTTP and pushing via SSH") + S + "http://git.repo.i2p/" + S + I + "git-logo.png" + S +
|
||||
//"hiddengate [ru]" + S + _x("Russian I2P-related wiki") + S + "http://hiddengate.i2p/" + S + I + "hglogo32.png" + S +
|
||||
_x("I2P Wiki") + S + _x("Anonymous wiki - share the knowledge") + S + "http://i2pwiki.i2p/" + S + I + "i2pwiki_logo.png" + S +
|
||||
//_x("I2P Wiki") + S + _x("Anonymous wiki - share the knowledge") + S + "http://i2pwiki.i2p/" + S + I + "i2pwiki_logo.png" + S +
|
||||
//"Ident " + _x("Microblog") + S + _x("Your premier microblogging service on I2P") + S + "http://id3nt.i2p/" + S + I + "ident_icon_blue.png" + S +
|
||||
//_x("Javadocs") + S + _x("Technical documentation") + S + "http://i2p-javadocs.i2p/" + S + I + "education.png" + S +
|
||||
//"jisko.i2p" + S + _x("Simple and fast microblogging website") + S + "http://jisko.i2p/" + S + I + "jisko_console_icon.png" + S +
|
||||
@ -196,18 +196,10 @@ public class HomeHelper extends HelperBase {
|
||||
for (App app : apps) {
|
||||
String url;
|
||||
if (app.name.equals(website) && app.url.equals("http://127.0.0.1:7658/")) {
|
||||
int port = pm.getPort(PortMapper.SVC_EEPSITE);
|
||||
int sslPort = pm.getPort(PortMapper.SVC_HTTPS_EEPSITE);
|
||||
if (port <= 0 && sslPort <= 0)
|
||||
continue;
|
||||
// fixup eepsite link
|
||||
if (sslPort > 0) {
|
||||
url = "https://" + pm.getActualHost(PortMapper.SVC_HTTPS_EEPSITE, "127.0.0.1") +
|
||||
':' + sslPort + '/';
|
||||
} else {
|
||||
url = "http://" + pm.getActualHost(PortMapper.SVC_EEPSITE, "127.0.0.1") +
|
||||
':' + port + '/';
|
||||
}
|
||||
url = SummaryBarRenderer.getEepsiteURL(pm);
|
||||
if (url == null)
|
||||
continue;
|
||||
} else {
|
||||
url = app.url;
|
||||
// check for disabled webapps and other things
|
||||
|
@ -231,22 +231,11 @@ class SummaryBarRenderer {
|
||||
.append("</a>\n");
|
||||
}
|
||||
|
||||
int port = pm.getPort(PortMapper.SVC_EEPSITE);
|
||||
int sslPort = pm.getPort(PortMapper.SVC_HTTPS_EEPSITE);
|
||||
if (sslPort > 0 || port > 0) {
|
||||
String svc;
|
||||
if (sslPort > 0) {
|
||||
buf.append("<a href=\"https://");
|
||||
svc = PortMapper.SVC_HTTPS_EEPSITE;
|
||||
port = sslPort;
|
||||
} else {
|
||||
buf.append("<a href=\"http://");
|
||||
svc = PortMapper.SVC_EEPSITE;
|
||||
}
|
||||
buf.append(pm.getActualHost(svc, "127.0.0.1"))
|
||||
.append(':')
|
||||
.append(port)
|
||||
.append("/\" target=\"_blank\" title=\"")
|
||||
String url = getEepsiteURL(pm);
|
||||
if (url != null) {
|
||||
buf.append("<a href=\"")
|
||||
.append(url)
|
||||
.append("\" target=\"_blank\" title=\"")
|
||||
.append(_t("Local web server"))
|
||||
.append("\">")
|
||||
.append(nbsp(_t("Web Server")))
|
||||
@ -259,6 +248,37 @@ class SummaryBarRenderer {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null if none
|
||||
* @since 0.9.43 split out from above, used by HomeHelper, fixed for IPv6
|
||||
*/
|
||||
static String getEepsiteURL(PortMapper pm) {
|
||||
int port = pm.getPort(PortMapper.SVC_EEPSITE);
|
||||
int sslPort = pm.getPort(PortMapper.SVC_HTTPS_EEPSITE);
|
||||
if (port <= 0 && sslPort <= 0)
|
||||
return null;
|
||||
String svc;
|
||||
StringBuilder buf = new StringBuilder(32);
|
||||
if (sslPort > 0) {
|
||||
buf.append("https://");
|
||||
svc = PortMapper.SVC_HTTPS_EEPSITE;
|
||||
port = sslPort;
|
||||
} else {
|
||||
buf.append("http://");
|
||||
svc = PortMapper.SVC_EEPSITE;
|
||||
}
|
||||
String host = pm.getActualHost(svc, "127.0.0.1");
|
||||
if (host.contains(":"))
|
||||
buf.append('[');
|
||||
buf.append(host);
|
||||
if (host.contains(":"))
|
||||
buf.append(']');
|
||||
buf.append(':')
|
||||
.append(port)
|
||||
.append('/');
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String renderI2PInternalsHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/config\" target=\"_top\" title=\"")
|
||||
|
@ -280,10 +280,15 @@ public class PortMapper {
|
||||
int httpPort = getPort(SVC_CONSOLE, DEFAULT_CONSOLE_PORT);
|
||||
int httpsPort = getPort(SVC_HTTPS_CONSOLE);
|
||||
boolean httpsOnly = httpsPort > 0 && httpHost.equals(unset) && !httpsHost.equals(unset);
|
||||
if (httpsOnly)
|
||||
if (httpsOnly) {
|
||||
if (httpsHost.contains(":"))
|
||||
return "https://[" + httpsHost + "]:" + httpsPort + '/';
|
||||
return "https://" + httpsHost + ':' + httpsPort + '/';
|
||||
}
|
||||
if (httpHost.equals(unset))
|
||||
httpHost = DEFAULT_HOST;
|
||||
if (httpHost.contains(":"))
|
||||
return "http://[" + httpHost + "]:" + httpPort + '/';
|
||||
return "http://" + httpHost + ':' + httpPort + '/';
|
||||
}
|
||||
|
||||
@ -298,10 +303,15 @@ public class PortMapper {
|
||||
int httpPort = getPort(SVC_CONSOLE);
|
||||
int httpsPort = getPort(SVC_HTTPS_CONSOLE, DEFAULT_HTTPS_CONSOLE_PORT);
|
||||
boolean httpOnly = httpPort > 0 && httpsHost.equals(unset) && !httpHost.equals(unset);
|
||||
if (httpOnly)
|
||||
if (httpOnly) {
|
||||
if (httpHost.contains(":"))
|
||||
return "http://[" + httpHost + "]:" + httpPort + '/';
|
||||
return "http://" + httpHost + ':' + httpPort + '/';
|
||||
}
|
||||
if (httpsHost.equals(unset))
|
||||
return "http://" + DEFAULT_HOST + ':' + DEFAULT_CONSOLE_PORT + '/';
|
||||
if (httpsHost.contains(":"))
|
||||
return "https://[" + httpsHost + "]:" + httpsPort + '/';
|
||||
return "https://" + httpsHost + ':' + httpsPort + '/';
|
||||
}
|
||||
|
||||
|
10
history.txt
10
history.txt
@ -1,3 +1,13 @@
|
||||
2019-10-01 zzz
|
||||
* Console: Remove i2pwiki.i2p (ticket #2626)
|
||||
* PortMapper: Fix URL generation for IPv6 hosts
|
||||
|
||||
2019-09-21 zzz
|
||||
* Tomcat 8.5.46
|
||||
|
||||
2019-09-19 zzz
|
||||
* i2ptunnel: Support quoting for custom options (ticket #2603)
|
||||
|
||||
2019-09-18 zzz
|
||||
* I2CP:
|
||||
- More BlindingInfo serialization fixes
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 8;
|
||||
public final static long BUILD = 9;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
Reference in New Issue
Block a user