Digest polish: honest on-site wording, one-tap opt-in after sign-in, List-Unsubscribe

* On-site end-cap now says "You're caught up for now." — honest, since Highlights
  refreshes through the day (the email keeps the daily "see you tomorrow").
* Anonymous "Get tomorrow's brief by email" now honors the one-tap promise:
  sets a pending flag, opens sign-in, and auto-enables once auth resolves.
* Email compliance (RFC 2369/8058): send_email takes optional headers; the digest
  sets List-Unsubscribe + List-Unsubscribe-Post=One-Click, and a POST
  /api/digest/unsubscribe handles native one-click (GET still serves the page).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jay
2026-06-09 16:35:05 -04:00
parent cf5cbb33c0
commit 1956d7fd23
6 changed files with 42 additions and 12 deletions
+4 -1
View File
@@ -30,7 +30,8 @@ def _cfg() -> dict:
}
def send_email(to: str, subject: str, text: str, html: str | None = None, reply_to: str | None = None) -> None:
def send_email(to: str, subject: str, text: str, html: str | None = None, reply_to: str | None = None,
headers: dict | None = None) -> None:
"""Send one message. Raises on failure (caller decides how loud to be)."""
cfg = _cfg()
if not cfg["host"]:
@@ -40,6 +41,8 @@ def send_email(to: str, subject: str, text: str, html: str | None = None, reply_
msg["To"] = to
if reply_to:
msg["Reply-To"] = reply_to
for key, value in (headers or {}).items():
msg[key] = value
msg["Subject"] = subject
msg.set_content(text)
if html: