feat(meme-generator): add meme generation API route with template and custom image modes

Custom route handler supporting template mode (JSON body with templateId)
and custom image mode (multipart upload). Registers process function for
pipeline compatibility. Includes 18 integration tests.
This commit is contained in:
SnapOtter
2026-05-08 16:13:34 +08:00
parent b0cb17ff55
commit 6ec3a51fa4
6 changed files with 596 additions and 4 deletions
+9 -1
View File
@@ -61,7 +61,15 @@ export function loadFont(family: string): opentype.Font {
}
const buf = readFileSync(join(FONT_DIR, filename));
const font = opentype.parse(buf.buffer as ArrayBuffer);
let font: opentype.Font;
try {
font = opentype.parse(buf.buffer as ArrayBuffer);
} catch {
if (filename !== FONT_MAP.anton) {
return loadFont("anton");
}
throw new Error(`Failed to parse font: ${filename}`);
}
fontCache.set(filename, font);
return font;
}