feat: composer improvements

This commit is contained in:
2026-04-05 09:53:01 +02:00
parent 7838760ca4
commit e1db06104e
17 changed files with 1301 additions and 332 deletions

View File

@@ -264,12 +264,19 @@ async def get_remote_page(hash_hex: str, path: str = Query("index.mu")):
# ---------------------------------------------------------------------------
def _read_local_page(path: str) -> dict:
from converter import execute_dynamic_script
pages_dir = os.environ.get("PAGES_DIR", str(Path.home() / ".nomadnetwork/storage/pages"))
filepath = Path(pages_dir) / path
try:
return {"content": filepath.read_text()}
except FileNotFoundError:
if not filepath.exists():
return {"content": None, "error": "Page not found"}
try:
if os.access(filepath, os.X_OK):
script = filepath.read_text(encoding="utf-8")
return {"content": execute_dynamic_script(script)}
return {"content": filepath.read_text()}
except Exception as exc:
return {"content": None, "error": str(exc)}
# ---------------------------------------------------------------------------