import { getPhotosCached } from '@/photo/cache'; import { BASE_URL, META_DESCRIPTION, META_TITLE, SITE_FEEDS_ENABLED, } from '@/app/config'; import { createRssItems, FEED_PHOTO_REQUEST_LIMIT } from '@/app/feed'; import { ABSOLUTE_PATH_FOR_RSS_XML } from '@/app/paths'; // Cache for 24 hours export const revalidate = 86_400; export async function GET() { if (SITE_FEEDS_ENABLED) { const photos = await getPhotosCached({ limit: FEED_PHOTO_REQUEST_LIMIT, sortBy: 'createdAt', }); const items = createRssItems(photos); return new Response(` ${META_TITLE} ${BASE_URL} ${META_DESCRIPTION} ${items.join('\n')} `, { headers: { 'Content-Type': 'text/xml' } }, ); } else { return new Response('Feed disabled', { status: 404 }); } }