]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
welcome page: display new nodeid (ed25519-based) instead of old tubid
authorBrian Warner <warner@lothar.com>
Sun, 14 Apr 2013 21:32:13 +0000 (14:32 -0700)
committerBrian Warner <warner@lothar.com>
Sun, 14 Apr 2013 22:07:56 +0000 (15:07 -0700)
The old tubid is displayed in a tooltip. Also cleaned up the regexps in
the relevant tests.

src/allmydata/client.py
src/allmydata/test/test_system.py
src/allmydata/test/test_web.py
src/allmydata/web/root.py
src/allmydata/web/welcome.xhtml

index 0fd15733ef916d646e5a137238c54201aa94531c..4f4745cca9fcf4c73fd68d1a43fbd83a3b4c8001 100644 (file)
@@ -14,7 +14,7 @@ from allmydata.immutable.upload import Uploader
 from allmydata.immutable.offloaded import Helper
 from allmydata.control import ControlServer
 from allmydata.introducer.client import IntroducerClient
-from allmydata.util import hashutil, base32, pollmixin, log, keyutil
+from allmydata.util import hashutil, base32, pollmixin, log, keyutil, idlib
 from allmydata.util.encodingutil import get_filesystem_encoding
 from allmydata.util.abbreviate import parse_abbreviated_size
 from allmydata.util.time_format import parse_duration, parse_date
@@ -220,6 +220,14 @@ class Client(node.Node, pollmixin.PollMixin):
         self.write_config("node.pubkey", vk_vs+"\n")
         self._node_key = sk
 
+    def get_long_nodeid(self):
+        # this matches what IServer.get_longname() says about us elsewhere
+        vk_bytes = self._node_key.get_verifying_key_bytes()
+        return "v0-"+base32.b2a(vk_bytes)
+
+    def get_long_tubid(self):
+        return idlib.nodeid_b2a(self.nodeid)
+
     def _init_permutation_seed(self, ss):
         seed = self.get_config_from_file("permutation-seed")
         if not seed:
index 472f106df8cd3d0a3832f45e19ef0aaeb32f8627..56abc24ed04fd5c3e502f07a8cbe04231417f1eb 100644 (file)
@@ -1,5 +1,4 @@
 
-from base64 import b32encode
 import os, re, sys, time, simplejson
 from cStringIO import StringIO
 
@@ -1099,10 +1098,12 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase):
         d = getPage(base)
         def _got_welcome(page):
             html = page.replace('\n', ' ')
-            connected_re = "Connected to <span>%d</span>[ ]*of <span>%d</span> known storage servers" % (self.numclients, self.numclients)
+            connected_re = r'Connected to <span>%d</span>\s*of <span>%d</span> known storage servers' % (self.numclients, self.numclients)
             self.failUnless(re.search(connected_re, html),
                             "I didn't see the right '%s' message in:\n%s" % (connected_re, page))
-            nodeid_re = "<th>Node ID:</th>[ ]*<td>%s</td>" % (re.escape(b32encode(self.clients[0].nodeid).lower()),)
+            # nodeids/tubids don't have any regexp-special characters
+            nodeid_re = r'<th>Node ID:</th>\s*<td title="TubID: %s">%s</td>' % (
+                self.clients[0].get_long_tubid(), self.clients[0].get_long_nodeid())
             self.failUnless(re.search(nodeid_re, html),
                             "I didn't see the right '%s' message in:\n%s" % (nodeid_re, page))
             self.failUnless("Helper: 0 active uploads" in page)
@@ -1113,7 +1114,7 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase):
         d.addCallback(lambda res: getPage(self.helper_webish_url))
         def _got_welcome_helper(page):
             html = page.replace('\n', ' ')
-            self.failUnless(re.search('<div class="status-indicator connected-yes"></div>[ ]*<div>Helper</div>', html), page)
+            self.failUnless(re.search(r'<div class="status-indicator connected-yes"></div>\s*<div>Helper</div>', html), page)
             self.failUnlessIn("Not running helper", page)
         d.addCallback(_got_welcome_helper)
 
index 00d05097459a814518ea9d494ec5e262f96ed5a9..3b12549ca2babf2568258d28dacd11a085e3a1f8 100644 (file)
@@ -254,6 +254,11 @@ class FakeClient(Client):
         self.mutable_file_default = SDMF_VERSION
         self.addService(FakeStorageServer(self.nodeid, self.nickname))
 
+    def get_long_nodeid(self):
+        return "v0-nodeid"
+    def get_long_tubid(self):
+        return "tubid"
+
     def startService(self):
         return service.MultiService.startService(self)
     def stopService(self):
index 1895d0675ff83aa763e399600da08420624fc77d..b4b7a85c508f1224cdf3148f5cd07bdb0fadbc54 100644 (file)
@@ -9,7 +9,7 @@ from nevow.util import resource_filename
 
 import allmydata # to display import path
 from allmydata import get_package_versions_string
-from allmydata.util import idlib, log
+from allmydata.util import log
 from allmydata.interfaces import IFileNode
 from allmydata.web import filenode, directory, unlinked, status, operations
 from allmydata.web import storage
@@ -168,8 +168,9 @@ class Root(rend.Page):
         return get_package_versions_string()
     def data_import_path(self, ctx, data):
         return str(allmydata)
-    def data_my_nodeid(self, ctx, data):
-        return idlib.nodeid_b2a(self.client.nodeid)
+    def render_my_nodeid(self, ctx, data):
+        tubid_s = "TubID: "+self.client.get_long_tubid()
+        return T.td(title=tubid_s)[self.client.get_long_nodeid()]
     def data_my_nickname(self, ctx, data):
         return self.client.nickname
 
index 1c794e4402900c9c8b7adb0eb4626ad8dde12443..9e1228e7011b675e8baa4778bbcf0180e09a86a5 100644 (file)
@@ -28,7 +28,7 @@
             </tr>
             <tr>
               <th>Node ID:</th>
-              <td n:render="string" n:data="my_nodeid" />
+              <td n:render="my_nodeid" />
             </tr>
           </table>
         </div>