Fix Engine static root fallback for legacy WebUI

This commit is contained in:
2025-10-22 19:07:56 -06:00
parent fd3ec2ab0d
commit 102e77f676
2 changed files with 22 additions and 0 deletions

View File

@@ -114,10 +114,15 @@ def _resolve_static_root(project_root: Path) -> Path:
candidates = (
project_root / "Engine" / "web-interface" / "build",
project_root / "Engine" / "web-interface" / "dist",
project_root / "Engine" / "web-interface",
project_root / "Data" / "Engine" / "WebUI" / "build",
project_root / "Data" / "Engine" / "WebUI",
project_root / "Data" / "Server" / "web-interface" / "build",
project_root / "Data" / "Server" / "web-interface",
project_root / "Data" / "Server" / "WebUI" / "build",
project_root / "Data" / "Server" / "WebUI",
project_root / "Data" / "WebUI" / "build",
project_root / "Data" / "WebUI",
)
for path in candidates:
resolved = path.resolve()

View File

@@ -42,3 +42,20 @@ def test_static_root_env_override(tmp_path, monkeypatch):
monkeypatch.delenv("BOREALIS_STATIC_ROOT", raising=False)
monkeypatch.delenv("BOREALIS_ROOT", raising=False)
def test_static_root_falls_back_to_legacy_source(tmp_path, monkeypatch):
"""Legacy WebUI source should be served when no build assets exist."""
legacy_source = tmp_path / "Data" / "Server" / "WebUI"
legacy_source.mkdir(parents=True)
(legacy_source / "index.html").write_text("<html></html>", encoding="utf-8")
monkeypatch.setenv("BOREALIS_ROOT", str(tmp_path))
monkeypatch.delenv("BOREALIS_STATIC_ROOT", raising=False)
settings = load_environment()
assert settings.flask.static_root == legacy_source.resolve()
monkeypatch.delenv("BOREALIS_ROOT", raising=False)