mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-03-17 15:33:00 +01:00
Compare commits
1 Commits
fix/coder-
...
add-copyca
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d00908ff3 |
@@ -5,6 +5,7 @@ import { Inter } from "next/font/google";
|
|||||||
import Script from "next/script";
|
import Script from "next/script";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
|
import { CopycatWarningToast } from "@/components/copycat-warning-toast";
|
||||||
import { ThemeProvider } from "@/components/theme-provider";
|
import { ThemeProvider } from "@/components/theme-provider";
|
||||||
import { analytics, basePath } from "@/config/site-config";
|
import { analytics, basePath } from "@/config/site-config";
|
||||||
import QueryProvider from "@/components/query-provider";
|
import QueryProvider from "@/components/query-provider";
|
||||||
@@ -116,6 +117,7 @@ export default function RootLayout({
|
|||||||
<div className="w-full max-w-[1440px] ">
|
<div className="w-full max-w-[1440px] ">
|
||||||
{children}
|
{children}
|
||||||
<Toaster richColors />
|
<Toaster richColors />
|
||||||
|
<CopycatWarningToast />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Footer />
|
<Footer />
|
||||||
|
|||||||
24
frontend/src/components/copycat-warning-toast.tsx
Normal file
24
frontend/src/components/copycat-warning-toast.tsx
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import { toast } from "sonner";
|
||||||
|
|
||||||
|
const STORAGE_KEY = "copycat-warning-dismissed";
|
||||||
|
|
||||||
|
export function CopycatWarningToast() {
|
||||||
|
useEffect(() => {
|
||||||
|
if (typeof window === "undefined")
|
||||||
|
return;
|
||||||
|
if (localStorage.getItem(STORAGE_KEY) === "true")
|
||||||
|
return;
|
||||||
|
|
||||||
|
toast.warning("Beware of copycat sites. Always verify the URL is correct before trusting or running scripts.", {
|
||||||
|
position: "top-center",
|
||||||
|
duration: Number.POSITIVE_INFINITY,
|
||||||
|
closeButton: true,
|
||||||
|
onDismiss: () => localStorage.setItem(STORAGE_KEY, "true"),
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user