refactor(stmate-test): 끼워 넣기 구조 — scr_*.js 화면·메뉴 자동 등록 · api_*.py 라우터 자동 연결 · app.js 700줄 아래로
- STMATE_PLUGINS(screens · actions · menus) · STMATE_APP(ctx 와 화면 도우미) — app.js 가 등록된 화면을 그리고 메뉴 단추를 붙임 - /plugins_manifest.js 가 scr_*.js 를 불러옴 · server.py 가 api_*.py 의 router 를 연결 - 도구 창 바인딩을 app_modals.js 로 분리(app.js 718 → 613줄) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import pathlib
|
||||
import re
|
||||
import zipfile
|
||||
@@ -645,6 +646,17 @@ def api_export_xlsx(req: ExportXlsxReq):
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
|
||||
# 끼워 넣기 — api_*.py 의 router 자동 연결 · scr_*.js 화면 파일 자동 불러오기
|
||||
for _mod in sorted(HERE.glob("api_*.py")):
|
||||
app.include_router(importlib.import_module(_mod.stem).router)
|
||||
|
||||
|
||||
@app.get("/plugins_manifest.js")
|
||||
def plugins_manifest():
|
||||
tags = "".join(f'<script src="{f.name}"></script>' for f in sorted(HERE.glob("scr_*.js")))
|
||||
return Response(content=f"document.write({tags!r});", media_type="application/javascript")
|
||||
|
||||
|
||||
app.mount("/", StaticFiles(directory=str(HERE), html=True), name="static")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user