Website : rimsha.abasa.com
backdoor
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
talha_silentcontent
/
src
/
app
/
(application)
/
sites
/
Filename :
page.tsx
back
Copy
// @ts-nocheck "use client" import { useMutation, useQuery } from "@tanstack/react-query"; import axios from "axios"; import { useEffect, useState } from "react"; import { RiDeleteBin6Line } from "react-icons/ri"; import Link from "next/link"; import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table" import { toast } from "@/components/ui/use-toast"; import { Button } from "@/components/ui/button"; import { GrNotes } from "react-icons/gr"; import dynamic from "next/dynamic"; import { OnboardButton } from "@/components/OnboardButton"; import LoadingSpinner from "@/components/LoadingSpinner"; const Joyride = dynamic(() => import('react-joyride'), { ssr: false }); export default function Sites() { const [isTourRunning, setIsTourRunning] = useState(false); const startTour = () => { setIsTourRunning(prev => !prev); }; const [{ run, steps }, setState] = useState({ run: true, steps: [ { content: <h2>Here you will see all the websites you want to post your generated articles on. </h2>, locale: { skip: <strong>SKIP</strong> }, placement: "center", target: "body" }, ], }) const [wpSites, setWpSites] = useState<string[]>([]); const { isFetching } = useQuery(["wpSites"], async () => { const response = await axios.get("/api/wpsites"); setWpSites(response.data.data.wpSites); return response.data; }); const { mutate: deleteWpSite, isLoading} = useMutation({ mutationFn: async (data) => { const payload = { data: { wpSite: data } } const response = await axios.delete(`/api/wpsites`, payload); return response.data; }, onSuccess: (data) => { toast({ description: "Your WP Site has been deleted.", }); //@ts-ignore window.location.reload(true); }, onError: (err) => { return toast({ title: "There was an error deleting WP Site", description: "Your WP Site was not deleted. Please try again.", variant: "destructive", }); } }) if (isLoading || isFetching) { return <LoadingSpinner message="Loading Sites" />; } return ( <div className="flex flex-col gap-6"> <div className="flex gap-4 items-center"> <h1 className="sm:text-4xl text-2xl text-left font-bold">Standard Sites</h1> <OnboardButton onClick= {startTour} /> </div> <Joyride continuous={true} callback={() => {}} run={isTourRunning} steps={steps} hideCloseButton scrollToFirstStep showSkipButton showProgress /> <Table> <TableHeader> <TableRow> <TableHead>S.NO</TableHead> <TableHead className="text-center">Address</TableHead> <TableHead className="text-center">Username</TableHead> <TableHead className="text-center">App Password</TableHead> <TableHead>Actions</TableHead> </TableRow> </TableHeader> <TableBody> {wpSites.length === 0 && ( <TableRow > <TableCell></TableCell> <TableCell> <h1> No Sites Added </h1> </TableCell> <TableCell></TableCell> <TableCell></TableCell> <TableCell></TableCell> </TableRow> )} {wpSites.length !== 0 && ( wpSites.map((wpSite: any, index: number) => ( <TableRow key={index}> <TableCell>{index + 1}</TableCell> <TableCell className="text-center"> <Link href={`${wpSite.address}`} className="text-blue-600 hover:underline"> {wpSite.address} </Link> </TableCell> <TableCell className="text-center">{wpSite.wpUsername}</TableCell> <TableCell className="text-center"> {"*".repeat(Math.max(0, wpSite.wpPassword.length - 4)) + wpSite.wpPassword.slice(-4)} </TableCell> <TableCell> <button // @ts-ignore onClick={() => deleteWpSite(wpSite._id)} className="text-sm text-[#FF0808]" > <RiDeleteBin6Line size={24} /> </button> </TableCell> </TableRow> )) )} </TableBody> </Table> {/* {wpSites.length !== 0 && ( wpSites.map((wpSite: any, index: number) => ( <Link href= {`${wpSite.address}`} key={index}> <Card className="mt-4" > <CardHeader className="mb-[-10px]"> <CardTitle>{wpSite.address} <button // @ts-ignore onClick={() => deleteWpSite(wpSite._id)} className="my-auto text-sm ml-1.5 text-red-600" > <RiDeleteBin6Line /> </button></CardTitle> </CardHeader> </Card> </Link> )) )} */} </div> ) }