mirror of
https://github.com/Andre-Bzk/Rezept0r.git
synced 2026-11-15 15:43:04 +01:00
fix: Rezeptverlauf-Bilder lokal speichern und Windows-Subprocess-Fix
- Bilder beim Extrahieren lokal cachen (data/images/{id}.ext) und über GET /api/history/{id}/image ausliefern; Löschen bei Verlaufseintrag-Entfernung
- history.db in ./data/ Volume verschoben, damit sie Container-Rebuilds überlebt
- yt-dlp Subprocess-Aufrufe auf Windows gefixt: run_in_executor statt asyncio.create_subprocess_exec (SelectorEventLoop-Kompatibilität)
- ./data:/app/data Docker-Volume für persistente Datenhaltung hinzugefügt
This commit is contained in:
@@ -11,7 +11,7 @@ from app.config import get_settings
|
||||
|
||||
def _db_path() -> Path:
|
||||
settings = get_settings()
|
||||
return Path(settings.tmp_dir).parent / "history.db"
|
||||
return Path(settings.images_dir).parent / "history.db"
|
||||
|
||||
|
||||
def init_db() -> None:
|
||||
@@ -73,6 +73,15 @@ def delete_recipe(history_id: int) -> None:
|
||||
conn.commit()
|
||||
|
||||
|
||||
def update_image_url(history_id: int, image_url: str) -> None:
|
||||
with sqlite3.connect(_db_path()) as conn:
|
||||
conn.execute(
|
||||
"UPDATE recipe_history SET image_url = ? WHERE id = ?",
|
||||
(image_url, history_id),
|
||||
)
|
||||
conn.commit()
|
||||
|
||||
|
||||
def mark_imported(history_id: int, tandoor_recipe_id: Optional[int]) -> None:
|
||||
now = datetime.now(timezone.utc).isoformat()
|
||||
with sqlite3.connect(_db_path()) as conn:
|
||||
|
||||
Reference in New Issue
Block a user