welcome page: display new nodeid (ed25519-based) instead of old tubid
The old tubid is displayed in a tooltip. Also cleaned up the regexps in the relevant tests.
This commit is contained in:
parent
e706156323
commit
f14602cb34
|
@ -14,7 +14,7 @@ from allmydata.immutable.upload import Uploader
|
||||||
from allmydata.immutable.offloaded import Helper
|
from allmydata.immutable.offloaded import Helper
|
||||||
from allmydata.control import ControlServer
|
from allmydata.control import ControlServer
|
||||||
from allmydata.introducer.client import IntroducerClient
|
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.encodingutil import get_filesystem_encoding
|
||||||
from allmydata.util.abbreviate import parse_abbreviated_size
|
from allmydata.util.abbreviate import parse_abbreviated_size
|
||||||
from allmydata.util.time_format import parse_duration, parse_date
|
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.write_config("node.pubkey", vk_vs+"\n")
|
||||||
self._node_key = sk
|
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):
|
def _init_permutation_seed(self, ss):
|
||||||
seed = self.get_config_from_file("permutation-seed")
|
seed = self.get_config_from_file("permutation-seed")
|
||||||
if not seed:
|
if not seed:
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
from base64 import b32encode
|
|
||||||
import os, re, sys, time, simplejson
|
import os, re, sys, time, simplejson
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
|
||||||
|
@ -1099,10 +1098,12 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase):
|
||||||
d = getPage(base)
|
d = getPage(base)
|
||||||
def _got_welcome(page):
|
def _got_welcome(page):
|
||||||
html = page.replace('\n', ' ')
|
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),
|
self.failUnless(re.search(connected_re, html),
|
||||||
"I didn't see the right '%s' message in:\n%s" % (connected_re, page))
|
"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),
|
self.failUnless(re.search(nodeid_re, html),
|
||||||
"I didn't see the right '%s' message in:\n%s" % (nodeid_re, page))
|
"I didn't see the right '%s' message in:\n%s" % (nodeid_re, page))
|
||||||
self.failUnless("Helper: 0 active uploads" in 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))
|
d.addCallback(lambda res: getPage(self.helper_webish_url))
|
||||||
def _got_welcome_helper(page):
|
def _got_welcome_helper(page):
|
||||||
html = page.replace('\n', ' ')
|
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)
|
self.failUnlessIn("Not running helper", page)
|
||||||
d.addCallback(_got_welcome_helper)
|
d.addCallback(_got_welcome_helper)
|
||||||
|
|
||||||
|
|
|
@ -254,6 +254,11 @@ class FakeClient(Client):
|
||||||
self.mutable_file_default = SDMF_VERSION
|
self.mutable_file_default = SDMF_VERSION
|
||||||
self.addService(FakeStorageServer(self.nodeid, self.nickname))
|
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):
|
def startService(self):
|
||||||
return service.MultiService.startService(self)
|
return service.MultiService.startService(self)
|
||||||
def stopService(self):
|
def stopService(self):
|
||||||
|
|
|
@ -9,7 +9,7 @@ from nevow.util import resource_filename
|
||||||
|
|
||||||
import allmydata # to display import path
|
import allmydata # to display import path
|
||||||
from allmydata import get_package_versions_string
|
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.interfaces import IFileNode
|
||||||
from allmydata.web import filenode, directory, unlinked, status, operations
|
from allmydata.web import filenode, directory, unlinked, status, operations
|
||||||
from allmydata.web import storage
|
from allmydata.web import storage
|
||||||
|
@ -168,8 +168,9 @@ class Root(rend.Page):
|
||||||
return get_package_versions_string()
|
return get_package_versions_string()
|
||||||
def data_import_path(self, ctx, data):
|
def data_import_path(self, ctx, data):
|
||||||
return str(allmydata)
|
return str(allmydata)
|
||||||
def data_my_nodeid(self, ctx, data):
|
def render_my_nodeid(self, ctx, data):
|
||||||
return idlib.nodeid_b2a(self.client.nodeid)
|
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):
|
def data_my_nickname(self, ctx, data):
|
||||||
return self.client.nickname
|
return self.client.nickname
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Node ID:</th>
|
<th>Node ID:</th>
|
||||||
<td n:render="string" n:data="my_nodeid" />
|
<td n:render="my_nodeid" />
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue