feat: MD-style popup print for strategy doc and checklist
Open clean white document in new tab with auto print dialog instead of printing the dark hub page. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -80,6 +80,7 @@ from lib.hub.hub_entry_plan_lib import (
|
||||
)
|
||||
from lib.hub.hub_strategy_lib import (
|
||||
build_export_html,
|
||||
build_print_html,
|
||||
load_strategy_payload,
|
||||
strategy_meta_payload,
|
||||
)
|
||||
@@ -2985,6 +2986,19 @@ def api_strategy_export(exchange_key: str):
|
||||
)
|
||||
|
||||
|
||||
@app.get("/api/strategy/{exchange_key}/print")
|
||||
def api_strategy_print(exchange_key: str, part: str = "doc"):
|
||||
key = exchange_key.strip().lower()
|
||||
p = (part or "doc").strip().lower()
|
||||
if p not in ("doc", "checklist"):
|
||||
return JSONResponse({"ok": False, "msg": "part must be doc or checklist"}, status_code=400)
|
||||
try:
|
||||
html = build_print_html(key, p)
|
||||
except KeyError:
|
||||
return JSONResponse({"ok": False, "msg": "unknown exchange or part"}, status_code=404)
|
||||
return HTMLResponse(content=html)
|
||||
|
||||
|
||||
@app.get("/api/entry-plans/meta")
|
||||
def api_entry_plans_meta():
|
||||
init_entry_plan_db()
|
||||
|
||||
Reference in New Issue
Block a user