Ticket #653: auth.diff
File auth.diff, 2.5 KB (added by , 16 years ago) |
---|
-
deluge/ui/common.py
29 29 30 30 from deluge import bencode 31 31 from deluge.log import LOG as log 32 from deluge.core.authmanager import AuthManager 32 33 import deluge.configmanager 33 34 34 35 class TorrentInfo(object): … … 128 129 :returns: a localhost uri containing authentication information or None if the information is not available 129 130 """ 130 131 auth_file = deluge.configmanager.get_config_dir("auth") 131 if os.path.exists(auth_file): 132 u = urlparse.urlsplit(uri) 133 for line in open(auth_file): 134 try: 135 username, password = line.strip().split(":") 136 except ValueError: 137 continue 132 if not os.path.exists(auth_file): 133 AuthManager().start() 134 auth_file = deluge.configmanager.get_config_dir("auth") 138 135 139 if username == "localclient": 140 # We use '127.0.0.1' in place of 'localhost' just incase this isn't defined properly 141 hostname = u.hostname.replace("localhost", "127.0.0.1") 142 return u.scheme + "://" + username + ":" + password + "@" + hostname + ":" + str(u.port) 143 return None 136 u = urlparse.urlsplit(uri) 137 rtn_uri = None 138 for line in open(auth_file): 139 try: 140 username, password = line.strip().split(":") 141 except ValueError: 142 continue 143 144 # We use '127.0.0.1' in place of 'localhost' 145 # just incase this isn't defined properly 146 hostname = u.hostname.replace("localhost", "127.0.0.1") 147 148 if username == "localclient" and hostname == "127.0.0.1": 149 rtn_uri = u.scheme + "://" + username + ":" + password + "@" + hostname + ":" + str(u.port) 150 151 return rtn_uri -
deluge/ui/gtkui/connectionmanager.py
157 157 # We need to keep trying because the daemon may not have been started yet 158 158 # and the 'auth' file may not have been created 159 159 uri = get_localhost_auth_uri(DEFAULT_URI) 160 if uri == None: 161 raise Exception('Could not locate localclient authorization') 160 162 time.sleep(0.01) 161 163 162 164 while not self.test_online_status(uri):