[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit dfe0349b200bba3d62784a68257fc44ceaf32fc4
Author: Tom Ritter <tom@xxxxxxxxx>
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)
 

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits