feat: duplicate detection + original URL in description

- Add original recipe URL to Mealie description (appended after blank line)
- Check for duplicate recipes on scrape (match orgURL or URL in description)
- Show warning with link to existing recipe if duplicate found
- User can still import anyway (warning only, not blocking)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 09:02:53 +01:00
parent a27b322409
commit f7810ba33d
4 changed files with 63 additions and 4 deletions
+13 -1
View File
@@ -81,7 +81,19 @@ def scrape_url():
return jsonify({"ok": False, "error": "Nincs URL megadva."})
try:
data = scrape(url)
return jsonify({"ok": True, "data": data})
# Check for duplicate in Mealie
duplicate = None
cfg = config.load()
if cfg.get("mealie_url") and cfg.get("mealie_api_key"):
try:
client = MealieClient(cfg["mealie_url"], cfg["mealie_api_key"],
api_url=config.MEALIE_INTERNAL_URL)
duplicate = client.find_duplicate(url, data.get("title", ""))
except Exception:
pass # non-fatal
return jsonify({"ok": True, "data": data, "duplicate": duplicate})
except Exception as exc:
return jsonify({"ok": False, "error": str(exc), "trace": traceback.format_exc()})