pages description updated

This commit is contained in:
Cypro Freelance 2024-07-10 11:40:55 +05:30
parent 9f964c3aa2
commit ba7a0ee58b
8 changed files with 371 additions and 370 deletions

View file

@ -1,129 +1,132 @@
"use client"; "use client";
import React from "react"; 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 { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { import {
Form, Form,
FormControl, FormControl,
FormField, FormField,
FormItem, FormItem,
FormLabel, FormLabel,
FormMessage, FormMessage,
} from "@/components/ui/form"; } from "@/components/ui/form";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { UploadButton, UploadDropzone } from "@/lib/uploadthing";
import { logsSchema } from "@/lib/validations/validation"; import { logsSchema } from "@/lib/validations/validation";
import { z } from "zod";
const AdminPage = () => { type LogsFormValues = z.infer<typeof logsSchema>;
const form = useForm<z.infer<typeof logsSchema>>({
resolver: zodResolver(logsSchema),
defaultValues: {
fileName: "",
version: "",
downloadLink: "",
fileSize: "",
},
});
const onSubmit: SubmitHandler<z.infer<typeof logsSchema>> = async (data) => { const AdminLogPage = () => {
const response = await fetch("/api/uploadlogs", { const form = useForm<LogsFormValues>({
method: "POST", resolver: zodResolver(logsSchema),
headers: { defaultValues: {
"Content-Type": "application/json", version: "",
}, date: "",
body: JSON.stringify(data), bullets: [""],
}); },
});
if (response.ok) { const { fields, append, remove } = useFieldArray({
form.reset(); control: form.control,
console.log("Upload successful"); name: "bullets" as const, // Ensure this is typed correctly
alert("Uploaded"); });
} else {
console.error("Upload failed");
alert("Upload Failed");
}
};
return ( const onSubmit: SubmitHandler<LogsFormValues> = async (data) => {
<section id="logs-page" className="wrapper container"> const response = await fetch("/api/uploadlogs", {
<h1 className="text-3xl font-bold py-6">Server Logs Form</h1> method: "POST",
<Form {...form}> headers: {
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4"> "Content-Type": "application/json",
<FormField },
control={form.control} body: JSON.stringify(data),
name="fileName" });
render={({ field }) => (
<FormItem> if (response.ok) {
<FormLabel>File Name</FormLabel> form.reset();
<FormControl> console.log("Upload successful");
<Input {...field} /> alert("Uploaded");
</FormControl> } else {
<FormMessage /> console.error("Upload failed");
</FormItem> alert("Upload Failed");
)} }
/> };
<FormField
control={form.control} return (
name="version" <section id="logs-page" className="wrapper container">
render={({ field }) => ( <h1 className="text-3xl font-bold py-6">Server Logs Form</h1>
<FormItem> <Form {...form}>
<FormLabel>Version</FormLabel> <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
<FormControl> <FormField
<Input {...field} /> control={form.control}
</FormControl> name="version"
<FormMessage /> render={({ field }) => (
</FormItem> <FormItem>
)} <FormLabel>Version Name</FormLabel>
/> <FormControl>
<FormField <Input {...field} />
control={form.control} </FormControl>
name="downloadLink" <FormMessage />
render={({ field }) => ( </FormItem>
<FormItem> )}
<FormLabel>Download Link</FormLabel> />
<UploadButton <FormField
endpoint="imageUploader" control={form.control}
onClientUploadComplete={(res) => { name="date"
field.onChange(res[0].url); render={({ field }) => (
}} <FormItem>
onUploadError={(error: Error) => { <FormLabel>Date</FormLabel>
alert(`ERROR! ${error.message}`); <FormControl>
}} <Input {...field} placeholder="Released on 24 Nov 2024" />
/> </FormControl>
<FormControl> <FormMessage />
<Input {...field} /> </FormItem>
</FormControl> )}
<FormMessage /> />
</FormItem> {fields.map((field, index) => (
)} <FormField
/> key={field.id}
<FormField control={form.control}
control={form.control} name={`bullets.${index}`}
name="fileSize" render={({ field }) => (
render={({ field }) => ( <FormItem>
<FormItem> <FormLabel>Key Point {index + 1}</FormLabel>
<FormLabel>File Size</FormLabel> <FormControl>
<FormControl> <Input {...field} />
<Input {...field} /> </FormControl>
</FormControl> <FormMessage />
<FormMessage /> <Button
</FormItem> type="button"
)} onClick={() => remove(index)}
/> className="mt-2"
<Button variant={"destructive"}
type="submit" >
className="w-full text-lg rounded-full" Remove
size={"lg"} </Button>
> </FormItem>
Submit )}
</Button> />
</form> ))}
</Form> <Button
</section> type="button"
); onClick={() => append("")}
className="mb-4"
size={"lg"}
variant={"outline"}
>
Add
</Button>
<Button
type="submit"
className="w-full text-lg rounded-full"
size={"lg"}
>
Submit
</Button>
</form>
</Form>
</section>
);
}; };
export default AdminPage; export default AdminLogPage;

View file

@ -6,126 +6,126 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod"; import { z } from "zod";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { import {
Form, Form,
FormControl, FormControl,
FormField, FormField,
FormItem, FormItem,
FormLabel, FormLabel,
FormMessage, FormMessage,
} from "@/components/ui/form"; } from "@/components/ui/form";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { UploadButton, UploadDropzone } from "@/lib/uploadthing"; import { UploadButton, UploadDropzone } from "@/lib/uploadthing";
import { downloadSchema } from "@/lib/validations/validation"; import { downloadSchema } from "@/lib/validations/validation";
const AdminPage = () => { const DownloadsPage = () => {
const form = useForm<z.infer<typeof downloadSchema>>({ const form = useForm<z.infer<typeof downloadSchema>>({
resolver: zodResolver(downloadSchema), resolver: zodResolver(downloadSchema),
defaultValues: { defaultValues: {
fileName: "", fileName: "",
version: "", version: "",
downloadLink: "", downloadLink: "",
fileSize: "", fileSize: "",
}, },
}); });
const onSubmit: SubmitHandler<z.infer<typeof downloadSchema>> = async ( const onSubmit: SubmitHandler<z.infer<typeof downloadSchema>> = async (
data data
) => { ) => {
const response = await fetch("/api/upload", { const response = await fetch("/api/upload", {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
body: JSON.stringify(data), body: JSON.stringify(data),
}); });
if (response.ok) { if (response.ok) {
form.reset(); form.reset();
console.log("Upload successful"); console.log("Upload successful");
alert("Uploaded"); alert("Uploaded");
} else { } else {
console.error("Upload failed"); console.error("Upload failed");
alert("Upload Failed"); alert("Upload Failed");
} }
}; };
return ( return (
<section id="downloads-page" className="wrapper container"> <section id="downloads-page" className="wrapper container">
<h1 className="text-3xl font-bold py-6">Mods Form</h1> <h1 className="text-3xl font-bold py-6">Mods Form</h1>
<Form {...form}> <Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4"> <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
<FormField <FormField
control={form.control} control={form.control}
name="fileName" name="fileName"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>File Name</FormLabel> <FormLabel>File Name</FormLabel>
<FormControl> <FormControl>
<Input {...field} /> <Input {...field} />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
)} )}
/> />
<FormField <FormField
control={form.control} control={form.control}
name="version" name="version"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Version</FormLabel> <FormLabel>Version</FormLabel>
<FormControl> <FormControl>
<Input {...field} /> <Input {...field} />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
)} )}
/> />
<FormField <FormField
control={form.control} control={form.control}
name="downloadLink" name="downloadLink"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Download Link</FormLabel> <FormLabel>Download Link</FormLabel>
<UploadButton <UploadButton
endpoint="imageUploader" endpoint="imageUploader"
onClientUploadComplete={(res) => { onClientUploadComplete={(res) => {
field.onChange(res[0].url); field.onChange(res[0].url);
}} }}
onUploadError={(error: Error) => { onUploadError={(error: Error) => {
alert(`ERROR! ${error.message}`); alert(`ERROR! ${error.message}`);
}} }}
/> />
<FormControl> <FormControl>
<Input {...field} /> <Input {...field} />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
)} )}
/> />
<FormField <FormField
control={form.control} control={form.control}
name="fileSize" name="fileSize"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>File Size</FormLabel> <FormLabel>File Size</FormLabel>
<FormControl> <FormControl>
<Input {...field} /> <Input {...field} />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
)} )}
/> />
<Button <Button
type="submit" type="submit"
className="w-full text-lg rounded-full" className="w-full text-lg rounded-full"
size={"lg"} size={"lg"}
> >
Submit Submit
</Button> </Button>
</form> </form>
</Form> </Form>
</section> </section>
); );
}; };
export default AdminPage; export default DownloadsPage;

View file

@ -6,124 +6,124 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod"; import { z } from "zod";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { import {
Form, Form,
FormControl, FormControl,
FormField, FormField,
FormItem, FormItem,
FormLabel, FormLabel,
FormMessage, FormMessage,
} from "@/components/ui/form"; } from "@/components/ui/form";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { UploadButton, UploadDropzone } from "@/lib/uploadthing"; import { UploadButton, UploadDropzone } from "@/lib/uploadthing";
import { modsSchema } from "@/lib/validations/validation"; import { modsSchema } from "@/lib/validations/validation";
const AdminPage = () => { const SvrjsModsAdminPage = () => {
const form = useForm<z.infer<typeof modsSchema>>({ const form = useForm<z.infer<typeof modsSchema>>({
resolver: zodResolver(modsSchema), resolver: zodResolver(modsSchema),
defaultValues: { defaultValues: {
fileName: "", fileName: "",
version: "", version: "",
downloadLink: "", downloadLink: "",
fileSize: "", fileSize: "",
}, },
}); });
const onSubmit: SubmitHandler<z.infer<typeof modsSchema>> = async (data) => { const onSubmit: SubmitHandler<z.infer<typeof modsSchema>> = async (data) => {
const response = await fetch("/api/uploadmods", { const response = await fetch("/api/uploadmods", {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
body: JSON.stringify(data), body: JSON.stringify(data),
}); });
if (response.ok) { if (response.ok) {
form.reset(); form.reset();
console.log("Upload successful"); console.log("Upload successful");
alert("Uploaded"); alert("Uploaded");
} else { } else {
console.error("Upload failed"); console.error("Upload failed");
alert("Upload Failed"); alert("Upload Failed");
} }
}; };
return ( return (
<section id="mods-page" className="wrapper container"> <section id="mods-page" className="wrapper container">
<h1 className="text-3xl font-bold py-6">Download Form</h1> <h1 className="text-3xl font-bold py-6">Download Form</h1>
<Form {...form}> <Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4"> <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
<FormField <FormField
control={form.control} control={form.control}
name="fileName" name="fileName"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>File Name</FormLabel> <FormLabel>File Name</FormLabel>
<FormControl> <FormControl>
<Input {...field} /> <Input {...field} />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
)} )}
/> />
<FormField <FormField
control={form.control} control={form.control}
name="version" name="version"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Version</FormLabel> <FormLabel>Version</FormLabel>
<FormControl> <FormControl>
<Input {...field} /> <Input {...field} />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
)} )}
/> />
<FormField <FormField
control={form.control} control={form.control}
name="downloadLink" name="downloadLink"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Download Link</FormLabel> <FormLabel>Download Link</FormLabel>
<UploadButton <UploadButton
endpoint="imageUploader" endpoint="imageUploader"
onClientUploadComplete={(res) => { onClientUploadComplete={(res) => {
field.onChange(res[0].url); field.onChange(res[0].url);
}} }}
onUploadError={(error: Error) => { onUploadError={(error: Error) => {
alert(`ERROR! ${error.message}`); alert(`ERROR! ${error.message}`);
}} }}
/> />
<FormControl> <FormControl>
<Input {...field} /> <Input {...field} />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
)} )}
/> />
<FormField <FormField
control={form.control} control={form.control}
name="fileSize" name="fileSize"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>File Size</FormLabel> <FormLabel>File Size</FormLabel>
<FormControl> <FormControl>
<Input {...field} /> <Input {...field} />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
)} )}
/> />
<Button <Button
type="submit" type="submit"
className="w-full text-lg rounded-full" className="w-full text-lg rounded-full"
size={"lg"} size={"lg"}
> >
Submit Submit
</Button> </Button>
</form> </form>
</Form> </Form>
</section> </section>
); );
}; };
export default AdminPage; export default SvrjsModsAdminPage;

View file

@ -2,20 +2,20 @@ import React from "react";
import Card from "../_components/Card"; import Card from "../_components/Card";
const AdminPage = () => { const AdminPage = () => {
return ( return (
<> <>
<section id="adminpage" className="wrapper container"> <section id="adminpage" className="wrapper container">
<h1 className="h2-bold py-6">Admin Page</h1> <h1 className="h2-bold py-6">Admin Page</h1>
<div className="grid lg:grid-cols-2 grid-cols-1 gap-4 "> <div className="grid lg:grid-cols-2 grid-cols-1 gap-4 ">
<Card title="Downloads" url="/admin/downloads" /> <Card title="Downloads" url="/admin/downloads" />
<Card title="Mods" url="/admin" /> <Card title="Mods" url="/admin/mods" />
<Card title="Logs" url="/admin" /> <Card title="Logs" url="/admin/changelogs" />
<Card title="Docs" url="/admin" /> <Card title="Docs" url="/admin" />
</div> </div>
</section> </section>
</> </>
); );
}; };
export default AdminPage; export default AdminPage;

View file

@ -2,15 +2,15 @@ import MobileNav from "./_components/Mobilenav";
import Sidebar from "./_components/Sidebar"; import Sidebar from "./_components/Sidebar";
export default function PageLayout({ export default function PageLayout({
children, children,
}: { }: {
children: React.ReactNode; children: React.ReactNode;
}) { }) {
return ( return (
<main className="flex flex-col min-h-screen root"> <main className="flex flex-col min-h-screen root">
<Sidebar /> <Sidebar />
<MobileNav /> <MobileNav />
<div className="flex-grow flex-1 root-container">{children}</div> <div className="root-container lg:px-24">{children}</div>
</main> </main>
); );
} }

View file

@ -18,11 +18,7 @@ const PrivacyPolicy = () => {
Privacy Policy Privacy Policy
</h1> </h1>
<p className="text-lg text-muted-foreground text-start mb-4"> <p className="text-lg text-muted-foreground text-start mb-4">
Some older versions of SVR.JS are vulnerable to cyberattacks. It&apos;s Effective date: 26.05.2024
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&apos;ll mitigate that
vulnerability if it is possible.
</p> </p>
<div className="prose max-w-full prose-lg dark:prose-invert"> <div className="prose max-w-full prose-lg dark:prose-invert">
<ReactMarkdown>{PRIVACY_POLICY}</ReactMarkdown> <ReactMarkdown>{PRIVACY_POLICY}</ReactMarkdown>

View file

@ -16,8 +16,11 @@ const Vulnerabilities = () => {
SVR.JS Vulnerabilities SVR.JS Vulnerabilities
</h1> </h1>
<p className="text-lg text-muted-foreground text-start mb-4"> <p className="text-lg text-muted-foreground text-start mb-4">
We welcome contributions from the community! Here&apos;s how you can Some older versions of SVR.JS are vulnerable to cyberattacks. It&apos;s
help! 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&apos;ll mitigate that
vulnerability if it is possible.
</p> </p>
<div className="prose max-w-full prose-lg dark:prose-invert"> <div className="prose max-w-full prose-lg dark:prose-invert">
<ReactMarkdown>{vulnerabilities}</ReactMarkdown> <ReactMarkdown>{vulnerabilities}</ReactMarkdown>

View file

@ -15,10 +15,9 @@ export const modsSchema = z.object({
}); });
export const logsSchema = z.object({ export const logsSchema = z.object({
fileName: z.string().nonempty(),
version: z.string().nonempty(), version: z.string().nonempty(),
downloadLink: z.string().url().nonempty(), date: z.string().nonempty(),
fileSize: z.string().nonempty(), bullets: z.array(z.string().nonempty()),
}); });
// Contact Page // Contact Page