Merge branch 'worktree-agent-ac54c8919e940163a'
# Conflicts: # scripts/setup-native.py
This commit is contained in:
+18
-4
@@ -52,10 +52,24 @@ def mdns_args(config):
|
||||
"""
|
||||
web = config.get("web") or {}
|
||||
if web.get("port") and web.get("host") not in (None, "", "127.0.0.1", "localhost", "::1"):
|
||||
return ["-mdns-port", str(web["port"])]
|
||||
# Loopback + tailnet: the advert carries only the tailnet/public routes.
|
||||
lan = web.get("host") != "tailnet" or web.get("lan") is True
|
||||
return ["-mdns-port", str(web["port"])] + ([] if lan else ["-mdns-lan=false"])
|
||||
return []
|
||||
|
||||
|
||||
def web_listen_args(web):
|
||||
"""The proxy's bind and access flags. "tailnet" (the installer default)
|
||||
binds the wildcard and admits only loopback and tailnet connections, plus
|
||||
the LAN when web.lan is set; sign-in over plain-HTTP LAN additionally needs
|
||||
web.lan_plain_login. A literal address is bound as before, unfiltered."""
|
||||
if web.get("host") != "tailnet":
|
||||
return ["--host", web["host"]]
|
||||
lan = web.get("lan") is True
|
||||
return (["--host", "::", "--allow", "loopback,tailnet" + (",lan" if lan else "")]
|
||||
+ (["--lan-plain-login"] if lan and web.get("lan_plain_login") is True else []))
|
||||
|
||||
|
||||
def load(prefix):
|
||||
prefix = Path(prefix).expanduser().resolve()
|
||||
path = prefix / MARKER
|
||||
@@ -224,7 +238,7 @@ def start(config):
|
||||
wait_health(f"http://127.0.0.1:{config['server_port']}/healthz", timeout=75)
|
||||
if config.get("web"):
|
||||
web = config["web"]
|
||||
host = "127.0.0.1" if web["host"] == "0.0.0.0" else web["host"]
|
||||
host = "127.0.0.1" if web["host"] in ("0.0.0.0", "tailnet") else web["host"]
|
||||
end = time.monotonic() + 20
|
||||
while True:
|
||||
try:
|
||||
@@ -325,7 +339,7 @@ def report(config):
|
||||
if web:
|
||||
public = (config.get("opencode_env") or {}).get("PIPELINES_WEB_PUBLIC_URL")
|
||||
print("== Access")
|
||||
address = public or f"http://{web['host']}:{web['port']}"
|
||||
address = public or f"http://{'127.0.0.1' if web['host'] == 'tailnet' else web['host']}:{web['port']}"
|
||||
print(f" {'Web':<10} {address} (password in {web['auth_file']})")
|
||||
root = Path(web["root"]) if web.get("root") else None
|
||||
built = root is not None and (root / "index.html").is_file()
|
||||
@@ -440,7 +454,7 @@ def supervise(config):
|
||||
with (root / "logs/web.log").open("a") as web_log:
|
||||
web_child = subprocess.Popen(
|
||||
[web["node"], web["script"], "--port", str(web["port"]),
|
||||
"--host", web["host"], "--pipelines", f"127.0.0.1:{config['server_port']}",
|
||||
*web_listen_args(web), "--pipelines", f"127.0.0.1:{config['server_port']}",
|
||||
*(["--root", web["root"]] if web.get("root") else []),
|
||||
*(["--updates", web["updates"]] if web.get("updates") else [])],
|
||||
env=web_env, stdout=web_log, stderr=web_log)
|
||||
|
||||
Reference in New Issue
Block a user