multi-user: users, per-user profiles/filters/notifications, tab UI, apply forensics
* DB: users + user_profiles/filters/notifications/preferences; applications gets user_id + forensics_json + profile_snapshot_json; new errors table with 14d retention; schema versioning via MIGRATIONS list * auth: password hashes in DB (argon2); env vars seed first admin; per-user sessions; CSRF bound to user id * apply: personal info/WBS moved out of env into the request body; providers take an ApplyContext with Profile + submit_forms; full Playwright recorder (step log, console, page errors, network, screenshots, final HTML) * web: five top-level tabs (Wohnungen/Bewerbungen/Logs/Fehler/Einstellungen); settings sub-tabs profil/filter/benachrichtigungen/account/benutzer; per-user matching, auto-apply and notifications (UI/Telegram/SMTP); red auto-apply switch on Wohnungen tab; forensics detail view for bewerbungen and fehler; retention background thread Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e663386a19
commit
c630b500ef
36 changed files with 2763 additions and 1113 deletions
|
|
@ -16,39 +16,47 @@ def _required(key: str) -> str:
|
|||
return val
|
||||
|
||||
|
||||
# --- Auth ---
|
||||
# --- Admin bootstrap ----------------------------------------------------------
|
||||
# On first boot the web service seeds this user as an admin in the database.
|
||||
# Afterwards the user record in SQLite is authoritative: changing the hash in
|
||||
# env does NOT rotate the DB password — use the /einstellungen UI.
|
||||
AUTH_USERNAME: str = _required("AUTH_USERNAME")
|
||||
# argon2 hash of the password. Generate via:
|
||||
# python -c "from argon2 import PasswordHasher; print(PasswordHasher().hash('<password>'))"
|
||||
AUTH_PASSWORD_HASH: str = _required("AUTH_PASSWORD_HASH")
|
||||
|
||||
# Signs session cookies. If missing -> ephemeral random secret (invalidates sessions on restart).
|
||||
# --- Session cookie -----------------------------------------------------------
|
||||
SESSION_SECRET: str = getenv("SESSION_SECRET") or secrets.token_urlsafe(48)
|
||||
SESSION_COOKIE_NAME: str = "lazyflat_session"
|
||||
SESSION_MAX_AGE_SECONDS: int = int(getenv("SESSION_MAX_AGE_SECONDS", str(60 * 60 * 24 * 7)))
|
||||
|
||||
# When behind an HTTPS proxy (Coolify/Traefik) this MUST be true so cookies are Secure.
|
||||
COOKIE_SECURE: bool = getenv("COOKIE_SECURE", "true").lower() in ("true", "1", "yes", "on")
|
||||
|
||||
# --- Internal service auth ---
|
||||
# --- Internal service auth ----------------------------------------------------
|
||||
INTERNAL_API_KEY: str = _required("INTERNAL_API_KEY")
|
||||
|
||||
# --- Apply service ---
|
||||
# --- Apply service ------------------------------------------------------------
|
||||
APPLY_URL: str = getenv("APPLY_URL", "http://apply:8000")
|
||||
APPLY_TIMEOUT: int = int(getenv("APPLY_TIMEOUT", "600"))
|
||||
# Circuit breaker: disable auto-apply after N consecutive apply failures.
|
||||
APPLY_FAILURE_THRESHOLD: int = int(getenv("APPLY_FAILURE_THRESHOLD", "3"))
|
||||
|
||||
# --- Storage ---
|
||||
# --- Storage ------------------------------------------------------------------
|
||||
DATA_DIR: Path = Path(getenv("DATA_DIR", "/data"))
|
||||
DATA_DIR.mkdir(parents=True, exist_ok=True)
|
||||
DB_PATH: Path = DATA_DIR / "lazyflat.sqlite"
|
||||
|
||||
# --- Rate limiting ---
|
||||
# Retention (errors / audit / application forensics). Default 14 days.
|
||||
RETENTION_DAYS: int = int(getenv("RETENTION_DAYS", "14"))
|
||||
RETENTION_RUN_INTERVAL_SECONDS: int = int(getenv("RETENTION_RUN_INTERVAL_SECONDS", str(60 * 60)))
|
||||
|
||||
# --- Rate limiting ------------------------------------------------------------
|
||||
LOGIN_RATE_LIMIT: int = int(getenv("LOGIN_RATE_LIMIT", "5"))
|
||||
LOGIN_RATE_WINDOW_SECONDS: int = int(getenv("LOGIN_RATE_WINDOW_SECONDS", "900"))
|
||||
|
||||
# --- Filter criteria (mirrored from original flat-alert) ---
|
||||
FILTER_ROOMS: list[float] = [float(r) for r in getenv("FILTER_ROOMS", "2.0,2.5").split(",") if r.strip()]
|
||||
FILTER_MAX_RENT: float = float(getenv("FILTER_MAX_RENT", "1500"))
|
||||
FILTER_MAX_MORNING_COMMUTE: float = float(getenv("FILTER_MAX_MORNING_COMMUTE", "50"))
|
||||
# --- Email (system-wide SMTP for notifications) -------------------------------
|
||||
SMTP_HOST: str = getenv("SMTP_HOST", "")
|
||||
SMTP_PORT: int = int(getenv("SMTP_PORT", "587"))
|
||||
SMTP_USERNAME: str = getenv("SMTP_USERNAME", "")
|
||||
SMTP_PASSWORD: str = getenv("SMTP_PASSWORD", "")
|
||||
SMTP_FROM: str = getenv("SMTP_FROM", "lazyflat@localhost")
|
||||
SMTP_STARTTLS: bool = getenv("SMTP_STARTTLS", "true").lower() in ("true", "1", "yes", "on")
|
||||
|
||||
# --- App URL (used to build links in notifications) ---------------------------
|
||||
PUBLIC_URL: str = getenv("PUBLIC_URL", "https://flat.lab.moritz.run")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue