Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

format

Isaac Wisec9885c0b731c
diff --git a/components/ModalContent/DeleteRssSubscriptionModal.tsx b/components/ModalContent/DeleteRssSubscriptionModal.tsx
index e5c45f28..3248d595 100644
--- a/components/ModalContent/DeleteRssSubscriptionModal.tsx
+++ b/components/ModalContent/DeleteRssSubscriptionModal.tsx
@@ -7,50 +7,54 @@ import { RssSubscription } from "@prisma/client";
import { useDeleteRssSubscription } from "@/hooks/store/rss";
type Props = {
- onClose: Function;
- rssSubscription: RssSubscription;
+ onClose: Function;
+ rssSubscription: RssSubscription;
};
-export default function DeleteRssSubscriptionModal({ onClose, rssSubscription }: Props) {
- const { t } = useTranslation();
- const [subscription, setSubscription] = useState<RssSubscription>(rssSubscription);
- const deleteRssSubscription = useDeleteRssSubscription();
-
- useEffect(() => {
- setSubscription(rssSubscription);
- }, []);
-
- const submit = async () => {
- const load = toast.loading(t("deleting"));
-
- await deleteRssSubscription.mutateAsync(subscription.id, {
- onSettled: (_, error) => {
- toast.dismiss(load);
-
- if (error) {
- toast.error(error.message);
- } else {
- onClose();
- toast.success(t("rss_subscription_deleted"));
- }
- },
- });
- };
-
- return (
- <Modal toggleModal={onClose}>
- <p className="text-xl font-thin text-red-500">{t("delete_link")}</p>
-
- <div className="divider mb-3 mt-1"></div>
-
- <div className="flex flex-col gap-3">
- <p>{t("rss_deletion_confirmation")}</p>
-
- <Button className="ml-auto" intent="destructive" onClick={submit}>
- <i className="bi-trash text-xl" />
- {t("delete")}
- </Button>
- </div>
- </Modal>
- );
+export default function DeleteRssSubscriptionModal({
+ onClose,
+ rssSubscription,
+}: Props) {
+ const { t } = useTranslation();
+ const [subscription, setSubscription] =
+ useState<RssSubscription>(rssSubscription);
+ const deleteRssSubscription = useDeleteRssSubscription();
+
+ useEffect(() => {
+ setSubscription(rssSubscription);
+ }, []);
+
+ const submit = async () => {
+ const load = toast.loading(t("deleting"));
+
+ await deleteRssSubscription.mutateAsync(subscription.id, {
+ onSettled: (_, error) => {
+ toast.dismiss(load);
+
+ if (error) {
+ toast.error(error.message);
+ } else {
+ onClose();
+ toast.success(t("rss_subscription_deleted"));
+ }
+ },
+ });
+ };
+
+ return (
+ <Modal toggleModal={onClose}>
+ <p className="text-xl font-thin text-red-500">{t("delete_link")}</p>
+
+ <div className="divider mb-3 mt-1"></div>
+
+ <div className="flex flex-col gap-3">
+ <p>{t("rss_deletion_confirmation")}</p>
+
+ <Button className="ml-auto" intent="destructive" onClick={submit}>
+ <i className="bi-trash text-xl" />
+ {t("delete")}
+ </Button>
+ </div>
+ </Modal>
+ );
}
diff --git a/components/SettingsSidebar.tsx b/components/SettingsSidebar.tsx
index 3305f383..5707f798 100644
--- a/components/SettingsSidebar.tsx
+++ b/components/SettingsSidebar.tsx
@@ -19,16 +19,18 @@ export default function SettingsSidebar({ className }: { className?: string }) {
return (
<div
- className={`bg-base-100 h-full w-64 overflow-y-auto border-solid border border-base-100 border-r-neutral-content p-5 z-20 flex flex-col gap-5 justify-between ${className || ""
- }`}
+ className={`bg-base-100 h-full w-64 overflow-y-auto border-solid border border-base-100 border-r-neutral-content p-5 z-20 flex flex-col gap-5 justify-between ${
+ className || ""
+ }`}
>
<div className="flex flex-col gap-1">
<Link href="/settings/account">
<div
- className={`${active === "/settings/account"
- ? "bg-primary/20"
- : "hover:bg-neutral/20"
- } duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
+ className={`${
+ active === "/settings/account"
+ ? "bg-primary/20"
+ : "hover:bg-neutral/20"
+ } duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
>
<i className="bi-person text-primary text-2xl"></i>
<p className="truncate w-full pr-7">{t("account")}</p>
@@ -37,10 +39,11 @@ export default function SettingsSidebar({ className }: { className?: string }) {
<Link href="/settings/preference">
<div
- className={`${active === "/settings/preference"
- ? "bg-primary/20"
- : "hover:bg-neutral/20"
- } duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
+ className={`${
+ active === "/settings/preference"
+ ? "bg-primary/20"
+ : "hover:bg-neutral/20"
+ } duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
>
<i className="bi-sliders text-primary text-2xl"></i>
<p className="truncate w-full pr-7">{t("preference")}</p>
@@ -49,10 +52,11 @@ export default function SettingsSidebar({ className }: { className?: string }) {
<Link href="/settings/rss-subscriptions">
<div
- className={`${active === "/settings/rss-subscriptions"
- ? "bg-primary/20"
- : "hover:bg-neutral/20"
- } duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
+ className={`${
+ active === "/settings/rss-subscriptions"
+ ? "bg-primary/20"
+ : "hover:bg-neutral/20"
+ } duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
>
<i className="bi-rss text-primary text-2xl"></i>
<p className="truncate w-full pr-7">RSS Subscriptions</p>
@@ -61,10 +65,11 @@ export default function SettingsSidebar({ className }: { className?: string }) {
<Link href="/settings/access-tokens">
<div
- className={`${active === "/settings/access-tokens"
- ? "bg-primary/20"
- : "hover:bg-neutral/20"
- } duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
+ className={`${
+ active === "/settings/access-tokens"
+ ? "bg-primary/20"
+ : "hover:bg-neutral/20"
+ } duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
>
<i className="bi-key text-primary text-2xl"></i>
<p className="truncate w-full pr-7">{t("access_tokens")}</p>
@@ -73,10 +78,11 @@ export default function SettingsSidebar({ className }: { className?: string }) {
<Link href="/settings/password">
<div
- className={`${active === "/settings/password"
- ? "bg-primary/20"
- : "hover:bg-neutral/20"
- } duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
+ className={`${
+ active === "/settings/password"
+ ? "bg-primary/20"
+ : "hover:bg-neutral/20"
+ } duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
>
<i className="bi-lock text-primary text-2xl"></i>
<p className="truncate w-full pr-7">{t("password")}</p>
@@ -86,10 +92,11 @@ export default function SettingsSidebar({ className }: { className?: string }) {
{process.env.NEXT_PUBLIC_STRIPE && !user.parentSubscriptionId && (
<Link href="/settings/billing">
<div
- className={`${active === "/settings/billing"
- ? "bg-primary/20"
- : "hover:bg-neutral/20"
- } duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
+ className={`${
+ active === "/settings/billing"
+ ? "bg-primary/20"
+ : "hover:bg-neutral/20"
+ } duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
>
<i className="bi-credit-card text-primary text-xl"></i>
<p className="truncate w-full pr-7">{t("billing")}</p>
diff --git a/hooks/store/rss.tsx b/hooks/store/rss.tsx
index 643da8cf..9260ddfe 100644
--- a/hooks/store/rss.tsx
+++ b/hooks/store/rss.tsx
@@ -3,72 +3,77 @@ import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { useSession } from "next-auth/react";
interface RssSubscriptionWithCollectionName extends RssSubscription {
- collection: {
- name: string; // Include only the name of the collection
- };
+ collection: {
+ name: string;
+ };
}
const useRssSubscriptions = () => {
- const { status } = useSession();
+ const { status } = useSession();
- return useQuery({
- queryKey: ["rss-subscriptions"],
- queryFn: async () => {
- const response = await fetch("/api/v1/user/rss");
- if (!response.ok) throw new Error("Failed to fetch rss subscriptions.");
+ return useQuery({
+ queryKey: ["rss-subscriptions"],
+ queryFn: async () => {
+ const response = await fetch("/api/v1/user/rss");
+ if (!response.ok) throw new Error("Failed to fetch rss subscriptions.");
- const data = await response.json();
- return data.response as RssSubscriptionWithCollectionName[];
- },
- enabled: status === "authenticated",
- });
-}
+ const data = await response.json();
+ return data.response as RssSubscriptionWithCollectionName[];
+ },
+ enabled: status === "authenticated",
+ });
+};
const useAddRssSubscription = () => {
- const queryClient = useQueryClient();
+ const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async (body: Partial<RssSubscription>) => {
- const response = await fetch("/api/v1/user/rss", {
- body: JSON.stringify(body),
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- });
+ return useMutation({
+ mutationFn: async (body: Partial<RssSubscription>) => {
+ const response = await fetch("/api/v1/user/rss", {
+ body: JSON.stringify(body),
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ });
- const data = await response.json();
- if (!response.ok) throw new Error(data.response);
+ const data = await response.json();
+ if (!response.ok) throw new Error(data.response);
- return data.response;
- },
- onSuccess: (data) => {
- queryClient.setQueryData(["rss-subscriptions"], (oldData: RssSubscription[]) => [
- ...oldData,
- data.rssSubscription,
- ]);
- },
- })
-}
+ return data.response;
+ },
+ onSuccess: (data) => {
+ queryClient.setQueryData(
+ ["rss-subscriptions"],
+ (oldData: RssSubscription[]) => [...oldData, data.rssSubscription]
+ );
+ },
+ });
+};
const useDeleteRssSubscription = () => {
- const queryClient = useQueryClient();
+ const queryClient = useQueryClient();
- return useMutation({
- mutationFn: async (rssSubscriptionId: number) => {
- const response = await fetch(`/api/v1/user/rss/${rssSubscriptionId}`, {
- method: "DELETE",
- });
+ return useMutation({
+ mutationFn: async (rssSubscriptionId: number) => {
+ const response = await fetch(`/api/v1/user/rss/${rssSubscriptionId}`, {
+ method: "DELETE",
+ });
- const data = await response.json();
- if (!response.ok) throw new Error(data.response);
- },
- onSuccess: (_, rssSubscriptionId) => {
- queryClient.setQueryData(["rss-subscriptions"], (oldData: RssSubscription[]) => {
- return oldData.filter((rssSubscription) => rssSubscription.id !== rssSubscriptionId);
- });
- },
- });
-}
+ const data = await response.json();
+ if (!response.ok) throw new Error(data.response);
+ },
+ onSuccess: (_, rssSubscriptionId) => {
+ queryClient.setQueryData(
+ ["rss-subscriptions"],
+ (oldData: RssSubscription[]) => {
+ return oldData.filter(
+ (rssSubscription) => rssSubscription.id !== rssSubscriptionId
+ );
+ }
+ );
+ },
+ });
+};
-export { useRssSubscriptions, useAddRssSubscription, useDeleteRssSubscription };
\ No newline at end of file
+export { useRssSubscriptions, useAddRssSubscription, useDeleteRssSubscription };
diff --git a/lib/api/db.ts b/lib/api/db.ts
index 8a8709d9..8173707c 100644
--- a/lib/api/db.ts
+++ b/lib/api/db.ts
@@ -5,7 +5,10 @@ const globalForPrisma = global as unknown as { prisma: PrismaClient };
export const prisma =
globalForPrisma.prisma ||
new PrismaClient({
- log: process.env.DEBUG === "true" ? ["query", "info", "warn", "error"] : ["warn", "error"]
+ log:
+ process.env.DEBUG === "true"
+ ? ["query", "info", "warn", "error"]
+ : ["warn", "error"],
});
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
diff --git a/package.json b/package.json
index d24c596c..0440ae0d 100644
--- a/package.json
+++ b/package.json
@@ -103,4 +103,4 @@
"ts-node": "^10.9.2",
"typescript": "4.9.4"
}
-}
\ No newline at end of file
+}
diff --git a/pages/api/v1/user/rss/[id].ts b/pages/api/v1/user/rss/[id].ts
index f29854a7..14de272c 100644
--- a/pages/api/v1/user/rss/[id].ts
+++ b/pages/api/v1/user/rss/[id].ts
@@ -3,23 +3,27 @@ import verifyUser from "@/lib/api/verifyUser";
import { NextApiRequest, NextApiResponse } from "next";
export default async function handler(
- req: NextApiRequest,
- res: NextApiResponse
+ req: NextApiRequest,
+ res: NextApiResponse
) {
- const user = await verifyUser({ req, res });
- if (!user) return;
+ const user = await verifyUser({ req, res });
+ if (!user) return;
- const rssId = Number(req.query.id);
+ const rssId = Number(req.query.id);
- if (req.method === "DELETE") {
- const rssSubscription = await prisma.rssSubscription.findUnique({ where: { id: rssId } });
+ if (req.method === "DELETE") {
+ const rssSubscription = await prisma.rssSubscription.findUnique({
+ where: { id: rssId },
+ });
- if (!rssSubscription) return res.status(404).json({ response: "RSS subscription not found." });
+ if (!rssSubscription)
+ return res.status(404).json({ response: "RSS subscription not found." });
- if (rssSubscription.ownerId !== user.id) return res.status(403).json({ response: "Permission denied." });
+ if (rssSubscription.ownerId !== user.id)
+ return res.status(403).json({ response: "Permission denied." });
- await prisma.rssSubscription.delete({ where: { id: rssId } });
+ await prisma.rssSubscription.delete({ where: { id: rssId } });
- return res.status(200).json({ response: "RSS subscription deleted." });
- }
-}
\ No newline at end of file
+ return res.status(200).json({ response: "RSS subscription deleted." });
+ }
+}
diff --git a/pages/api/v1/user/rss/index.ts b/pages/api/v1/user/rss/index.ts
index 98e94679..4c54cb17 100644
--- a/pages/api/v1/user/rss/index.ts
+++ b/pages/api/v1/user/rss/index.ts
@@ -4,55 +4,62 @@ import verifyUser from "@/lib/api/verifyUser";
import { UsersAndCollections } from "@prisma/client";
import { NextApiRequest, NextApiResponse } from "next";
-
export default async function handler(
- req: NextApiRequest,
- res: NextApiResponse
+ req: NextApiRequest,
+ res: NextApiResponse
) {
- const user = await verifyUser({ req, res });
- if (!user) return;
-
- if (req.method === "GET") {
- const response = await prisma.rssSubscription.findMany({
- include: {
- collection: {
- select: {
- name: true,
- }
- },
- },
- });
-
- return res.status(200).json({ response });
- }
-
- if (req.method === "POST") {
- const { name, url, collectionId } = req.body;
-
- const collectionIsAccessible = await getPermission({ userId: user.id, collectionId: Number(collectionId) });
-
- const memberHasAccess = collectionIsAccessible?.members.some(
- (e: UsersAndCollections) => e.userId === user.id
- );
-
- if (collectionIsAccessible?.ownerId !== user.id && !memberHasAccess) {
- return res.status(403).json({ response: "You do not have permission to add a link to this collection" });
- }
-
- const response = await prisma.rssSubscription.create({
- data: {
- name,
- url,
- ownerId: user.id,
- lastBuildDate: new Date(),
- collection: {
- connect: {
- id: collectionId,
- },
- }
- },
- });
-
- return res.status(200).json({ response });
- }
-}
\ No newline at end of file
+ const user = await verifyUser({ req, res });
+ if (!user) return;
+
+ if (req.method === "GET") {
+ const response = await prisma.rssSubscription.findMany({
+ include: {
+ collection: {
+ select: {
+ name: true,
+ },
+ },
+ },
+ });
+
+ return res.status(200).json({ response });
+ }
+
+ if (req.method === "POST") {
+ const { name, url, collectionId } = req.body;
+
+ const collectionIsAccessible = await getPermission({
+ userId: user.id,
+ collectionId: Number(collectionId),
+ });
+
+ const memberHasAccess = collectionIsAccessible?.members.some(
+ (e: UsersAndCollections) => e.userId === user.id
+ );
+
+ if (collectionIsAccessible?.ownerId !== user.id && !memberHasAccess) {
+ return res
+ .status(403)
+ .json({
+ response:
+ "You do not have permission to add a link to this collection",
+ });
+ }
+
+ const response = await prisma.rssSubscription.create({
+ data: {
+ name,
+ url,
+ ownerId: user.id,
+ lastBuildDate: new Date(),
+ collection: {
+ connect: {
+ id: collectionId,
+ },
+ },
+ },
+ });
+
+ return res.status(200).json({ response });
+ }
+}
diff --git a/pages/settings/rss-subscriptions.tsx b/pages/settings/rss-subscriptions.tsx
index d77b7274..a5489feb 100644
--- a/pages/settings/rss-subscriptions.tsx
+++ b/pages/settings/rss-subscriptions.tsx
@@ -8,81 +8,84 @@ import { RssSubscription } from "@prisma/client";
import Link from "next/link";
export default function RssSubscriptions() {
- const { t } = useTranslation();
- const { data: rssSubscriptions = [] } = useRssSubscriptions();
+ const { t } = useTranslation();
+ const { data: rssSubscriptions = [] } = useRssSubscriptions();
- const [deleteSubscriptionModal, setDeleteSubscriptionModal] = useState(false);
- const [selectedSubscription, setSelectedSubscription] = useState<RssSubscription | null>(null);
+ const [deleteSubscriptionModal, setDeleteSubscriptionModal] = useState(false);
+ const [selectedSubscription, setSelectedSubscription] =
+ useState<RssSubscription | null>(null);
- const openDeleteModal = (subscription: RssSubscription) => {
- setSelectedSubscription(subscription);
- setDeleteSubscriptionModal(true);
- };
+ const openDeleteModal = (subscription: RssSubscription) => {
+ setSelectedSubscription(subscription);
+ setDeleteSubscriptionModal(true);
+ };
- return (
- <SettingsLayout>
- <p className="capitalize text-3xl font-thin inline">
- {t("rss_subscriptions")}
- </p>
+ return (
+ <SettingsLayout>
+ <p className="capitalize text-3xl font-thin inline">
+ {t("rss_subscriptions")}
+ </p>
- <div className="divider my-3"></div>
- <div className="flex flex-col gap-3">
- <p>{t("rss_subscriptions_desc")}</p>
+ <div className="divider my-3"></div>
+ <div className="flex flex-col gap-3">
+ <p>{t("rss_subscriptions_desc")}</p>
- <button
- className={`btn ml-auto btn-accent dark:border-violet-400 text-white tracking-wider w-fit flex items-center gap-2`}
- // onClick={() => {
- // setNewTokenModal(true);
- // }}
- >
- {t("new_rss_subscription")}
- </button>
- {rssSubscriptions.length > 0 && (
- <table className="table mt-2 overflow-x-auto">
- <thead>
- <tr>
- <th>{t("name")}</th>
- <th>{t("link")}</th>
- <th>{t("collection")}</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {rssSubscriptions.map((rssSubscription, i) => {
- return (
- <tr key={i}>
- <td>{rssSubscription.name}</td>
- <td>{rssSubscription.url}</td>
- <td>
- <Link className="hover:underline" href={`/collections/${rssSubscription.collectionId}`}>{rssSubscription.collection.name}</Link>
- </td>
- <td>
- <button
- className="btn btn-sm btn-ghost btn-square hover:bg-red-500"
- onClick={() => openDeleteModal(rssSubscription)}
-
- >
- <i className="bi-x text-lg"></i>
- </button>
- </td>
- </tr>
- );
- })}
- </tbody>
- </table>
- )}
- </div>
- {deleteSubscriptionModal && selectedSubscription && (
- <DeleteRssSubscriptionModal
- onClose={() => {
- setDeleteSubscriptionModal(false);
- setSelectedSubscription(null);
- }}
- rssSubscription={selectedSubscription}
- />
- )}
- </SettingsLayout>
- );
+ <button
+ className={`btn ml-auto btn-accent dark:border-violet-400 text-white tracking-wider w-fit flex items-center gap-2`}
+ // onClick={() => {
+ // setNewTokenModal(true);
+ // }}
+ >
+ {t("new_rss_subscription")}
+ </button>
+ {rssSubscriptions.length > 0 && (
+ <table className="table mt-2 overflow-x-auto">
+ <thead>
+ <tr>
+ <th>{t("name")}</th>
+ <th>{t("link")}</th>
+ <th>{t("collection")}</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {rssSubscriptions.map((rssSubscription, i) => (
+ <tr key={i}>
+ <td>{rssSubscription.name}</td>
+ <td>{rssSubscription.url}</td>
+ <td>
+ <Link
+ className="hover:underline"
+ href={`/collections/${rssSubscription.collectionId}`}
+ >
+ {rssSubscription.collection.name}
+ </Link>
+ </td>
+ <td>
+ <button
+ className="btn btn-sm btn-ghost btn-square hover:bg-red-500"
+ onClick={() => openDeleteModal(rssSubscription)}
+ >
+ <i className="bi-x text-lg"></i>
+ </button>
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ )}
+ </div>
+ {deleteSubscriptionModal && selectedSubscription && (
+ <DeleteRssSubscriptionModal
+ rssSubscription={selectedSubscription}
+ onClose={() => {
+ setDeleteSubscriptionModal(false);
+ setSelectedSubscription(null);
+ }}
+ />
+ )}
+ </SettingsLayout>
+ );
}
export { getServerSideProps };
diff --git a/scripts/worker.ts b/scripts/worker.ts
index eb461b45..b1914e6b 100644
--- a/scripts/worker.ts
+++ b/scripts/worker.ts
@@ -144,10 +144,15 @@ async function fetchAndProcessRSS() {
try {
const feed = await parser.parseURL(rssSubscription.url);
- if (rssSubscription.lastBuildDate && new Date(rssSubscription.lastBuildDate) < new Date(feed.lastBuildDate)) {
- console.log(`Processing new RSS feed items for ${rssSubscription.name}`);
-
- const newItems = feed.items.filter(item => {
+ if (
+ rssSubscription.lastBuildDate &&
+ new Date(rssSubscription.lastBuildDate) < new Date(feed.lastBuildDate)
+ ) {
+ console.log(
+ `Processing new RSS feed items for ${rssSubscription.name}`
+ );
+
+ const newItems = feed.items.filter((item) => {
const itemPubDate = item.pubDate ? new Date(item.pubDate) : null;
return itemPubDate && itemPubDate > rssSubscription.lastBuildDate!; // We know lastBuildDate is not null here
});
@@ -160,22 +165,22 @@ async function fetchAndProcessRSS() {
type: "link",
createdBy: {
connect: {
- id: rssSubscription.ownerId
- }
+ id: rssSubscription.ownerId,
+ },
},
collection: {
connect: {
- id: rssSubscription.collectionId
- }
- }
- }
+ id: rssSubscription.collectionId,
+ },
+ },
+ },
});
});
// Update the lastBuildDate in the database
await prisma.rssSubscription.update({
where: { id: rssSubscription.id },
- data: { lastBuildDate: new Date(feed.lastBuildDate) }
+ data: { lastBuildDate: new Date(feed.lastBuildDate) },
});
}
} catch (error) {
@@ -192,7 +197,8 @@ function delay(sec: number) {
return new Promise((resolve) => setTimeout(resolve, sec * 1000));
}
-const POLLING_INTERVAL_MINUTES = Number(process.env.RSS_POLLING_INTERVAL_MINUTES) || 60; // Default to one hour if not set
+const POLLING_INTERVAL_MINUTES =
+ Number(process.env.RSS_POLLING_INTERVAL_MINUTES) || 60; // Default to one hour if not set
const pollingIntervalInSeconds = POLLING_INTERVAL_MINUTES * 60;
async function startRSSPolling() {
@@ -203,7 +209,8 @@ async function startRSSPolling() {
}
}
-const archiveIntervalInSeconds = Number(process.env.ARCHIVE_SCRIPT_INTERVAL) || 10;
+const archiveIntervalInSeconds =
+ Number(process.env.ARCHIVE_SCRIPT_INTERVAL) || 10;
async function startArchiveProcessing() {
while (true) {
@@ -219,4 +226,4 @@ async function init() {
startArchiveProcessing();
}
-init();
\ No newline at end of file
+init();