forked from I2P_Developers/i2p.i2p
Minor fixes and javadocs after review
Set 90 day default for event log Format clock skew in summary bar Constant time for password hash check
This commit is contained in:
@ -2348,7 +2348,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
try {
|
||||
// class only in standalone builds
|
||||
Class helper = Class.forName("org.klomp.snark.standalone.ConfigUIHelper");
|
||||
Method getLangSettings = helper.getMethod("getLangSettings", I2PAppContext.class);
|
||||
Method getLangSettings = helper.getMethod("getLangSettings", new Class[] {I2PAppContext.class});
|
||||
String langSettings = (String) getLangSettings.invoke(null, _context);
|
||||
// If we get to here, we have the language settings
|
||||
out.write("<tr><td>");
|
||||
@ -3900,6 +3900,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
_manager.setSavedCommentsEnabled(snark, yes);
|
||||
}
|
||||
|
||||
/** @since 0.9.32 */
|
||||
private static boolean noCollapsePanels(HttpServletRequest req) {
|
||||
// check for user agents that can't toggle the collapsible panels...
|
||||
String ua = req.getHeader("user-agent");
|
||||
|
@ -49,7 +49,7 @@ class UpdateHandler implements Updater {
|
||||
return null;
|
||||
UpdateRunner update = new UpdateRunner(_context, _mgr, type, method, updateSources);
|
||||
// set status before thread to ensure UI feedback
|
||||
_mgr.notifyProgress(update, "<b>" + _mgr._t("Updating") + " I2P</b>");
|
||||
_mgr.notifyProgress(update, "<b>" + _mgr._t("Updating I2P") + "</b>");
|
||||
return update;
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
|
||||
if (_isPartial)
|
||||
return;
|
||||
long d = currentWrite + bytesTransferred;
|
||||
String status = "<b>" + _t("Updating") + " I2P</b>";
|
||||
String status = "<b>" + _t("Updating I2P") + "</b>";
|
||||
_mgr.notifyProgress(this, status, d, d + bytesRemaining);
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ public class CSSHelper extends HelperBase {
|
||||
public static final String PROP_DISABLE_REFRESH = "routerconsole.summaryDisableRefresh";
|
||||
private static final String PROP_XFRAME = "routerconsole.disableXFrame";
|
||||
public static final String PROP_FORCE_MOBILE_CONSOLE = "routerconsole.forceMobileConsole";
|
||||
/** @since 0.9.32 */
|
||||
public static final String PROP_EMBED_APPS = "routerconsole.embedApps";
|
||||
|
||||
private static final String _consoleNonce = Long.toString(RandomSource.getInstance().nextLong());
|
||||
|
@ -54,7 +54,7 @@ public class EventLogHelper extends FormHandler {
|
||||
EventLog.WATCHDOG, _x("Watchdog warning")
|
||||
};
|
||||
private static final long DAY = 24*60*60*1000L;
|
||||
private static final long[] _times = { 0, DAY, 7*DAY, 30*DAY, 365*DAY };
|
||||
private static final long[] _times = { 0, DAY, 7*DAY, 30*DAY, 90*DAY, 365*DAY };
|
||||
|
||||
public EventLogHelper() {
|
||||
super();
|
||||
|
@ -335,6 +335,7 @@ class SummaryBarRenderer {
|
||||
.append(nbsp(_t("Debug")))
|
||||
.append("</a>\n")
|
||||
|
||||
// 7 days
|
||||
.append("<a href=\"/events?from=604800000\" target=\"_top\" title=\"")
|
||||
.append(_t("View historical log of router events"))
|
||||
.append("\">")
|
||||
@ -491,8 +492,8 @@ class SummaryBarRenderer {
|
||||
.append(_t("Clock Skew"))
|
||||
.append(":</b></td>" +
|
||||
"<td align=\"right\">")
|
||||
.append(_context.clock().getOffset())
|
||||
.append(" ms</td></tr>\n" +
|
||||
.append(DataHelper.formatDuration2(_context.clock().getOffset()))
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_t("How much RAM I2P is using / total RAM available to I2P (excludes RAM allocated to the JVM)"))
|
||||
@ -509,9 +510,7 @@ class SummaryBarRenderer {
|
||||
/** @since 0.9.32 */
|
||||
public String renderMemoryBarHTML() {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append(_helper.getMemoryBar());
|
||||
return buf.toString();
|
||||
return _helper.getMemoryBar();
|
||||
}
|
||||
|
||||
public String renderNetworkReachabilityHTML() {
|
||||
@ -656,6 +655,7 @@ class SummaryBarRenderer {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/** @since 0.9.32 */
|
||||
public String renderPeersAdvancedHTML() {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
|
@ -294,9 +294,8 @@ public class SummaryHelper extends HelperBase {
|
||||
|
||||
/**
|
||||
* Retrieve amount of used memory.
|
||||
*
|
||||
* @since 0.9.32 uncommented
|
||||
*/
|
||||
|
||||
public String getMemory() {
|
||||
DecimalFormat integerFormatter = new DecimalFormat("###,###,##0");
|
||||
long used = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())/1024/1024;
|
||||
@ -308,6 +307,7 @@ public class SummaryHelper extends HelperBase {
|
||||
return integerFormatter.format(used) + " / " + total + "MB";
|
||||
}
|
||||
|
||||
/** @since 0.9.32 */
|
||||
public String getMemoryBar() {
|
||||
DecimalFormat integerFormatter = new DecimalFormat("###,###,##0");
|
||||
long used = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())/1024/1024;
|
||||
@ -384,11 +384,11 @@ public class SummaryHelper extends HelperBase {
|
||||
//return _context.profileOrganizer().countWellIntegratedPeers();
|
||||
return _context.peerManager().getPeersByCapability(FloodfillNetworkDatabaseFacade.CAPABILITY_FLOODFILL).size();
|
||||
}
|
||||
|
||||
/**
|
||||
* How many peers the router ranks as failing.
|
||||
*
|
||||
* @since 0.9.32 uncommented
|
||||
*/
|
||||
|
||||
public int getFailingPeers() {
|
||||
if (_context == null)
|
||||
return 0;
|
||||
@ -397,10 +397,9 @@ public class SummaryHelper extends HelperBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* How many peers totally suck.
|
||||
*
|
||||
* How many peers are banned.
|
||||
* @since 0.9.32 uncommented
|
||||
*/
|
||||
|
||||
public int getBanlistedPeers() {
|
||||
if (_context == null)
|
||||
return 0;
|
||||
@ -959,7 +958,7 @@ public class SummaryHelper extends HelperBase {
|
||||
private static final String SS = Character.toString(S);
|
||||
|
||||
public List<String> getSummaryBarSections(String page) {
|
||||
String config = "";
|
||||
String config;
|
||||
if ("home".equals(page)) {
|
||||
config = _context.getProperty(PROP_SUMMARYBAR + page, isAdvanced() ? DEFAULT_MINIMAL_ADVANCED : DEFAULT_MINIMAL);
|
||||
} else {
|
||||
|
@ -387,6 +387,7 @@ class TunnelRenderer {
|
||||
/**
|
||||
* Copied from ConfigNetHelper.
|
||||
* @return in KBytes per second
|
||||
* @since 0.9.32
|
||||
*/
|
||||
private int getShareBandwidth() {
|
||||
int irateKBps = _context.bandwidthLimiter().getInboundKBytesPerSecond();
|
||||
|
@ -74,7 +74,7 @@
|
||||
<h3 class="tabletitle"><%=intl._t("Event Logs")%></h3>
|
||||
<table id="eventlogs" class="logtable"><tbody>
|
||||
<tr><td>
|
||||
<p><a href="events"><%=intl._t("View event logs")%></a></p>
|
||||
<!-- 90 days --><p><a href="events?from=7776000000"><%=intl._t("View event logs")%></a></p>
|
||||
</td></tr>
|
||||
</tbody></table>
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class PasswordManager {
|
||||
System.arraycopy(shashBytes, 0, salt, 0, SALT_LENGTH);
|
||||
System.arraycopy(shashBytes, SALT_LENGTH, hash, 0, SessionKey.KEYSIZE_BYTES);
|
||||
byte[] pwHash = _context.keyGenerator().generateSessionKey(salt, DataHelper.getUTF8(pw)).getData();
|
||||
return DataHelper.eq(hash, pwHash);
|
||||
return DataHelper.eqCT(hash, 0, pwHash, 0, SessionKey.KEYSIZE_BYTES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user