forked from I2P_Developers/i2p.i2p
Util: Consolidate console URL generation in PortMapper
This commit is contained in:
@ -219,6 +219,13 @@ public class ConfigServiceHandler extends FormHandler {
|
||||
(sdtg == null && (SystemVersion.isWindows() || SystemVersion.isMac()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.9.33
|
||||
*/
|
||||
public String getConsoleURL() {
|
||||
return _context.portMapper().getConsoleURL();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processForm() {
|
||||
if (_action == null) return;
|
||||
@ -348,9 +355,9 @@ public class ConfigServiceHandler extends FormHandler {
|
||||
}
|
||||
// releases <= 0.6.5 deleted the entry completely
|
||||
if (shouldLaunchBrowser && !found) {
|
||||
int port = _context.portMapper().getPort(PortMapper.SVC_CONSOLE, RouterConsoleRunner.DEFAULT_LISTEN_PORT);
|
||||
String url = _context.portMapper().getConsoleURL();
|
||||
ClientAppConfig ca = new ClientAppConfig(UrlLauncher.class.getName(), "consoleBrowser",
|
||||
"http://127.0.0.1:" + port + '/', 5, false);
|
||||
url, 5, false);
|
||||
clients.add(ca);
|
||||
}
|
||||
ClientAppConfig.writeClientAppConfig(_context, clients);
|
||||
|
@ -190,7 +190,7 @@ public class HomeHelper extends HelperBase {
|
||||
String url;
|
||||
if (app.name.equals(website) && app.url.equals("http://127.0.0.1:7658/")) {
|
||||
// fixup eepsite link
|
||||
url = "http://" + _context.portMapper().getHost(PortMapper.SVC_EEPSITE, "127.0.0.1") +
|
||||
url = "http://" + _context.portMapper().getActualHost(PortMapper.SVC_EEPSITE, "127.0.0.1") +
|
||||
':' + _context.portMapper().getPort(PortMapper.SVC_EEPSITE, 7658) + '/';
|
||||
} else {
|
||||
url = app.url;
|
||||
|
@ -226,7 +226,7 @@ class SummaryBarRenderer {
|
||||
.append("</a>\n" +
|
||||
|
||||
"<a href=\"http://")
|
||||
.append(_context.portMapper().getHost(PortMapper.SVC_EEPSITE, "127.0.0.1"))
|
||||
.append(_context.portMapper().getActualHost(PortMapper.SVC_EEPSITE, "127.0.0.1"))
|
||||
.append(':')
|
||||
.append(_context.portMapper().getPort(PortMapper.SVC_EEPSITE, 7658))
|
||||
.append("/\" target=\"_blank\" title=\"")
|
||||
|
Reference in New Issue
Block a user