connect page,better support for remote daemons

This commit is contained in:
Martijn Voncken 2008-06-22 19:50:00 +00:00
parent b6a300f687
commit 263c014715
3 changed files with 14 additions and 6 deletions

View File

@ -284,14 +284,20 @@ class connect:
@deco.check_session
@deco.deluge_page_noauth
def GET(self, name):
restart = False
try:
proxy.ping()
connected = proxy.get_core_uri()
if connected.startswith("http://localhost"):
restart = True
except:
connected = None
connect_list = ["http://localhost:58846"]
return render.connect(connect_list, connected)
if config.get('daemon') <> "http://localhost:58846":
connect_list = [config.get('daemon')] + connect_list
return render.connect(connect_list, connected ,restart)
def POST(self):
vars = web.input(uri = None, other_uri = None)

View File

@ -1,4 +1,4 @@
$def with (connect_list, connected)
$def with (connect_list, connected, restart)
$:render.header(_("Connect to Daemon"), 'connect')
@ -12,15 +12,17 @@ $if connected:
$_('Connected to')
$connected
</td><td>
&nbsp;
<form method="POST" action="$base/daemon/control/stop">
<input type="submit" name="stop"
value="$_('Stop')">
</form>
</td><td>
<form method="POST" action="$base/daemon/control/restart">
<input type="submit" name="restart"
value="$_('Restart')">
</form>
$if restart:
<input type="submit" name="restart"
value="$_('Restart')">
</form>
</td></tr></table>
$else:
<div class="error">$_("Not Connected to a daemon")

View File

@ -39,7 +39,7 @@ $for id, title, url in admin_pages:
</td><td>
</td><td align="right" width="320px">
</td><td align="right" width="420px">
$:part_stats()
</td></tr></table>