From 8485ff53fc1467e54f1498630cf70fa9eb40bb91 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Mon, 28 Jan 2008 13:56:22 -0700
Subject: [PATCH] display the Helper FURL and our connection status on the
 welcome page. Closes #285.

---
 src/allmydata/upload.py         |  4 ++++
 src/allmydata/web/welcome.xhtml |  5 +++++
 src/allmydata/webish.py         | 12 ++++++++++++
 3 files changed, 21 insertions(+)

diff --git a/src/allmydata/upload.py b/src/allmydata/upload.py
index b1ea5702..b33ec085 100644
--- a/src/allmydata/upload.py
+++ b/src/allmydata/upload.py
@@ -944,6 +944,10 @@ class Uploader(service.MultiService):
     def _got_helper(self, helper):
         self._helper = helper
 
+    def get_helper_info(self):
+        # return a tuple of (helper_furl_or_None, connected_bool)
+        return (self._helper_furl, bool(self._helper))
+
     def upload(self, uploadable):
         # this returns the URI
         assert self.parent
diff --git a/src/allmydata/web/welcome.xhtml b/src/allmydata/web/welcome.xhtml
index 05192537..73ad3c9d 100644
--- a/src/allmydata/web/welcome.xhtml
+++ b/src/allmydata/web/welcome.xhtml
@@ -18,8 +18,13 @@ tool</a> may also be useful.</div>
 
 <div>My nodeid: <span n:render="string" n:data="my_nodeid" /></div>
 <div>My version: <span n:render="string" n:data="version" /></div>
+
 <div>Introducer: <span n:render="string" n:data="introducer_furl" /></div>
 <div>Connected to introducer?: <span n:render="string" n:data="connected_to_introducer" /></div>
+
+<div>Helper: <span n:render="string" n:data="helper_furl" /></div>
+<div>Connected to helper?: <span n:render="string" n:data="connected_to_helper" /></div>
+
 <div>Known+Connected Peers: <span n:render="string" n:data="num_peers" /></div>
 
 <div>
diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py
index 93f534b4..6c404466 100644
--- a/src/allmydata/webish.py
+++ b/src/allmydata/webish.py
@@ -1319,6 +1319,18 @@ class Root(rend.Page):
         if IClient(ctx).connected_to_introducer():
             return "yes"
         return "no"
+
+    def data_helper_furl(self, ctx, data):
+        uploader = IClient(ctx).getServiceNamed("uploader")
+        furl, connected = uploader.get_helper_info()
+        return furl
+    def data_connected_to_helper(self, ctx, data):
+        uploader = IClient(ctx).getServiceNamed("uploader")
+        furl, connected = uploader.get_helper_info()
+        if connected:
+            return "yes"
+        return "no"
+
     def data_num_peers(self, ctx, data):
         #client = inevow.ISite(ctx)._client
         client = IClient(ctx)
-- 
2.45.2