[tor-commits] [onionoo/master] Remove unused fields from details documents.
karsten at torproject.org
karsten at torproject.org
Fri Apr 25 04:57:37 UTC 2014
commit 411cffc149497284c9379c7dd90d3fa09db7d510
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Thu Apr 24 21:30:19 2014 +0200
Remove unused fields from details documents.
Neither "version" nor "desc_published" were given out by the servlet at
any time.
---
.../torproject/onionoo/DetailsDocumentWriter.java | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/org/torproject/onionoo/DetailsDocumentWriter.java b/src/org/torproject/onionoo/DetailsDocumentWriter.java
index c1ae9d0..1682d7d 100644
--- a/src/org/torproject/onionoo/DetailsDocumentWriter.java
+++ b/src/org/torproject/onionoo/DetailsDocumentWriter.java
@@ -145,7 +145,7 @@ public class DetailsDocumentWriter implements DescriptorListener,
String portList = entry.getPortList();
Boolean recommendedVersion = entry.getRecommendedVersion();
StringBuilder sb = new StringBuilder();
- sb.append("{\"version\":1,\n"
+ sb.append("{\n"
+ "\"nickname\":\"" + nickname + "\",\n"
+ "\"fingerprint\":\"" + fingerprint + "\",\n"
+ "\"or_addresses\":[" + orAddressesAndPortsBuilder.toString()
@@ -267,20 +267,23 @@ public class DetailsDocumentWriter implements DescriptorListener,
DetailsStatus.class, false, fingerprint);
if (detailsStatus != null &&
detailsStatus.getDocumentString().length() > 0) {
- sb.append(",\n" + detailsStatus.getDocumentString());
+ sb.append(",");
String contact = null;
Scanner s = new Scanner(detailsStatus.getDocumentString());
while (s.hasNextLine()) {
String line = s.nextLine();
- if (!line.startsWith("\"contact\":")) {
+ if (line.startsWith("\"desc_published\":")) {
continue;
}
- int start = "\"contact\":\"".length(), end = line.length() - 1;
- if (line.endsWith(",")) {
- end--;
+ if (line.startsWith("\"contact\":")) {
+ int start = "\"contact\":\"".length(),
+ end = line.length() - 1;
+ if (line.endsWith(",")) {
+ end--;
+ }
+ contact = unescapeJSON(line.substring(start, end));
}
- contact = unescapeJSON(line.substring(start, end));
- break;
+ sb.append("\n" + line);
}
s.close();
entry.setContact(contact);
More information about the tor-commits
mailing list