@@ -72,10 +72,10 @@ def generate_credentials():
7272 """Generate random username and password for IP-based login.
7373
7474 Returns:
75- tuple: (username, password) where username is 12 chars and password is 20 chars
75+ tuple: (username, password) where username is 9 chars and password is 20 chars
7676 """
7777 chars = string .ascii_lowercase + string .digits
78- username = "" .join (random .choices (chars , k = 12 ))
78+ username = "" .join (random .choices (chars , k = 9 ))
7979 password = "" .join (random .choices (chars , k = 20 ))
8080 return username , password
8181
@@ -87,7 +87,7 @@ def create_qr_url(domain_or_ip):
8787 domain_or_ip: Either a domain name or an IP address
8888
8989 Returns:
90- str: Either dcaccount:domain or dclogin:username@ip /?p=password&v=1&ip=993&sp=465&ic=3&ss=default
90+ str: Either dcaccount:domain or dclogin:username@[ip] /?p=password&v=1&ih=ip&sh=ip &ip=993&sp=465&ic=3&ss=default
9191 """
9292 if is_ip_address (domain_or_ip ):
9393 # Generate credentials for IP address
@@ -99,8 +99,8 @@ def create_qr_url(domain_or_ip):
9999
100100 # Format: dclogin:username@host/?query
101101 qr_url = (
102- f"dclogin:{ username } @{ domain_or_ip } /?"
103- f"p={ encoded_password } &v=1&ip=993&sp=465&ic=3&ss=default"
102+ f"dclogin:{ username } @[ { domain_or_ip } ] /?"
103+ f"p={ encoded_password } &v=1&ih= { domain_or_ip } &sh= { domain_or_ip } & ip=993&sp=465&ic=3&ss=default"
104104 )
105105 return qr_url
106106 else :
@@ -241,12 +241,13 @@ def _add_online(self, account):
241241
242242 def get_relay_account (self , domain ):
243243 # Try to find an existing account for this domain/IP
244+ expected_domain = f"[{ domain } ]" if is_ip_address (domain ) else domain
244245 for account in self .dc .get_all_accounts ():
245246 addr = account .get_config ("configured_addr" )
246247 if addr is not None :
247248 # Extract the domain/IP from the configured address
248249 addr_domain = addr .split ("@" )[1 ] if "@" in addr else None
249- if addr_domain == domain :
250+ if addr_domain == expected_domain :
250251 if account not in self .online :
251252 if self .verbose >= 3 :
252253 print (f" Reusing existing account: { addr } " )
0 commit comments