add better feed handling

This commit is contained in:
ld3zian 2025-02-04 19:10:22 -07:00
parent b8499d90c6
commit 0daac66b26
4 changed files with 252 additions and 183 deletions

View file

@ -1,6 +1,6 @@
import { Feed } from 'feed';
import { getChaptersForSlugs, isValidLanguage } from "../../lib/api";
import { getFeedMapping } from "../../lib/db";
import { getFeedMapping, warmChapterCache } from "../../lib/db";
import type { APIRoute } from "astro";
export const GET: APIRoute = async ({ params, request }) => {
@ -22,6 +22,8 @@ export const GET: APIRoute = async ({ params, request }) => {
return new Response("Invalid language", { status: 400 });
}
await warmChapterCache(slugs, lang);
const chapters = await getChaptersForSlugs(slugs, lang);
if (chapters.length === 0) {