diff --git a/app/services/imap_client.py b/app/services/imap_client.py index 9fd463e..dcd3fc6 100644 --- a/app/services/imap_client.py +++ b/app/services/imap_client.py @@ -13,6 +13,13 @@ from email.mime.text import MIMEText logger = logging.getLogger(__name__) +# Python's imaplib limitiert einzelne IMAP-Antworten hart auf 1 MB. Bei größeren +# Postfächern (>~130k Mails) liefert `UID SEARCH ALL` eine Response mit allen +# UIDs, die dieses Limit reißt → Poll bricht mit "got more than 1000000 bytes" ab +# und nichts wird mehr sortiert. Auf 100 MB anheben — reicht für Postfächer mit +# Millionen Mails. +imaplib._MAXLINE = 100_000_000 + @dataclass class MailMessage: diff --git a/app/templates/filters.html b/app/templates/filters.html index 2c931ab..77ceef9 100644 --- a/app/templates/filters.html +++ b/app/templates/filters.html @@ -195,11 +195,24 @@ async function loadFilters() { } function filterHaystack(f) { + // Auch die deutschen Labels aufnehmen, damit Suche nach z.B. "am (exakt)", + // "ab / nach", "verschieben" funktioniert — nicht nur nach den englischen + // Schlüsseln wie "on_date" / "after" / "move". + const condLabels = (f.conditions || []).flatMap(c => { + const fieldLabel = FIELDS.find(x => x.value === c.field)?.label || ''; + const matchLabel = ALL_MATCH_TYPES.find(x => x.value === c.match_type)?.label || ''; + return [c.field, c.match_type, c.value, fieldLabel, matchLabel, c.negate ? 'NICHT NOT' : '']; + }); + const actLabels = (f.actions || []).flatMap(a => { + const actLabel = ACTION_TYPES.find(x => x.value === a.action_type)?.label || ''; + return [a.action_type, a.parameter || '', actLabel]; + }); const parts = [ f.name || '', f.source_folder || '', - ...(f.conditions || []).flatMap(c => [c.field, c.match_type, c.value]), - ...(f.actions || []).flatMap(a => [a.action_type, a.parameter || '']), + f.stop_processing ? 'stop stop_processing' : '', + ...condLabels, + ...actLabels, ]; return parts.join(' ').toLowerCase(); }