secrets tab, drop commute filter, favicon, robust error reports

1. Admin → Geheimnisse sub-tab lets you edit ANTHROPIC_API_KEY +
   BERLIN_WOHNEN_USERNAME/PASSWORD at runtime. Migration v7 adds a
   secrets(key,value,updated_at) table; startup seeds missing keys from
   env (idempotent). web reads secrets DB-first (env fallback) via
   llm._api_key(); alert fetches them from web /internal/secrets on each
   scan, passes them into Scraper(). Rotating creds no longer needs a
   redeploy.
   Masked display: 6 leading + 4 trailing chars, "…" in the middle.
   Blank form fields leave the stored value untouched.

2. Drop the max_morning_commute filter from UI + server + FILTER_KEYS +
   filter summary (the underlying Maps.calculate_score code stays for
   potential future re-enable).

3. /static/didi.webp wired as favicon via <link rel="icon"> in base.html.

4. apply.open_page wraps page.goto in try/except so a failed load still
   produces a "goto.failed" step + screenshot instead of returning an
   empty forensics blob. networkidle + post-submission sleep are also
   made best-effort. The error ZIP export already writes screenshot+HTML
   per step and final_html — with this change every apply run leaves a
   reconstructable trail even when the listing is already offline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
EiSiMo 2026-04-21 17:56:57 +02:00
parent 9fbe1ce728
commit 3bb04210c4
12 changed files with 211 additions and 27 deletions

View file

@ -188,11 +188,25 @@ async def open_page(url: str, recorder: Optional[Recorder] = None):
if recorder:
recorder.step("goto", detail=url)
await page.goto(url)
await page.wait_for_load_state("networkidle")
if recorder:
recorder.step("loaded", detail=page.url)
await recorder.snap(page, "loaded")
goto_failed = False
try:
await page.goto(url, timeout=45_000)
except Exception as e:
goto_failed = True
if recorder:
recorder.step("goto.failed", "error", f"{type(e).__name__}: {e}")
try:
await recorder.snap(page, "goto.failed")
except Exception:
logger.exception("snap after goto.failed failed")
if not goto_failed:
try:
await page.wait_for_load_state("networkidle", timeout=15_000)
except Exception:
pass
if recorder:
recorder.step("loaded", detail=page.url)
await recorder.snap(page, "loaded")
try:
yield page
@ -202,7 +216,10 @@ async def open_page(url: str, recorder: Optional[Recorder] = None):
await recorder.finalize(page)
except Exception:
logger.exception("recorder.finalize failed")
await page.wait_for_timeout(POST_SUBMISSION_SLEEP_MS)
try:
await page.wait_for_timeout(POST_SUBMISSION_SLEEP_MS)
except Exception:
pass
await browser.close()