mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
093efe7fc9
Both email providers now work in parallel on the same Worker:
- ForwardEmail: existing POST /api/inbound webhook (unchanged)
- Cloudflare Email Routing: native `email` handler using postal-mime
New files:
- src/lib/email-processor.ts shared business logic (feed lookup,
sender allowlist, KV storage) extracted from inbound.ts
- src/lib/cloudflare-email.ts Cloudflare `email` handler; parses
raw RFC 2822 email with postal-mime, delegates to processEmail()
- src/lib/email-processor.test.ts 9 unit tests
- src/lib/cloudflare-email.test.ts 5 integration tests
Also fixes pre-existing CORS 204 response: c.text("", 204) →
c.body(null, 204) to match Hono's EmptyStatusCode constraint.
To enable: configure Cloudflare Email Routing with a catch-all rule
`*@domain.com` pointing to this Worker.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
37 lines
1015 B
JSON
37 lines
1015 B
JSON
{
|
|
"name": "email-to-rss",
|
|
"version": "0.1.0",
|
|
"description": "A service that converts email newsletters to RSS feeds using Cloudflare Workers",
|
|
"main": "dist/worker.js",
|
|
"scripts": {
|
|
"build": "wrangler deploy --dry-run --outdir=dist",
|
|
"format": "prettier --write '**/*.{js,ts,css,json,md}'",
|
|
"dev": "wrangler dev",
|
|
"deploy": "wrangler deploy --env production",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"test:coverage": "vitest run --coverage",
|
|
"typecheck": "tsc --noEmit"
|
|
},
|
|
"author": "",
|
|
"license": "MIT",
|
|
"devDependencies": {
|
|
"@cloudflare/workers-types": "^4.20260206.0",
|
|
"@types/mailparser": "^3.4.6",
|
|
"@types/rss": "^0.0.32",
|
|
"@vitest/coverage-v8": "^4.0.18",
|
|
"happy-dom": "^20.5.0",
|
|
"msw": "^2.12.8",
|
|
"prettier": "^3.8.1",
|
|
"typescript": "^5.9.3",
|
|
"vitest": "^4.0.18",
|
|
"wrangler": "^4.63.0"
|
|
},
|
|
"dependencies": {
|
|
"feed": "^5.2.0",
|
|
"hono": "^4.11.7",
|
|
"postal-mime": "^2.7.4",
|
|
"zod": "^4.3.6"
|
|
}
|
|
}
|