forked from I2P_Developers/i2p.i2p
add firewall and reseed status on /home
This commit is contained in:
@@ -266,47 +266,7 @@ public class SummaryBarRenderer {
|
|||||||
out.write(buf.toString());
|
out.write(buf.toString());
|
||||||
buf.setLength(0);
|
buf.setLength(0);
|
||||||
|
|
||||||
|
buf.append(_helper.getFirewallAndReseedStatus());
|
||||||
boolean anotherLine = false;
|
|
||||||
if (_helper.showFirewallWarning()) {
|
|
||||||
buf.append("<h4><a href=\"/confignet\" target=\"_top\" title=\"")
|
|
||||||
.append(_("Help with firewall configuration"))
|
|
||||||
.append("\">")
|
|
||||||
.append(_("Check network connection and NAT/firewall"))
|
|
||||||
.append("</a></h4>");
|
|
||||||
anotherLine = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean reseedInProgress = Boolean.valueOf(System.getProperty("net.i2p.router.web.ReseedHandler.reseedInProgress")).booleanValue();
|
|
||||||
// If showing the reseed link is allowed
|
|
||||||
if (_helper.allowReseed()) {
|
|
||||||
if (reseedInProgress) {
|
|
||||||
// While reseed occurring, show status message instead
|
|
||||||
buf.append("<i>").append(System.getProperty("net.i2p.router.web.ReseedHandler.statusMessage","")).append("</i><br>");
|
|
||||||
} else {
|
|
||||||
// While no reseed occurring, show reseed link
|
|
||||||
long nonce = _context.random().nextLong();
|
|
||||||
String prev = System.getProperty("net.i2p.router.web.ReseedHandler.nonce");
|
|
||||||
if (prev != null) System.setProperty("net.i2p.router.web.ReseedHandler.noncePrev", prev);
|
|
||||||
System.setProperty("net.i2p.router.web.ReseedHandler.nonce", nonce+"");
|
|
||||||
String uri = _helper.getRequestURI();
|
|
||||||
buf.append("<p><form action=\"").append(uri).append("\" method=\"POST\">\n");
|
|
||||||
buf.append("<input type=\"hidden\" name=\"reseedNonce\" value=\"").append(nonce).append("\" >\n");
|
|
||||||
buf.append("<button type=\"submit\" class=\"reload\" value=\"Reseed\" >").append(_("Reseed")).append("</button></form></p>\n");
|
|
||||||
}
|
|
||||||
anotherLine = true;
|
|
||||||
}
|
|
||||||
// If a new reseed ain't running, and the last reseed had errors, show error message
|
|
||||||
if (!reseedInProgress) {
|
|
||||||
String reseedErrorMessage = System.getProperty("net.i2p.router.web.ReseedHandler.errorMessage","");
|
|
||||||
if (reseedErrorMessage.length() > 0) {
|
|
||||||
buf.append("<i>").append(reseedErrorMessage).append("</i><br>");
|
|
||||||
anotherLine = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (anotherLine)
|
|
||||||
buf.append("<hr>");
|
|
||||||
|
|
||||||
|
|
||||||
buf.append("<h3><a href=\"/config\" title=\"")
|
buf.append("<h3><a href=\"/config\" title=\"")
|
||||||
.append(_("Configure router bandwidth allocation"))
|
.append(_("Configure router bandwidth allocation"))
|
||||||
|
@@ -662,6 +662,51 @@ public class SummaryHelper extends HelperBase {
|
|||||||
return ConfigRestartBean.renderStatus(getRequestURI(), getAction(), getConsoleNonce());
|
return ConfigRestartBean.renderStatus(getRequestURI(), getAction(), getConsoleNonce());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The firewall status and reseed status/buttons
|
||||||
|
* @since 0.9 moved from SummaryBarRenderer
|
||||||
|
*/
|
||||||
|
public String getFirewallAndReseedStatus() {
|
||||||
|
StringBuilder buf = new StringBuilder(256);
|
||||||
|
if (showFirewallWarning()) {
|
||||||
|
buf.append("<h4><a href=\"/confignet\" target=\"_top\" title=\"")
|
||||||
|
.append(_("Help with firewall configuration"))
|
||||||
|
.append("\">")
|
||||||
|
.append(_("Check network connection and NAT/firewall"))
|
||||||
|
.append("</a></h4>");
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean reseedInProgress = Boolean.valueOf(System.getProperty("net.i2p.router.web.ReseedHandler.reseedInProgress")).booleanValue();
|
||||||
|
// If showing the reseed link is allowed
|
||||||
|
if (allowReseed()) {
|
||||||
|
if (reseedInProgress) {
|
||||||
|
// While reseed occurring, show status message instead
|
||||||
|
buf.append("<i>").append(System.getProperty("net.i2p.router.web.ReseedHandler.statusMessage","")).append("</i><br>");
|
||||||
|
} else {
|
||||||
|
// While no reseed occurring, show reseed link
|
||||||
|
long nonce = _context.random().nextLong();
|
||||||
|
String prev = System.getProperty("net.i2p.router.web.ReseedHandler.nonce");
|
||||||
|
if (prev != null) System.setProperty("net.i2p.router.web.ReseedHandler.noncePrev", prev);
|
||||||
|
System.setProperty("net.i2p.router.web.ReseedHandler.nonce", nonce+"");
|
||||||
|
String uri = getRequestURI();
|
||||||
|
buf.append("<p><form action=\"").append(uri).append("\" method=\"POST\">\n");
|
||||||
|
buf.append("<input type=\"hidden\" name=\"reseedNonce\" value=\"").append(nonce).append("\" >\n");
|
||||||
|
buf.append("<button type=\"submit\" class=\"reload\" value=\"Reseed\" >").append(_("Reseed")).append("</button></form></p>\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If a new reseed ain't running, and the last reseed had errors, show error message
|
||||||
|
if (!reseedInProgress) {
|
||||||
|
String reseedErrorMessage = System.getProperty("net.i2p.router.web.ReseedHandler.errorMessage","");
|
||||||
|
if (reseedErrorMessage.length() > 0) {
|
||||||
|
buf.append("<i>").append(reseedErrorMessage).append("</i><br>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (buf.length() <= 0)
|
||||||
|
return "";
|
||||||
|
buf.append("<hr>");
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/** output the summary bar to _out */
|
/** output the summary bar to _out */
|
||||||
public void renderSummaryBar() throws IOException {
|
public void renderSummaryBar() throws IOException {
|
||||||
SummaryBarRenderer renderer = new SummaryBarRenderer(_context, this);
|
SummaryBarRenderer renderer = new SummaryBarRenderer(_context, this);
|
||||||
|
@@ -20,4 +20,5 @@
|
|||||||
<jsp:getProperty name="helper" property="updateStatus" />
|
<jsp:getProperty name="helper" property="updateStatus" />
|
||||||
<jsp:getProperty name="helper" property="restartStatus" />
|
<jsp:getProperty name="helper" property="restartStatus" />
|
||||||
<hr>
|
<hr>
|
||||||
|
<jsp:getProperty name="helper" property="firewallAndReseedStatus" />
|
||||||
<jsp:getProperty name="helper" property="destinations" />
|
<jsp:getProperty name="helper" property="destinations" />
|
||||||
|
Reference in New Issue
Block a user