feat: dynamic mode
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user