41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { generateRegistryRssFeed } from "@wandry/analytics-sdk";
|
|
import type { NextRequest } from "next/server";
|
|
|
|
export const revalidate = 3600;
|
|
|
|
export async function GET(request: NextRequest) {
|
|
const baseUrl = new URL(request.url).origin;
|
|
|
|
const rssXml = await generateRegistryRssFeed({
|
|
baseUrl,
|
|
componentsUrl: "/docs/components",
|
|
excludeItemTypes: ["registry:block", "registry:style", "registry:lib"],
|
|
rss: {
|
|
title: "@retroui",
|
|
description: "Subscribe to @retroui updates",
|
|
link: "https://retroui.dev",
|
|
pubDateStrategy: "githubLastEdit",
|
|
},
|
|
github: {
|
|
owner: "Logging-Studio",
|
|
repo: "RetroUI",
|
|
token: process.env.GITHUB_TOKEN,
|
|
},
|
|
});
|
|
|
|
if (!rssXml) {
|
|
return new Response("RSS feed not available", {
|
|
status: 404,
|
|
headers: { "Content-Type": "text/plain" },
|
|
});
|
|
}
|
|
|
|
return new Response(rssXml, {
|
|
headers: {
|
|
"Content-Type": "application/rss+xml; charset=utf-8",
|
|
"Cache-Control":
|
|
"public, max-age=3600, s-maxage=3600, stale-while-revalidate=86400",
|
|
},
|
|
});
|
|
}
|