This commit is contained in:
2026-05-29 13:37:26 +02:00
parent d290be0f6b
commit f02d6dcb8a
80 changed files with 107 additions and 1090 deletions
+6
View File
@@ -1,3 +1,7 @@
# app.py | v1.0 | 2026-05-29
# FastAPI server pro příjem .msg a .db souborů a upload do Dropboxu.
# Endpointy: /upload (.msg → /msgs), /upload-db (.db → /msgs/db), /upload-dropbox (→ Dropbox /!!!Days/Downloads Z230).
from fastapi import FastAPI, UploadFile, File, Header, HTTPException
import shutil
from pathlib import Path
@@ -47,6 +51,8 @@ async def upload_db(
raise HTTPException(status_code=401, detail="Unauthorized")
if not file.filename.endswith(".db"):
raise HTTPException(status_code=400, detail="Only .db files accepted")
for old in DB_DIR.glob("*.db"):
old.unlink()
dest = DB_DIR / file.filename
with dest.open("wb") as f:
shutil.copyfileobj(file.file, f)