managarten/services
Till JS a312d98f09 feat(broadcast): click-link tracking + send throttle
Closes the last two dogfood blockers before real-campaign use.

link-rewriter.ts
- rewriteClickLinks(): walks <a href="http…"> in the HTML body and
  replaces each URL with /api/v1/track/click/{token}?url={original}
  so clicks go through the tracking endpoint. Regex-based because
  Tiptap output is well-formed; returns a count for debugging.
- Leaves mailto: / tel: / anchor fragments alone — wrapping those
  breaks the recipient's native handler and accomplishes nothing.
- `skipUrls` param carries the unsubscribe + web-view URLs (already
  tracking endpoints themselves) so they don't get double-wrapped.
- 11 unit tests covering http/https rewriting, skip list, non-http
  schemes, attribute preservation, multi-link count, quoted-attr
  variants, idempotency.

Orchestrator wiring
- substituteUrls now calls rewriteClickLinks after the preview-
  placeholder swap and before the open-pixel injection. The
  unsubscribe + web-view URLs from this same function are passed
  in as skip entries so they survive the pass untouched.
- Constructor gains `sendThrottleMs` param (default 150ms).
- Main send loop awaits sleep(throttleMs) between iterations. 150ms
  = ~6/sec = ~360/min, safely below most SMTP provider limits.
  100-recipient campaign = ~15s extra wall-clock but that's fine
  for MVP (and most campaigns are way smaller).

Config
- New env BROADCAST_SEND_THROTTLE_MS (default 150). Wired from
  loadConfig to the orchestrator constructor.

The broadcast module is now functionally complete for dogfooding.
Remaining before a real campaign can actually go out: run
`cd services/mana-mail && bun run db:push` to materialise the
broadcast.* schema tables.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 15:07:58 +02:00
..
mana-ai feat(mana-ai): Prometheus metrics for tool-calls, loop rounds, provider errors 2026-04-20 20:48:29 +02:00
mana-analytics refactor(shared-tailwind): rewrite themes.css to single-layer shadcn convention 2026-04-09 01:13:06 +02:00
mana-api-gateway chore: complete ManaCore → Mana rename (docs, go modules, plists, images) 2026-04-07 12:26:10 +02:00
mana-auth feat(spaces): end-to-end shared-space sync (membership lookup + plaintext) 2026-04-20 20:46:53 +02:00
mana-crawler fix(mana-crawler): default DATABASE_URL to mana_platform in dev 2026-04-15 18:18:19 +02:00
mana-credits feat(credits): add 2-phase debit (reserve/commit/refund) 2026-04-17 14:41:41 +02:00
mana-events fix(events): Eventbrite provider — switch from dead API to web scraping 2026-04-18 16:51:58 +02:00
mana-geocoding test(geocoding): add unit tests + end-to-end smoke test script 2026-04-11 20:21:18 +02:00
mana-image-gen feat(mana-image-gen): replace Mac flux2.c implementation with Windows GPU diffusers 2026-04-08 13:02:42 +02:00
mana-landing-builder chore: complete ManaCore → Mana rename (docs, go modules, plists, images) 2026-04-07 12:26:10 +02:00
mana-llm chore(mana-llm): thread GOOGLE_API_KEY + default model into local compose 2026-04-20 20:42:21 +02:00
mana-mail feat(broadcast): click-link tracking + send throttle 2026-04-21 15:07:58 +02:00
mana-media fix(type-check): unblock two more pre-existing failures 2026-04-20 15:20:08 +02:00
mana-notify fix(mana-auth) + chore: rewrite /api/v1/auth/login JWT mint, remove Matrix stack 2026-04-08 16:32:13 +02:00
mana-research docs(mana-research): step-by-step API_KEYS.md setup guide 2026-04-18 18:50:06 +02:00
mana-search fix: dev startup — Redis eviction policy, mana-media port crash, Svelte warnings 2026-04-10 18:33:41 +02:00
mana-stt chore(mac-mini): remove all AI service infrastructure (moved to Windows GPU) 2026-04-08 13:06:40 +02:00
mana-subscriptions chore(db): enforce pgSchema isolation with a lint script 2026-04-20 14:45:59 +02:00
mana-sync feat(spaces): end-to-end shared-space sync (membership lookup + plaintext) 2026-04-20 20:46:53 +02:00
mana-tts feat(profile): voice interview with pre-rendered TTS audio + Orpheus/Zonos backends 2026-04-17 15:22:52 +02:00
mana-user refactor(shared-tailwind): rewrite themes.css to single-layer shadcn convention 2026-04-09 01:13:06 +02:00
mana-video-gen chore(matrix): final scrub of stale matrix references 2026-04-08 16:47:54 +02:00
mana-voice-bot fix(mana-voice-bot): move default port 3050 → 3024 + Windows GPU deployment notes 2026-04-08 13:14:57 +02:00
news-ingester refactor(shared-rss): extract RSS parsing + Readability into one package 2026-04-15 22:30:44 +02:00