[tor-commits] [depictor/master] Enter in the textbox will load individual relay data.

tom at torproject.org tom at torproject.org
Thu Apr 12 20:40:38 UTC 2018


commit dfe0349b200bba3d62784a68257fc44ceaf32fc4
Author: Tom Ritter <tom at ritter.vg>
Date:   Thu Apr 12 15:39:28 2018 -0500

    Enter in the textbox will load individual relay data.
    
    Closes #25771
---
 website.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/website.py b/website.py
index da9690f..9e12145 100755
--- a/website.py
+++ b/website.py
@@ -1311,10 +1311,13 @@ class WebsiteWriter:
 		+ "    dataLoaded = true;\n"
 		+ "    lines = data.split('\\n');\n"
 		+ "    for(i=0; i<lines.length; i++) {\n"
+		+ "      if (lines[i].trim().length == 0) continue;\n"
 		+ "      parts = lines[i].split(':');\n"
+		+ "      if (parts.length != 3) { console.log('Strange line: ' + lines[i]); continue; }\n"
 		+ "      fingerprint = parts[0];\n"
 		+ "      nickname = parts[1];\n"
 		+ "      indexes = parts[2].split(',')\n"
+		+ "      if (indexes.length != 2) { console.log('Strange line: ' + lines[i]); continue; }\n"
 		+ "      relayIndexes[fingerprint] = { indexes, nickname };\n"
 		+ "    }\n"
 		+ "    console.log('Loaded relay offset data');\n"
@@ -1367,6 +1370,7 @@ class WebsiteWriter:
 		+ " $('#relay-addition-javascript-pointer').html('But you can add individual "
 		+ "relays from the current consensus here. <input type=\"text\" id=\"fingerprintBox\" "
 		+ "placeholder=\"Fingerprint\"/><input type=\"button\" onclick=\"loadData()\" value=\"Load\"/>');\n"
+		+ " $('#fingerprintBox').on('keyup', function(e) { if(e.keyCode == 13) loadData(); });"
 		+ "</script>\n")
 		self._write_relay_info_tableHeader(False)
 



More information about the tor-commits mailing list