import { INFINITE_SCROLL_FEED_INITIAL } from '@/photo'; import { getPhotosCached } from '@/photo/cache'; import { BASE_URL, META_DESCRIPTION, META_TITLE, SITE_FEEDS_ENABLED, } from '@/app/config'; import { feedPhotoToXml, formatPhotoForFeedRss } from '@/app/feed'; import { ABSOLUTE_PATH_FOR_FEED_JSON } from '@/app/paths'; export const dynamic = 'force-static'; export async function GET() { if (SITE_FEEDS_ENABLED) { const photos = await getPhotosCached({ limit: INFINITE_SCROLL_FEED_INITIAL, sortBy: 'createdAt', }); const items = photos.map(formatPhotoForFeedRss).map(feedPhotoToXml); return new Response( ` ${META_TITLE} ${BASE_URL} ${META_DESCRIPTION} ${items.join('\n')} `, { headers: { 'Content-Type': 'text/xml', }, }, ); } else { return new Response('RSS feed access disabled', { status: 404 }); } }