mise ~/.config/mise/config.toml tools: crush@0.91.0

feat(api): add React Email rendering and PNG heatmap endpoint
This commit is contained in:
Prad Nukala committed 2026-08-25 10:33:04 -04:00
1 parent 6b9a259ec7
commit 881530a808
8 files changed
+1058 -168

No files matched your search

+10 -1
View File
@@ -10,7 +10,7 @@
* admin routes); everything else is read-only public.
*/
import { reconcileCatalog } from "./catalog.ts";
import { gateBadge, heatmapChart, ladderChart, progressChart } from "./charts.ts";
import { gateBadge, heatmapChart, heatmapPng, ladderChart, progressChart } from "./charts.ts";
import { sendDigest } from "./digest.ts";
import { createReviewIssue, scoreReview } from "./gate.ts";
import { type GitHub, github } from "./github.ts";
@@ -233,6 +233,12 @@ const SVG_HEADERS = {
"cache-control": "public, max-age=300",
};
// The digest embeds the raster heatmap; email clients refuse SVG entirely.
const PNG_HEADERS = {
"content-type": "image/png",
"cache-control": "public, max-age=300",
};
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
const url = new URL(request.url);
@@ -256,6 +262,9 @@ export default {
if (path === "/chart/heatmap.svg") {
return new Response(await heatmapChart(env.DB, CAMPAIGN_START, 56), { headers: SVG_HEADERS });
}
if (path === "/chart/heatmap.png") {
return new Response(await heatmapPng(env.DB, CAMPAIGN_START, 56), { headers: PNG_HEADERS });
}
if (path === "/badge/gate.svg") {
return new Response(await gateBadge(env.DB), { headers: SVG_HEADERS });
}