网站和推流制作完成
This commit is contained in:
18
EyeVue/api/rss.ts
Normal file
18
EyeVue/api/rss.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
// Vercel Serverless Function
|
||||
export default async function handler(res) {
|
||||
try {
|
||||
const rssUrl = process.env.RSS_URL;
|
||||
if (!rssUrl) {
|
||||
throw new Error("RSS_URL environment variable is not defined");
|
||||
}
|
||||
|
||||
const response = await fetch(rssUrl);
|
||||
const data = await response.text();
|
||||
|
||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||
res.setHeader("Content-Type", "application/xml");
|
||||
res.status(200).send(data);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: "Failed to fetch RSS" });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user