From ba7a0ee58b67556021bf356ee9a4dde14ee02e24 Mon Sep 17 00:00:00 2001 From: Cypro Freelance <110410268+Proxyy587@users.noreply.github.com> Date: Wed, 10 Jul 2024 11:40:55 +0530 Subject: [PATCH] pages description updated --- app/(auth)/admin/changelogs/page.tsx | 231 ++++++++++++++------------- app/(auth)/admin/downloads/page.tsx | 226 +++++++++++++------------- app/(auth)/admin/mods/page.tsx | 222 ++++++++++++------------- app/(auth)/admin/page.tsx | 26 +-- app/(auth)/layout.tsx | 18 +-- app/(root)/privacy-policy/page.tsx | 6 +- app/(root)/vulnerabilities/page.tsx | 7 +- lib/validations/validation.ts | 5 +- 8 files changed, 371 insertions(+), 370 deletions(-) diff --git a/app/(auth)/admin/changelogs/page.tsx b/app/(auth)/admin/changelogs/page.tsx index 0865006..b2edefa 100644 --- a/app/(auth)/admin/changelogs/page.tsx +++ b/app/(auth)/admin/changelogs/page.tsx @@ -1,129 +1,132 @@ "use client"; import React from "react"; -import { useForm, SubmitHandler } from "react-hook-form"; +import { useForm, SubmitHandler, useFieldArray } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; -import { z } from "zod"; import { Button } from "@/components/ui/button"; import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage, + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; -import { UploadButton, UploadDropzone } from "@/lib/uploadthing"; import { logsSchema } from "@/lib/validations/validation"; +import { z } from "zod"; -const AdminPage = () => { - const form = useForm>({ - resolver: zodResolver(logsSchema), - defaultValues: { - fileName: "", - version: "", - downloadLink: "", - fileSize: "", - }, - }); +type LogsFormValues = z.infer; - const onSubmit: SubmitHandler> = async (data) => { - const response = await fetch("/api/uploadlogs", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(data), - }); +const AdminLogPage = () => { + const form = useForm({ + resolver: zodResolver(logsSchema), + defaultValues: { + version: "", + date: "", + bullets: [""], + }, + }); - if (response.ok) { - form.reset(); - console.log("Upload successful"); - alert("Uploaded"); - } else { - console.error("Upload failed"); - alert("Upload Failed"); - } - }; + const { fields, append, remove } = useFieldArray({ + control: form.control, + name: "bullets" as const, // Ensure this is typed correctly + }); - return ( -
-

Server Logs Form

-
- - ( - - File Name - - - - - - )} - /> - ( - - Version - - - - - - )} - /> - ( - - Download Link - { - field.onChange(res[0].url); - }} - onUploadError={(error: Error) => { - alert(`ERROR! ${error.message}`); - }} - /> - - - - - - )} - /> - ( - - File Size - - - - - - )} - /> - - - -
- ); + const onSubmit: SubmitHandler = async (data) => { + const response = await fetch("/api/uploadlogs", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(data), + }); + + if (response.ok) { + form.reset(); + console.log("Upload successful"); + alert("Uploaded"); + } else { + console.error("Upload failed"); + alert("Upload Failed"); + } + }; + + return ( +
+

Server Logs Form

+
+ + ( + + Version Name + + + + + + )} + /> + ( + + Date + + + + + + )} + /> + {fields.map((field, index) => ( + ( + + Key Point {index + 1} + + + + + + + )} + /> + ))} + + + + +
+ ); }; -export default AdminPage; +export default AdminLogPage; diff --git a/app/(auth)/admin/downloads/page.tsx b/app/(auth)/admin/downloads/page.tsx index 9401e6f..0c82ecf 100644 --- a/app/(auth)/admin/downloads/page.tsx +++ b/app/(auth)/admin/downloads/page.tsx @@ -6,126 +6,126 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; import { Button } from "@/components/ui/button"; import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage, + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; import { UploadButton, UploadDropzone } from "@/lib/uploadthing"; import { downloadSchema } from "@/lib/validations/validation"; -const AdminPage = () => { - const form = useForm>({ - resolver: zodResolver(downloadSchema), - defaultValues: { - fileName: "", - version: "", - downloadLink: "", - fileSize: "", - }, - }); +const DownloadsPage = () => { + const form = useForm>({ + resolver: zodResolver(downloadSchema), + defaultValues: { + fileName: "", + version: "", + downloadLink: "", + fileSize: "", + }, + }); - const onSubmit: SubmitHandler> = async ( - data - ) => { - const response = await fetch("/api/upload", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(data), - }); + const onSubmit: SubmitHandler> = async ( + data + ) => { + const response = await fetch("/api/upload", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(data), + }); - if (response.ok) { - form.reset(); - console.log("Upload successful"); - alert("Uploaded"); - } else { - console.error("Upload failed"); - alert("Upload Failed"); - } - }; + if (response.ok) { + form.reset(); + console.log("Upload successful"); + alert("Uploaded"); + } else { + console.error("Upload failed"); + alert("Upload Failed"); + } + }; - return ( -
-

Mods Form

-
- - ( - - File Name - - - - - - )} - /> - ( - - Version - - - - - - )} - /> - ( - - Download Link - { - field.onChange(res[0].url); - }} - onUploadError={(error: Error) => { - alert(`ERROR! ${error.message}`); - }} - /> - - - - - - )} - /> - ( - - File Size - - - - - - )} - /> - - - -
- ); + return ( +
+

Mods Form

+
+ + ( + + File Name + + + + + + )} + /> + ( + + Version + + + + + + )} + /> + ( + + Download Link + { + field.onChange(res[0].url); + }} + onUploadError={(error: Error) => { + alert(`ERROR! ${error.message}`); + }} + /> + + + + + + )} + /> + ( + + File Size + + + + + + )} + /> + + + +
+ ); }; -export default AdminPage; +export default DownloadsPage; diff --git a/app/(auth)/admin/mods/page.tsx b/app/(auth)/admin/mods/page.tsx index e42e787..c48f53f 100644 --- a/app/(auth)/admin/mods/page.tsx +++ b/app/(auth)/admin/mods/page.tsx @@ -6,124 +6,124 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; import { Button } from "@/components/ui/button"; import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage, + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; import { UploadButton, UploadDropzone } from "@/lib/uploadthing"; import { modsSchema } from "@/lib/validations/validation"; -const AdminPage = () => { - const form = useForm>({ - resolver: zodResolver(modsSchema), - defaultValues: { - fileName: "", - version: "", - downloadLink: "", - fileSize: "", - }, - }); +const SvrjsModsAdminPage = () => { + const form = useForm>({ + resolver: zodResolver(modsSchema), + defaultValues: { + fileName: "", + version: "", + downloadLink: "", + fileSize: "", + }, + }); - const onSubmit: SubmitHandler> = async (data) => { - const response = await fetch("/api/uploadmods", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(data), - }); + const onSubmit: SubmitHandler> = async (data) => { + const response = await fetch("/api/uploadmods", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(data), + }); - if (response.ok) { - form.reset(); - console.log("Upload successful"); - alert("Uploaded"); - } else { - console.error("Upload failed"); - alert("Upload Failed"); - } - }; + if (response.ok) { + form.reset(); + console.log("Upload successful"); + alert("Uploaded"); + } else { + console.error("Upload failed"); + alert("Upload Failed"); + } + }; - return ( -
-

Download Form

-
- - ( - - File Name - - - - - - )} - /> - ( - - Version - - - - - - )} - /> - ( - - Download Link - { - field.onChange(res[0].url); - }} - onUploadError={(error: Error) => { - alert(`ERROR! ${error.message}`); - }} - /> - - - - - - )} - /> - ( - - File Size - - - - - - )} - /> - - - -
- ); + return ( +
+

Download Form

+
+ + ( + + File Name + + + + + + )} + /> + ( + + Version + + + + + + )} + /> + ( + + Download Link + { + field.onChange(res[0].url); + }} + onUploadError={(error: Error) => { + alert(`ERROR! ${error.message}`); + }} + /> + + + + + + )} + /> + ( + + File Size + + + + + + )} + /> + + + +
+ ); }; -export default AdminPage; +export default SvrjsModsAdminPage; diff --git a/app/(auth)/admin/page.tsx b/app/(auth)/admin/page.tsx index 0ede98b..8f2d3fa 100644 --- a/app/(auth)/admin/page.tsx +++ b/app/(auth)/admin/page.tsx @@ -2,20 +2,20 @@ import React from "react"; import Card from "../_components/Card"; const AdminPage = () => { - return ( - <> -
-

Admin Page

+ return ( + <> +
+

Admin Page

-
- - - - -
-
- - ); +
+ + + + +
+
+ + ); }; export default AdminPage; diff --git a/app/(auth)/layout.tsx b/app/(auth)/layout.tsx index b6569b8..01443b4 100644 --- a/app/(auth)/layout.tsx +++ b/app/(auth)/layout.tsx @@ -2,15 +2,15 @@ import MobileNav from "./_components/Mobilenav"; import Sidebar from "./_components/Sidebar"; export default function PageLayout({ - children, + children, }: { - children: React.ReactNode; + children: React.ReactNode; }) { - return ( -
- - -
{children}
-
- ); + return ( +
+ + +
{children}
+
+ ); } diff --git a/app/(root)/privacy-policy/page.tsx b/app/(root)/privacy-policy/page.tsx index ed02b9f..02021e6 100644 --- a/app/(root)/privacy-policy/page.tsx +++ b/app/(root)/privacy-policy/page.tsx @@ -18,11 +18,7 @@ const PrivacyPolicy = () => { Privacy Policy

- 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. + Effective date: 26.05.2024

{PRIVACY_POLICY} diff --git a/app/(root)/vulnerabilities/page.tsx b/app/(root)/vulnerabilities/page.tsx index 1c4c042..e85d6c2 100644 --- a/app/(root)/vulnerabilities/page.tsx +++ b/app/(root)/vulnerabilities/page.tsx @@ -16,8 +16,11 @@ const Vulnerabilities = () => { SVR.JS Vulnerabilities

- We welcome contributions from the community! Here's how you can - help! + 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.

{vulnerabilities} diff --git a/lib/validations/validation.ts b/lib/validations/validation.ts index 6a437bb..3091f0c 100644 --- a/lib/validations/validation.ts +++ b/lib/validations/validation.ts @@ -15,10 +15,9 @@ export const modsSchema = z.object({ }); export const logsSchema = z.object({ - fileName: z.string().nonempty(), version: z.string().nonempty(), - downloadLink: z.string().url().nonempty(), - fileSize: z.string().nonempty(), + date: z.string().nonempty(), + bullets: z.array(z.string().nonempty()), }); // Contact Page