Try to make http server IP address selection even more obvious when running Setup Wizard #1320

This commit is contained in:
MoojMidge 2025-10-28 06:10:12 +11:00
parent 36e2809028
commit 37b898a0c4
2 changed files with 11 additions and 5 deletions

View file

@ -464,7 +464,8 @@ class AbstractSettings(object):
ip_address = '.'.join(map(str, octets))
if value is not None:
return self.set_string(SETTINGS.HTTPD_LISTEN, ip_address)
if not self.set_string(SETTINGS.HTTPD_LISTEN, ip_address):
return False
return ip_address
def httpd_whitelist(self):

View file

@ -111,8 +111,9 @@ def process_default_settings(context, step, steps, **_kwargs):
background=False,
) as progress_dialog:
progress_dialog.update()
if settings.httpd_listen() == '0.0.0.0':
settings.httpd_listen('127.0.0.1')
ip_address = settings.httpd_listen()
if ip_address == '0.0.0.0':
ip_address = settings.httpd_listen('127.0.0.1')
if not httpd_status(context):
port = settings.httpd_port()
addresses = get_listen_addresses()
@ -120,13 +121,17 @@ def process_default_settings(context, step, steps, **_kwargs):
for address in addresses:
progress_dialog.update()
if httpd_status(context, (address, port)):
settings.httpd_listen(address)
ip_address = settings.httpd_listen(address)
break
context.sleep(5)
context.sleep(3)
else:
ui.show_notification(localize('httpd.connect.failed'),
header=localize('httpd'))
settings.httpd_listen('0.0.0.0')
ip_address = None
if ip_address:
ui.on_ok(context.get_name(),
context.localize('client.ip.is.x', ip_address))
return step