mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-04-16 09:37:53 +00:00
feat(ui): add notification system (#8394)
Co-authored-by: Pablo Lara <larabjj@gmail.com>
This commit is contained in:
31
ui/actions/feeds/feeds.ts
Normal file
31
ui/actions/feeds/feeds.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
"use server";
|
||||
|
||||
import Parser from "rss-parser";
|
||||
|
||||
const RSS_FEED_URL = process.env.RSS_FEED_URL || "";
|
||||
|
||||
export const fetchFeeds = async (): Promise<any | any[]> => {
|
||||
if (RSS_FEED_URL?.trim()?.length > 0) {
|
||||
const parser = new Parser();
|
||||
try {
|
||||
// TODO: Need to update return logic when actual URL is updated for RSS FEED
|
||||
const feed = await parser.parseURL(RSS_FEED_URL);
|
||||
return [
|
||||
{
|
||||
title: feed.title,
|
||||
description: feed.description,
|
||||
link: feed.link,
|
||||
lastBuildDate: new Date(feed.lastBuildDate).toLocaleString(),
|
||||
},
|
||||
];
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error("Error fetching RSS feed:", error);
|
||||
return [];
|
||||
}
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn("RSS url not set");
|
||||
return [];
|
||||
}
|
||||
};
|
||||
1
ui/actions/feeds/index.ts
Normal file
1
ui/actions/feeds/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./feeds";
|
||||
Reference in New Issue
Block a user