Keep web Material styling and preserve visible installer access URLs

This commit is contained in:
2026-10-26 18:37:13 +00:00
parent 48c29fd1ff
commit 41a3be8715
13 changed files with 176 additions and 15 deletions
+21 -1
View File
@@ -293,6 +293,24 @@ class Setup:
raise ValueError("Invalid existing authoring role; no permission changes were made")
return existing.get("allow_authoring", False)
def preserve_network_settings(self, prefix, args):
"""A plain reinstall keeps the installed addresses; flags override them."""
path = prefix / MARKER
if not path.exists() and not path.is_symlink():
return
if path.is_symlink() or not path.is_file():
raise ValueError("Refusing to read network settings from a non-regular installation manifest")
existing = json.loads(path.read_text())
web = existing.get("web") or {}
saved = {"port": existing.get("server_port"),
"ntfy_port": existing.get("ntfy_port"),
"bind_address": existing.get("bind_address"),
"web_port": web.get("port"), "web_host": web.get("host")}
supplied = {argument.split("=", 1)[0] for argument in args.argv}
for name, value in saved.items():
if value is not None and "--" + name.replace("_", "-") not in supplied:
setattr(args, name, value)
# --- prefix layout ---------------------------------------------------
def prepare_layout(self, prefix):
@@ -704,6 +722,8 @@ class Setup:
python = self.require_tools()
if args.prefix:
self.prefix_argument = args.prefix
prefix = self.resolve_prefix()
self.preserve_network_settings(prefix, args)
if not 1024 <= args.port <= 65535:
raise ValueError("Invalid server port; choose a value between 1024 and 65535")
if not 1024 <= args.ntfy_port <= 65535:
@@ -717,7 +737,6 @@ class Setup:
ipaddress.IPv4Address(args.web_host)
except ValueError:
raise ValueError("Invalid API/web bind address; use an IPv4 address such as 0.0.0.0 or 127.0.0.1") from None
prefix = self.resolve_prefix()
allow_authoring = self.authoring_role(prefix, args.allow_authoring)
web_public_url = self.environ.get("PIPELINES_WEB_PUBLIC_URL", "")
previous = prefix / MARKER
@@ -843,6 +862,7 @@ class Setup:
"(use a workspace path that exists on this server).")
else:
print(f"Unauthenticated API bound to {args.bind_address}:{args.port}; use the authenticated web URL.")
app_build.print_web_urls(manifest, lan_host=lan_ip)
def arguments(argv=None):