From e27423e4a946477bbe80869fd5485825d9a515bf Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 6 Mar 2012 18:25:05 -0800 Subject: [PATCH] introducer web page: add CSS styling, roughly match client Welcome page Also add /static and the top-level /tahoe.css -type stuff to the introducer's web server. --- src/allmydata/introducer/server.py | 4 +- src/allmydata/web/introducer.xhtml | 91 +++++++++++++++++------------- src/allmydata/web/introweb.py | 13 ++++- 3 files changed, 64 insertions(+), 44 deletions(-) diff --git a/src/allmydata/introducer/server.py b/src/allmydata/introducer/server.py index dd042a4f..10dc1a05 100644 --- a/src/allmydata/introducer/server.py +++ b/src/allmydata/introducer/server.py @@ -42,7 +42,9 @@ class IntroducerNode(node.Node): from allmydata.webish import IntroducerWebishServer nodeurl_path = os.path.join(self.basedir, "node.url") - ws = IntroducerWebishServer(self, webport, nodeurl_path) + staticdir = self.get_config("node", "web.static", "public_html") + staticdir = os.path.expanduser(staticdir) + ws = IntroducerWebishServer(self, webport, nodeurl_path, staticdir) self.add_service(ws) class IntroducerService(service.MultiService, Referenceable): diff --git a/src/allmydata/web/introducer.xhtml b/src/allmydata/web/introducer.xhtml index e1a9d181..501f78da 100644 --- a/src/allmydata/web/introducer.xhtml +++ b/src/allmydata/web/introducer.xhtml @@ -1,65 +1,76 @@ - - - Tahoe-LAFS - Introducer Status - - - - + + Tahoe-LAFS - Introducer Status + + + +

Welcome To The Tahoe-LAFS Introducer

-

My Code

+
+

This Introducer

-
My nodeid:
-
My versions:
-
Tahoe-LAFS code imported from:
- -
+ + + + +
My nodeid:
My versions:
Tahoe-LAFS code imported from:
+
Announcement Summary:
Subscription Summary:
-

Service Announcements

+
-
- + +
+

Service Announcements

+
- - - - - + + + + + - - - - - + + + + +
PeerID / NicknameAdvertised IPsAnnouncedVersionService Name +
Nickname
+
PeerID
Advertised IPsAnnouncedVersionService Name
+
+
no peers!
-

Subscribed Clients

- +

Subscribed Clients

+
- - - - - - + + + + + + - - - - - - + + + + + +
PeerID / NicknameAdvertised IPsConnected FromSinceVersionSubscribed To +
Nickname
+
PeerID
Advertised IPsConnected FromSinceVersionSubscribed To
+
+
no peers!
diff --git a/src/allmydata/web/introweb.py b/src/allmydata/web/introweb.py index 28273bd7..0e25e20a 100644 --- a/src/allmydata/web/introweb.py +++ b/src/allmydata/web/introweb.py @@ -1,6 +1,8 @@ -import time +import time, os from nevow import rend, inevow +from nevow.static import File as nevow_File +from nevow.util import resource_filename from foolscap.api import SturdyRef from twisted.internet import address import allmydata @@ -20,6 +22,9 @@ class IntroducerRoot(rend.Page): self.introducer_node = introducer_node self.introducer_service = introducer_node.getServiceNamed("introducer") rend.Page.__init__(self, introducer_node) + static_dir = resource_filename("allmydata.web", "static") + for filen in os.listdir(static_dir): + self.putChild(filen, nevow_File(os.path.join(static_dir, filen))) def renderHTTP(self, ctx): t = get_arg(inevow.IRequest(ctx), "t") @@ -104,7 +109,8 @@ class IntroducerRoot(rend.Page): sr = SturdyRef(furl) nodeid = sr.tubID advertised = self.show_location_hints(sr) - ctx.fillSlots("peerid", "%s %s" % (nodeid, nickname)) + ctx.fillSlots("peerid", nodeid) + ctx.fillSlots("nickname", nickname) ctx.fillSlots("advertised", " ".join(advertised)) ctx.fillSlots("connected", "?") TIME_FORMAT = "%H:%M:%S %d-%b-%Y" @@ -147,7 +153,8 @@ class IntroducerRoot(rend.Page): sr = rref.getSturdyRef() # if the subscriber didn't do Tub.setLocation, nodeid will be None nodeid = sr.tubID or "?" - ctx.fillSlots("peerid", "%s %s" % (nodeid, nickname)) + ctx.fillSlots("peerid", nodeid) + ctx.fillSlots("nickname", nickname) advertised = self.show_location_hints(sr) ctx.fillSlots("advertised", " ".join(advertised)) remote_host = rref.tracker.broker.transport.getPeer() -- 2.37.2