feat: dynamic mode

This commit is contained in:
2026-04-01 08:28:44 +02:00
parent df11705875
commit 619d3ec538
16 changed files with 1184 additions and 38 deletions

View File

@@ -150,7 +150,16 @@ async def save_page(name: str, req: SaveRequest):
try:
result = uframe.compile(req.source)
mu_path = PAGES_DIR / f"{name}.mu"
mu_path.write_text(result.micron, encoding="utf-8")
if result.is_dynamic and result.script:
# Dynamic page: write executable Python script
mu_path.write_text(result.script, encoding="utf-8")
mu_path.chmod(0o755) # Set execute bit for NomadNet
else:
# Static page: write compiled Micron
mu_path.write_text(result.micron, encoding="utf-8")
# Remove execute bit if it was previously dynamic
mu_path.chmod(0o644)
except Exception as e:
raise HTTPException(
status_code=422,