Fix web GUI WebSocket: use relative public_url
Setting public_url="" makes textual-serve generate relative WebSocket URLs so the browser connects to the correct host regardless of whether accessed via localhost or remote IP. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,12 +12,21 @@ def main():
|
||||
if "--web" in sys.argv:
|
||||
from textual_serve.server import Server
|
||||
port = 8080
|
||||
host = "0.0.0.0"
|
||||
for i, arg in enumerate(sys.argv):
|
||||
if arg == "--port" and i + 1 < len(sys.argv):
|
||||
port = int(sys.argv[i + 1])
|
||||
elif arg == "--host" and i + 1 < len(sys.argv):
|
||||
host = sys.argv[i + 1]
|
||||
os.environ["PYTHONPATH"] = f"{_ROOT}:{os.environ.get('PYTHONPATH', '')}"
|
||||
os.environ["GNIZA_DIR"] = _ROOT
|
||||
server = Server("python3 -m tui", host="0.0.0.0", port=port, title="gniza")
|
||||
server = Server(
|
||||
"python3 -m tui",
|
||||
host=host,
|
||||
port=port,
|
||||
title="gniza",
|
||||
public_url="",
|
||||
)
|
||||
server.serve()
|
||||
else:
|
||||
app = GnizaApp()
|
||||
|
||||
Reference in New Issue
Block a user