Merge both Cloudflare modes into one Worker and one deploy button
Two entrypoints, two configs and two buttons was more surface than the difference justified: the only thing that actually varied was where a new address comes from. src/worker.ts now picks that at runtime from whether DISPOSABLE_DOMAIN is set, so one Worker covers both. Set it and mail arrives via Email Routing on your own domain; clear it and addresses are provisioned on mail.tm and polled on the frequent cron instead. Nothing else differs, so nothing else forks. email() stays unconditional: handleInboundEmail only looks up whoever the mail was addressed to, so it's already mode-agnostic, and in mail.tm mode nothing routes mail to the Worker for it to handle anyway. wrangler.jsonc gains the poll cron alongside the daily cleanup. In domain mode it returns on an env check before touching D1, so it costs nothing on an existing domain-based deployment. Cleanup branches too, since mail.tm's needs to delete the remote mailbox before dropping the row and already runs deleteExpiredAndRevoked and deleteStaleRateLimits itself. Deletes src/receivers/mailtm/worker.ts, deploy/mailtm-workers/, and wrangler-mailtm.jsonc.example along with the cf:mailtm:* scripts. Verified: dry-run bundling in both modes, and a mode-switching test covering address routing (unset, empty, and whitespace-only domain all mean mail.tm) plus cron routing in both modes.
11 files changed+101−226
Rendering diff…