Have the client module automatically try to get the localhost creds in connect()
This commit is contained in:
parent
9175ac16fd
commit
be68515fdc
|
@ -146,6 +146,7 @@ class DelugeRPCProtocol(Protocol):
|
|||
|
||||
if message_type == RPC_EVENT:
|
||||
event = request[1]
|
||||
#log.debug("Received RPCEvent: %s", event)
|
||||
# A RPCEvent was received from the daemon so run any handlers
|
||||
# associated with it.
|
||||
if event in self.factory.event_handlers:
|
||||
|
@ -463,6 +464,12 @@ class Client(object):
|
|||
:returns: a Deferred object that will be called once the connection
|
||||
has been established or fails
|
||||
"""
|
||||
if not username and host in ("127.0.0.1", "localhost"):
|
||||
# No username was provided and it's the localhost, so we can try
|
||||
# to grab the credentials from the auth file.
|
||||
import common
|
||||
username, password = common.get_localhost_auth()
|
||||
|
||||
self._daemon_proxy = DaemonSSLProxy(self.__event_handlers)
|
||||
self._daemon_proxy.set_disconnect_callback(self.__on_disconnect)
|
||||
d = self._daemon_proxy.connect(host, port, username, password)
|
||||
|
|
|
@ -282,9 +282,6 @@ class ConnectionManager(component.Component):
|
|||
client.daemon.info().addCallback(on_info)
|
||||
continue
|
||||
|
||||
if host in ("127.0.0.1", "localhost") and not user:
|
||||
# We need to get the localhost creds
|
||||
user, password = deluge.ui.common.get_localhost_auth()
|
||||
# Create a new Client instance
|
||||
c = deluge.ui.client.Client()
|
||||
d = c.connect(host, port, user, password)
|
||||
|
@ -393,10 +390,7 @@ class ConnectionManager(component.Component):
|
|||
port = model[row][HOSTLIST_COL_PORT]
|
||||
user = model[row][HOSTLIST_COL_USER]
|
||||
password = model[row][HOSTLIST_COL_PASS]
|
||||
if not user and host in ("127.0.0.1", "localhost"):
|
||||
# This is a localhost connection with no username, so lets try to
|
||||
# get the localclient creds from the auth file.
|
||||
user, password = deluge.ui.common.get_localhost_auth()
|
||||
|
||||
client.connect(host, port, user, password).addCallback(self.__on_connected, host_id)
|
||||
self.connection_manager.response(gtk.RESPONSE_OK)
|
||||
|
||||
|
|
Loading…
Reference in New Issue