USP-Confirmed: Outlook-OAuth Casino-Bonus-Mail wurde end-to-end gefiltert (User-verifiziert). Mit dieser Welle ist der Daemon plus alle Scan-Pfade OAuth-aware. Backend — Mail-Stack (mo): - backend/server/utils/mail-auth.ts NEU: zentraler resolveImapAuth-Helper kapselt OAuth-vs-AppPassword-Entscheidung. 5-min-Token-Expiry-Puffer, race-condition-sicheres Refresh via refreshAndSaveTokens. - scan.post.ts + scan-internal.post.ts nutzen jetzt resolveImapAuth statt decrypt(passwordEncrypted). Vorher: Outlook-Connections wurden still übersprungen weil passwordEncrypted='' → decrypt failed. Cron + manueller Scan-Button funktionieren jetzt für OAuth-Connections. - imap-idle: Initial-Sweep via triggerScan(conn) direkt nach Connect-Success. Neue Outlook-Connections kriegen sofort einen Full-Folder-Scan statt bis zu 30 Min Cron-Lag zu warten. scan-internal scannt ohnehin schon alle Folders via imap.list() (Junk, Spam, Archive, Custom) — Multi-Folder- Anforderung ist damit erfüllt. Frontend — Mail-Page Polish v4 (rebreak-native-ui): - MailDistributionChart: Donut zurück auf 200px (240 wuchs auch in der Breite und quetschte die Legend), "Live"-Pill-Header komplett raus (paddingTop von 16 auf 13 reduziert für tighteres Layout) - mail.tsx Page-Hierarchie: "Mehr Infos"-Collapsible wandert von unter der Postfach-Liste direkt unter den Hero-Donut. Sub-Beschreibung "Blockiert — letzte 30 Tage" entfernt — Title reicht. - Account-Card Expanded: adaptive Bar-Chart über Connection-Age (too-new <24h zeigt Empty-State, 1-14d Day-Buckets via Backend ?connectionId=, 15-90d client-Week-Aggregation, >90d Month) - Account-Card Expanded: Scan-Button "Jetzt scannen" mit Refresh-Icon (Memory: kein Pen-Icon, refresh ok). Spinner während Scan, Feedback mit Blocked-Count nach Success. Eskalations-Hinweis (nicht in dieser Welle): - POST /api/mail/scan akzeptiert noch keinen connectionId-Filter → Scan-Button-Tap scannt aktuell alle Connections statt nur die angeklickte. Kleiner Folge-Patch, nicht blocking. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
rebreak-imap-idle
Standalone IMAP IDLE Daemon für Rebreak.
Was er macht
- Hält pro aktiver
MailConnection(DB) eine persistente IMAP-IDLE-Session - Reagiert in Echtzeit auf
EXISTS-Events (neue Mail im Postfach) - Feuert bei jedem Event
POST /api/mail/scan-internalgegen das lokale Backend - Das Backend entscheidet ob und welche Mails gelöscht werden (Gambling-Keywords + Blocklist)
- Aktualisiert alle 5 min die Connection-Liste (neue User → neue Sessions, entfernte → geschlossen)
- IDLE wird alle 25 min erneuert (RFC 3501 Server-Timeout liegt bei 29 min)
Env-Vars
| Variable | Pflicht | Beschreibung |
|---|---|---|
DATABASE_URL |
ja | Postgres-Connection-String (Supabase Pooler oder direkt) |
ADMIN_SECRET |
ja | Shared Secret für /api/mail/scan-internal Header |
ENCRYPTION_KEY |
ja | AES-256 Key (identisch zum Backend-Key, 32+ Zeichen) |
BACKEND_URL |
nein | Default: http://127.0.0.1:3016 (staging) / 3015 (prod) |
NODE_ENV |
nein | production → BACKEND_URL default port 3015 |
Lokal starten (Entwicklung)
cd backend/imap-idle
npm install
DATABASE_URL=<...> ADMIN_SECRET=<...> ENCRYPTION_KEY=<...> node index.mjs
Via Infisical (analog zu start-staging.sh):
infisical run --env=staging -- node index.mjs
PM2 (Produktion)
Wird via ecosystem.config.js gestartet — siehe docs/internal/MAIL_DAEMON_DEPLOYMENT.md.
Logs (pm2)
[idle/<email>] connected (imap.gmail.com:993)
[idle/<email>] exists-event received (new mail)
[idle/<email>] scan-triggered → scanned=12 blocked=1
[idle/<email>] idle renewing (25min threshold)
[idle/<email>] reconnecting in 5s (attempt 2)
[idle/db] refreshed — 47 active connections, 47 sessions