fixups after review

This commit is contained in:
zzz
2017-07-13 15:46:37 +00:00
parent d2da262374
commit 5ddb4edd14
11 changed files with 29 additions and 16 deletions

View File

@ -1524,7 +1524,9 @@ class PeerCoordinator implements PeerListener
* @since 0.9.31
*/
public void gotCommentReq(Peer peer, int num) {
/* if disabled, return */
/* TODO cache per-torrent setting, use it instead */
if (!_util.utCommentsEnabled())
return;
CommentSet comments = snark.getComments();
if (comments != null) {
int lastSent = peer.getTotalCommentsSent();
@ -1547,7 +1549,9 @@ class PeerCoordinator implements PeerListener
* @since 0.9.31
*/
public void gotComments(Peer peer, List<Comment> comments) {
/* if disabled, return */
/* TODO cache per-torrent setting, use it instead */
if (!_util.utCommentsEnabled())
return;
if (!comments.isEmpty())
snark.addComments(comments);
}

View File

@ -797,6 +797,9 @@ public class SnarkManager implements CompleteListener, ClientApp {
updateConfig();
}
/**
* @since 0.9.31
*/
public boolean getUniversalTheming() {
return _context.getBooleanProperty(RC_PROP_UNIVERSAL_THEMING);
}

View File

@ -70,7 +70,7 @@ public class Comment implements Comparable<Comment> {
name = name.substring(0, MAX_NAME_LEN);
}
this.name = name;
if (rating < 0 || rating > 5)
if (rating < 0)
rating = 0;
else if (rating > 5)
rating = 5;

View File

@ -1375,8 +1375,10 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
if(_context.namingService().getName().equals("BlockfileNamingService")) {
out.write(" " + _t("If you want to keep track of sites you have added manually, add to your Master or Private address book instead."));
}
// FIXME wasn't escaped
String label = _t("Save & continue").replace("&", "&amp;");
out.write("</p>\n<div class=\"formaction\"><button type=\"submit\" class=\"accept\" name=\"router\" value=\"router\">" +
_t("Save & continue") + "</button></div>\n");
label + "</button></div>\n");
if(_context.namingService().getName().equals("BlockfileNamingService")) {
// only blockfile supports multiple books
@ -1384,12 +1386,12 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
out.write("<h4>" + _t("Save {0} to master address book and continue to website", destination) + "</h4>\n<p>" +
_t("This address will be saved to your Master address book. Select this option for addresses you wish to keep separate from the main router address book, but don't mind publishing.") +
"</p>\n<div class=\"formaction\"><button type=\"submit\" class=\"accept\" name=\"master\" value=\"master\">" +
_t("Save & continue") + "</button></div>\n");
label + "</button></div>\n");
out.write("<h4>" + _t("Save {0} to private address book and continue to website", destination) + "</h4>\n<p>" +
_t("This address will be saved to your Private address book, ensuring it is never published.") +
"</p>\n<div class=\"formaction\"><button type=\"submit\" class=\"accept\" name=\"private\" value=\"private\">" +
_t("Save & continue") + "</button></div>\n");
label + "</button></div>\n");
}
// Firefox (and others?) don't send referer to meta refresh target, which is

View File

@ -29,7 +29,8 @@ public class HomeHelper extends HelperBase {
static final String DEFAULT_SERVICES =
_x("Addressbook") + S + _x("Manage your I2P hosts file here (I2P domain name resolution)") + S + "/dns" + S + I + "book_addresses.png" + S +
_x("Configure Bandwidth") + S + _x("I2P Bandwidth Configuration") + S + "/config" + S + I + "info/bandwidth.png" + S +
_x("Configure UI") + S + _x("Select console theme & language & set optional console password") + S + "/configui" + S + I + "info/ui.png" + S +
// FIXME wasn't escaped
_x("Configure UI") + S + _x("Select console theme & language & set optional console password").replace("&", "&amp;") + S + "/configui" + S + I + "info/ui.png" + S +
_x("Customize Home Page") + S + _x("I2P Home Page Configuration") + S + "/confighome" + S + I + "home_page.png" + S +
_x("Email") + S + _x("Anonymous webmail client") + S + "/susimail/susimail" + S + I + "email.png" + S +
_x("Help") + S + _x("I2P Router Help") + S + "/help" + S + I + "support.png" + S +
@ -229,7 +230,7 @@ public class HomeHelper extends HelperBase {
.append(app.name)
.append("\">")
.append(DataHelper.escapeHTML(app.name))
.append("</td><td align=\"left\"><a href=\"");
.append("</label></td><td align=\"left\"><a href=\"");
String url = DataHelper.escapeHTML(app.url);
buf.append(url)
.append("\">");

View File

@ -88,8 +88,9 @@ public class NewsFeedHelper extends HelperBase {
if (entry.link != null)
buf.append("</a>");
if (entry.authorName != null) {
// FIXME translate
buf.append(" <span class=\"newsAuthor\" title=\"Post author\"><i>")
.append(Messages.getString("{0}", DataHelper.escapeHTML(entry.authorName), ctx))
.append(DataHelper.escapeHTML(entry.authorName))
.append("</i></span>\n");
}
buf.append("</h3>\n<div class=\"newscontent\">\n")

View File

@ -84,7 +84,7 @@ public class PeerHelper extends HelperBase {
UDPTransport ut = (UDPTransport) t;
render(ut, out, urlBase, sortFlags);
} else {
// pluggable (none yet_
// pluggable (none yet)
t.renderStatusHTML(out, urlBase, sortFlags);
}
}
@ -152,7 +152,7 @@ public class PeerHelper extends HelperBase {
return buf.toString();
}
/// begin SSU
/// begin NTCP
/**
* @since 0.9.31 moved from NTCPTransport

View File

@ -175,8 +175,9 @@ class ProfileOrganizerRenderer {
RateAverages ra = RateAverages.getTemp();
Rate failed = prof.getTunnelHistory().getFailedRate().getRate(30*60*1000);
long fails = failed.computeAverages(ra, false).getTotalEventCount();
if (fails == 0) buf.append(_t("OK"));
if (fails > 0) {
if (fails == 0) {
buf.append(_t("OK"));
} else if (fails > 0) {
Rate accepted = prof.getTunnelCreateResponseTime().getRate(30*60*1000);
long total = fails + accepted.computeAverages(ra, false).getTotalEventCount();
if (total / fails <= 10) // hide if < 10%

View File

@ -161,7 +161,7 @@ public class SummaryHelper extends HelperBase {
*
* @since 0.9.31
*/
public class NetworkStateMessage {
public static class NetworkStateMessage {
private NetworkState state;
private String msg;
@ -184,7 +184,7 @@ public class SummaryHelper extends HelperBase {
@Override
public String toString() {
return super.toString() + " (" + state + "; " + msg + ')';
return "(" + state + "; " + msg + ')';
}
}

View File

@ -228,7 +228,7 @@ public final class KeyGenerator {
}
/**
* Generic signature type, supports DSA, ECDSA, EdDSA
* Generic signature type, supports DSA, RSA, ECDSA, EdDSA
* @since 0.9.9
*/
public SimpleDataStructure[] generateSigningKeys(SigType type) throws GeneralSecurityException {

View File

@ -109,6 +109,7 @@ the binaries or sources.
We bundle a large portion of the 1.6.0 source from https://github.com/OpenNMS/jrobin
No package or not widely available.
There is an old 1.5.9 Maven jrobin package at http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jrobin%22
Jrobin is in Gentoo.
* libhttpclient-java
We only use a few classes from this large package.