import { NextResponse } from "next/server"; import { readFileSync, existsSync } from "fs"; import { join } from "path"; const PODCAST_DIR = "/Users/mattbruce/.openclaw/workspace/podcast"; const RSS_FILE = join(PODCAST_DIR, "rss.xml"); export async function GET() { try { // Check if RSS file exists if (!existsSync(RSS_FILE)) { // Return a default RSS feed if none exists yet const defaultFeed = ` OpenClaw Daily Digest https://mission-control-rho-pink.vercel.app/podcast en-us © 2026 OpenClaw OpenClaw Daily tech news and insights for developers no Welcome to OpenClaw Daily Digest Podcast Your daily tech news podcast is coming soon. Check back for the first episode! ${new Date().toUTCString()} welcome `; return new NextResponse(defaultFeed, { headers: { "Content-Type": "application/rss+xml", "Cache-Control": "public, max-age=3600", }, }); } // Read and serve the RSS file const rssContent = readFileSync(RSS_FILE, "utf-8"); return new NextResponse(rssContent, { headers: { "Content-Type": "application/rss+xml", "Cache-Control": "public, max-age=3600", }, }); } catch (error) { console.error("Error serving RSS feed:", error); return NextResponse.json( { error: "Failed to load RSS feed" }, { status: 500 } ); } }