diff --git a/apps/susidns/src/java/src/i2p/susi/dns/AddressBean.java b/apps/susidns/src/java/src/i2p/susi/dns/AddressBean.java index d988d40af..92945fefc 100644 --- a/apps/susidns/src/java/src/i2p/susi/dns/AddressBean.java +++ b/apps/susidns/src/java/src/i2p/susi/dns/AddressBean.java @@ -33,6 +33,7 @@ import net.i2p.crypto.SigType; import net.i2p.data.Base32; import net.i2p.data.Base64; import net.i2p.data.Certificate; +import net.i2p.data.DataHelper; public class AddressBean { @@ -209,7 +210,7 @@ public class AddressBean /** @since 0.8.7 */ public String getNotes() { - return getProp("notes"); + return DataHelper.escapeHTML(getProp("notes")); } /** diff --git a/apps/susidns/src/java/src/i2p/susi/dns/NamingServiceBean.java b/apps/susidns/src/java/src/i2p/susi/dns/NamingServiceBean.java index dc57df58e..74823f05c 100644 --- a/apps/susidns/src/java/src/i2p/susi/dns/NamingServiceBean.java +++ b/apps/susidns/src/java/src/i2p/susi/dns/NamingServiceBean.java @@ -48,6 +48,7 @@ public class NamingServiceBean extends AddressbookBean { private static final String DEFAULT_NS = "BlockfileNamingService"; private String detail; + private String notes; private boolean isDirect() { return getBook().equals("published"); @@ -359,10 +360,64 @@ public class NamingServiceBean extends AddressbookBean return message; } + /** + * @since 0.9.35 + */ + public void saveNotes() { + if (action == null || !action.equals(_t("Save Notes")) || + destination == null || detail == null || isDirect() || + notes == null || + serial == null || !serial.equals(lastSerial)) + return; + Properties nsOptions = new Properties(); + List propsList = new ArrayList(4); + nsOptions.setProperty("list", getFileName()); + List dests = getNamingService().lookupAll(detail, nsOptions, propsList); + if (dests == null) + return; + for (int i = 0; i < dests.size(); i++) { + if (!dests.get(i).toBase64().equals(destination)) + continue; + Properties props = propsList.get(i); + byte[] nbytes = DataHelper.getUTF8(notes); + if (nbytes.length > 255) { + // violently truncate, possibly splitting a char + byte[] newbytes = new byte[255]; + System.arraycopy(nbytes, 0, newbytes, 0, 255); + notes = DataHelper.getUTF8(newbytes); + // drop replacement char or split pair + int last = notes.length() - 1; + char lastc = notes.charAt(last); + if (lastc == (char) 0xfffd || Character.isHighSurrogate(lastc)) + notes = notes.substring(0, last); + } + props.setProperty("notes", notes); + props.setProperty("list", getFileName()); + String now = Long.toString(_context.clock().now()); + props.setProperty("m", now); + if (dests.size() > 1) { + // we don't have any API to update properties on a single dest + // so remove and re-add + getNamingService().remove(detail, dests.get(i), nsOptions); + getNamingService().addDestination(detail, dests.get(i), props); + } else { + getNamingService().put(detail, dests.get(i), props); + } + return; + } + } + public void setH(String h) { this.detail = DataHelper.stripHTML(h); } + /** + * @since 0.9.35 + */ + public void setNofilter_notes(String n) { + notes = n; + } + public AddressBean getLookup() { if (this.detail == null) return null; diff --git a/apps/susidns/src/jsp/details.jsp b/apps/susidns/src/jsp/details.jsp index 490ebbeb1..61d51cfb6 100644 --- a/apps/susidns/src/jsp/details.jsp +++ b/apps/susidns/src/jsp/details.jsp @@ -73,6 +73,8 @@ if (detail == null) { %>

No host specified

<% } else { + // process save notes form + book.saveNotes(); detail = net.i2p.data.DataHelper.stripHTML(detail); java.util.List addrs = book.getLookupAll(); if (addrs == null) { @@ -85,6 +87,11 @@ String b32 = addr.getB32(); %> +
+ + + + @@ -141,14 +148,16 @@ - - - - + + + +
<%=intl._t("Hostname")%><%=addr.getModded()%>
<%=intl._t("Notes")%><%=addr.getNotes()%>
<%=intl._t("Destination")%>
<%=addr.getDestination()%>
<%=intl._t("Notes")%>
+">
+

diff --git a/history.txt b/history.txt index 9aacb958b..3f86ddf93 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,21 @@ +2018-05-31 zzz + * Console: + - Fix CSS preventing ordered lists (ticket #2075) + - Change Java 10 warning to Java 11, + * SusiDNS: Add notes form (ticket #1433) + +2018-05-30 zzz + * Debian build fixes, remove things from source package + * NTCP: Cleanup, prep for NTCP2, increase max RI size + * SusiMail: + - Button and CSS fixes + - Don't require confirmation to delete from Trash, + - Clear reallydelete flag when clicking cancel or change folder + - Fix dup ConnectWaiter run, lack of failure message + - Fix persistent loading/fetching/refresh messages + 2018-05-28 zzz + * Console: Tagged string fixes (ticket #2017) * SusiMail: (ticket #2087) - Send deletions after connect so emails don't come back after a move - Fix fetches in check mail diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index ea17ad55f..e1f87e077 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -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 = 15; + public final static long BUILD = 16; /** for example "-test" */ public final static String EXTRA = "";