1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-02 15:04:50 +08:00

Support listening on multiple addresses.

This commit is contained in:
comfyanonymous
2024-09-23 04:36:59 -04:00
parent 9c41bc8d10
commit 447da7ea86
2 changed files with 26 additions and 9 deletions

View File

@@ -160,7 +160,10 @@ def prompt_worker(q, server):
need_gc = False
async def run(server, address='', port=8188, verbose=True, call_on_start=None):
await asyncio.gather(server.start(address, port, verbose, call_on_start), server.publish_loop())
addresses = []
for addr in address.split(","):
addresses.append((addr, port))
await asyncio.gather(server.start_multi_address(addresses, call_on_start), server.publish_loop())
def hijack_progress(server):
@@ -248,6 +251,8 @@ if __name__ == "__main__":
import webbrowser
if os.name == 'nt' and address == '0.0.0.0':
address = '127.0.0.1'
if ':' in address:
address = "[{}]".format(address)
webbrowser.open(f"{scheme}://{address}:{port}")
call_on_start = startup_server