close sh;able to save/load projects

This commit is contained in:
2026-03-30 18:36:41 -06:00
parent 246d816f84
commit ea3f1d2b23
15 changed files with 44871 additions and 31 deletions

View File

@ -1,6 +1,7 @@
import logging
import os
import stat
import sys
from contextlib import asynccontextmanager
from pathlib import Path
@ -13,6 +14,9 @@ from routers import transcribe, export, ai, captions, audio
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
# Dev log file — frontend forwards console.error/warn here so the agent can read it
DEV_LOG_PATH = Path(__file__).parent.parent / "webview.log"
@asynccontextmanager
async def lifespan(app: FastAPI):
@ -134,3 +138,21 @@ async def serve_local_file(request: Request, path: str = Query(...)):
@app.get("/health")
async def health():
return {"status": "ok"}
import datetime
@app.post("/dev/log")
async def dev_log(request: Request):
data = await request.json()
level = data.get("level", "log")
msg = str(data.get("message", ""))
args = [str(a) for a in data.get("args", [])]
ts = datetime.datetime.now().strftime("%H:%M:%S.%f")[:-3]
line = f"[{ts}] [{level.upper():5}] {msg}"
if args:
line += " " + " ".join(args)
line += "\n"
with open(DEV_LOG_PATH, "a") as f:
f.write(line)
return {"ok": True}