2024-07-30 21:34:39 +02:00
|
|
|
"use client";
|
|
|
|
|
2024-07-07 20:11:32 +02:00
|
|
|
import ReactMarkdown from "react-markdown";
|
|
|
|
import { vulnerabilities } from "@/constants/guidelines";
|
2024-07-30 21:34:39 +02:00
|
|
|
import { useEffect, useState } from "react";
|
|
|
|
import { Skeleton } from "@/components/ui/skeleton";
|
2024-07-07 20:11:32 +02:00
|
|
|
|
2024-07-30 21:34:39 +02:00
|
|
|
interface Bullet {
|
|
|
|
point: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Vulnerabilities {
|
|
|
|
_id: string;
|
|
|
|
date: string;
|
|
|
|
version: string;
|
|
|
|
bullets?: Bullet[]; // Make bullets optional
|
|
|
|
}
|
2024-07-07 20:11:32 +02:00
|
|
|
|
|
|
|
const Vulnerabilities = () => {
|
2024-07-30 21:34:39 +02:00
|
|
|
const [loading, setLoading] = useState(true);
|
|
|
|
const [downloads, setDownloads] = useState<Vulnerabilities[]>([]);
|
|
|
|
const [error, setError] = useState("");
|
|
|
|
|
|
|
|
const fetchData = async () => {
|
|
|
|
try {
|
|
|
|
const response = await fetch("/api/vulnerabilities", {
|
|
|
|
method: "GET",
|
|
|
|
});
|
|
|
|
if (response.ok) {
|
|
|
|
const data: Vulnerabilities[] = await response.json();
|
|
|
|
setDownloads(data);
|
|
|
|
return (document.title = "Vulnerabilities | SVRJS");
|
|
|
|
} else {
|
|
|
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
|
|
}
|
|
|
|
} catch (error: any) {
|
|
|
|
setError(error.message || "Failed to fetch downloads");
|
|
|
|
} finally {
|
|
|
|
setLoading(false);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
fetchData();
|
|
|
|
|
|
|
|
const interval = setInterval(() => {
|
|
|
|
fetchData();
|
|
|
|
}, 10000);
|
|
|
|
|
|
|
|
return () => clearInterval(interval);
|
|
|
|
}, []);
|
|
|
|
const reversedDownloads = [...downloads].reverse();
|
|
|
|
|
|
|
|
// initially loading = true
|
|
|
|
if (loading) {
|
|
|
|
return (
|
|
|
|
<section className="wrapper container py-24 md:py-28 gap-4 flex flex-col">
|
|
|
|
<div className="mb-3">
|
|
|
|
<Skeleton className="w-[400px] h-[50px] rounded-md" />
|
|
|
|
</div>
|
|
|
|
<div className="flex flex-col gap-4">
|
|
|
|
<Skeleton className="w-[300px] h-[30px] rounded-md" />
|
|
|
|
<Skeleton className="w-[200px] h-[20px] rounded-md" />
|
|
|
|
<Skeleton className="w-[200px] h-[20px] rounded-md" />
|
|
|
|
<Skeleton className="w-[200px] h-[20px] rounded-md" />
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-07-07 20:11:32 +02:00
|
|
|
return (
|
|
|
|
<section
|
2024-07-30 21:34:39 +02:00
|
|
|
id="vulnerabilities"
|
2024-07-29 22:57:35 +02:00
|
|
|
className="wrapper container py-24 md:py-28 gap-2 flex flex-col"
|
2024-07-07 20:11:32 +02:00
|
|
|
>
|
2024-07-29 22:57:35 +02:00
|
|
|
<h1 className="text-3xl md:text-5xl pb-1 md:pb-2 font-bold text-black dark:bg-clip-text dark:text-transparent dark:bg-gradient-to-b dark:from-white dark:to-neutral-400">
|
2024-07-08 07:52:48 +02:00
|
|
|
SVR.JS Vulnerabilities
|
|
|
|
</h1>
|
2024-07-29 23:03:55 +02:00
|
|
|
<p className="md:text-lg text-muted-foreground text-start mb-6">
|
2024-07-10 08:10:55 +02:00
|
|
|
Some older versions of SVR.JS are vulnerable to cyberattacks. It's
|
|
|
|
recommended to update your SVR.JS version to the newest one. If you find
|
|
|
|
a security issue with SVR.JS, report it as soon as possible to
|
|
|
|
vulnerability-reports[at]svrjs[dot]org. We'll mitigate that
|
|
|
|
vulnerability if it is possible.
|
2024-07-08 07:52:48 +02:00
|
|
|
</p>
|
2024-07-30 21:34:39 +02:00
|
|
|
{error && <p className="text-red-500">{error}</p>}
|
|
|
|
|
|
|
|
{reversedDownloads.map((download) => (
|
|
|
|
<div
|
|
|
|
key={download._id}
|
|
|
|
className="flex-start flex-col prose dark:prose-invert mb-4 gap-4"
|
|
|
|
>
|
|
|
|
<h2 className="font-semibold text-3xl -mb-2">{download.version}</h2>
|
|
|
|
<ul className="list-disc pl-5">
|
|
|
|
{(download.bullets ?? []).map((bullet, index) => (
|
|
|
|
<li key={index}>{bullet.point}</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
))}
|
2024-07-29 22:29:19 +02:00
|
|
|
<div className="prose max-w-full md:prose-lg dark:prose-invert">
|
2024-07-07 20:11:32 +02:00
|
|
|
<ReactMarkdown>{vulnerabilities}</ReactMarkdown>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Vulnerabilities;
|