Files
direct-img.link/wrangler.jsonc
T
multipleof4andClaude Opus 5.5 32f742b73f Feat: Move from Pages to a Worker and serve popular images as static files
Static assets don't count toward the free plan's 100,000 requests a day, so a
daily GitHub Action promotes the most viewed images (by Cloudflare analytics)
from R2 into public/ before deploying, and reports to ntfy. Zone rules fold
the site and ?i= into the path, since static files ignore query strings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:08:34 +00:00

21 lines
1.1 KiB
JSON

{
"name": "direct-img",
"main": "src/worker.js",
"compatibility_date": "2026-02-13",
// Files in public/ are served without running the worker (free, unlimited and not counted toward the 100,000 requests
// a day), including the images scripts/promote.js adds before each deploy. robots.txt differs on free.*, so the
// worker answers it.
"assets": { "directory": "public", "binding": "ASSETS", "run_worker_first": ["/robots.txt"] },
"r2_buckets": [{ "binding": "R2_IMAGES", "bucket_name": "direct-img-store" }],
"kv_namespaces": [{ "binding": "DIRECT_IMG_CACHE", "id": "3d7301ab34db464cb568f31cbea7ce8c" }],
"vars": { "GOATCOUNTER_URL": "https://direct-img.goatcounter.com" },
// Routes rather than custom domains, so the old Pages project stays behind them as the origin to roll back to
"routes": [
{ "pattern": "direct-img.link/*", "zone_name": "direct-img.link" },
{ "pattern": "free.direct-img.link/*", "zone_name": "direct-img.link" },
{ "pattern": "ai.direct-img.link/*", "zone_name": "direct-img.link" }
],
"workers_dev": false,
"preview_urls": false
}