Compare commits
No commits in common. "2fc9cc9951466c83ecaea81bbd57d8f8f55d4340" and "45099f1dac4c0c881de4c191008d4b570dded1fc" have entirely different histories.
2fc9cc9951
...
45099f1dac
|
|
@ -1,10 +1,9 @@
|
|||
import type { Metadata } from "next";
|
||||
import "./globals.css";
|
||||
import { Toaster } from "@/components/ui/toaster";
|
||||
import Provider from "../utils/ReactQuery/Provider";
|
||||
import Provider from "../utils/Provider";
|
||||
import { Toaster as SonnerToaster } from "@/components/ui/sonner";
|
||||
import ProgressBarProviders from "@/components/PrograssBar";
|
||||
import { EnvScript, PublicEnvScript } from "next-runtime-env";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "عیون",
|
||||
|
|
@ -18,14 +17,11 @@ export default function RootLayout({
|
|||
}) {
|
||||
return (
|
||||
<html lang="fa" dir="rtl">
|
||||
<head>
|
||||
<PublicEnvScript />
|
||||
</head>
|
||||
<body className="font-[yekan] bg-white">
|
||||
<Provider>
|
||||
<ProgressBarProviders>{children}</ProgressBarProviders>
|
||||
<Toaster />
|
||||
<SonnerToaster richColors />
|
||||
<SonnerToaster />
|
||||
</Provider>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
"use client";
|
||||
|
||||
import React, { useState, useRef, useEffect } from "react";
|
||||
import {
|
||||
useMutation,
|
||||
useQuery,
|
||||
RefetchOptions,
|
||||
useQueryClient,
|
||||
} from "@tanstack/react-query";
|
||||
import { useMutation, useQuery, RefetchOptions } from "@tanstack/react-query";
|
||||
import { GenerateKeyPair, GetKeys, AddKey, ChangeKey } from "@/utils/adminApi";
|
||||
import { FaRegEdit } from "react-icons/fa";
|
||||
import { IoMdClose } from "react-icons/io";
|
||||
|
|
@ -42,8 +37,6 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
|||
import { useForm } from "react-hook-form";
|
||||
import * as z from "zod";
|
||||
import { Textarea } from "./ui/textarea";
|
||||
import { Check } from "lucide-react";
|
||||
import { Progress } from "./ui/progress";
|
||||
|
||||
const MAX_FILE_SIZE = 5242880; // 5 MB
|
||||
// Edit Key Form
|
||||
|
|
@ -78,19 +71,16 @@ const FormSchemaAddKey = z.object({
|
|||
}),
|
||||
});
|
||||
|
||||
|
||||
export default function AdminKeysManagement() {
|
||||
const router = useRouter();
|
||||
const queryClient = useQueryClient();
|
||||
const [keyId, setKeyId] = useState("");
|
||||
const [done, setDone] = useState<number>(0);
|
||||
const [total, setTotal] = useState<number>(0);
|
||||
const [polling, setPolling] = useState<boolean>(false);
|
||||
const [openAdd, setOpenAdd] = React.useState(false);
|
||||
const [openEdit, setOpenEdit] = React.useState(false);
|
||||
|
||||
const inputPubRef = useRef<HTMLTextAreaElement | null>(null);
|
||||
const inputPrvRef = useRef<HTMLTextAreaElement | null>(null);
|
||||
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
||||
|
||||
// ..............Read .txt
|
||||
const [selectedFile, setSelectedFile] = useState<any>(null);
|
||||
const handleFileChange = (event: any) => {
|
||||
|
|
@ -118,27 +108,11 @@ export default function AdminKeysManagement() {
|
|||
mutationKey: ["ChangeKey"],
|
||||
mutationFn: ChangeKey,
|
||||
onSuccess: (res) => {
|
||||
if (res.total == res.done) {
|
||||
localStorage.removeItem("isChangingKey");
|
||||
setPolling(false);
|
||||
queryClient.invalidateQueries({ queryKey: ["KeysList"] });
|
||||
if (res.failed == 0) {
|
||||
refetch1();
|
||||
setOpenEdit(false);
|
||||
|
||||
toast("عملیات شما با موفقیت انجام شد. ", {
|
||||
className: "!bg-green-500 !text-white",
|
||||
});
|
||||
}
|
||||
if (intervalRef.current !== null) {
|
||||
clearInterval(intervalRef.current);
|
||||
intervalRef.current = null; // Reset the ref value after clearing
|
||||
}
|
||||
} else {
|
||||
localStorage.setItem("isChangingKey", "true");
|
||||
setPolling(true);
|
||||
}
|
||||
setOpenEdit(false);
|
||||
setDone(res.done);
|
||||
setTotal(res.total);
|
||||
|
||||
// router.refresh()
|
||||
},
|
||||
|
|
@ -153,7 +127,6 @@ export default function AdminKeysManagement() {
|
|||
ChangeKeyMutation.mutate({
|
||||
privateKey: selectedFile,
|
||||
publicKeyId: keyId,
|
||||
isPolling: false,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -248,37 +221,6 @@ export default function AdminKeysManagement() {
|
|||
}
|
||||
}, [handleClickGenerate]);
|
||||
|
||||
// useEffect(() => {
|
||||
// const isChangingKey = localStorage.getItem("isChangingKey");
|
||||
// if (isChangingKey) {
|
||||
// setPolling(true);
|
||||
// ChangeKeyMutation.mutate({
|
||||
// privateKey: "",
|
||||
// publicKeyId: "cb7258da-64b0-4f43-b4f7-8ee11799d643",
|
||||
// isPolling: true,
|
||||
// });
|
||||
// }
|
||||
// }, [polling]);
|
||||
const refethKey = () => {
|
||||
ChangeKeyMutation.mutate({
|
||||
privateKey: "",
|
||||
publicKeyId: "cb7258da-64b0-4f43-b4f7-8ee11799d643",
|
||||
isPolling: true,
|
||||
});
|
||||
};
|
||||
useEffect(() => {
|
||||
const isChangingKey = localStorage.getItem("isChangingKey");
|
||||
if (isChangingKey) {
|
||||
setTimeout(() => {}, 10000);
|
||||
intervalRef.current = setInterval(refethKey, 10000);
|
||||
return () => {
|
||||
if (intervalRef.current !== null) {
|
||||
clearInterval(intervalRef.current);
|
||||
intervalRef.current = null; // Reset the ref value after clearing
|
||||
}
|
||||
};
|
||||
}
|
||||
}, [polling]);
|
||||
const saveTextFile = () => {
|
||||
const textToSave = data2?.privateKey ?? "";
|
||||
const fileName = "privateKey.txt";
|
||||
|
|
@ -307,6 +249,7 @@ export default function AdminKeysManagement() {
|
|||
}
|
||||
}, [AddKeyMutation.isSuccess]);
|
||||
|
||||
|
||||
const resetFormAdd = () => {
|
||||
formAdd.reset({
|
||||
title: "",
|
||||
|
|
@ -317,12 +260,6 @@ export default function AdminKeysManagement() {
|
|||
return (
|
||||
<div className="w-full min-h-[85vh] flex justify-center">
|
||||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
||||
{polling && (
|
||||
<div className=" w-full md:w-1/2 mx-auto mt-2">
|
||||
<p className=" font-bold test-sm">درحال تغییر کلید ...</p>
|
||||
<Progress className=" mt-5" value={(done * 100) / total} />
|
||||
</div>
|
||||
)}
|
||||
{/* 1 */}
|
||||
<AlertDialog open={openAdd} onOpenChange={setOpenAdd}>
|
||||
<AlertDialogContent className="">
|
||||
|
|
@ -331,12 +268,7 @@ export default function AdminKeysManagement() {
|
|||
<p className="text-[#464646] text-base font-bold">
|
||||
افزودن کلید جدید
|
||||
</p>
|
||||
<AlertDialogCancel
|
||||
className="h-auto p-0 border-0"
|
||||
onClick={() => {
|
||||
resetFormAdd();
|
||||
}}
|
||||
>
|
||||
<AlertDialogCancel className="h-auto p-0 border-0" onClick={() => { resetFormAdd(); }}>
|
||||
<IoMdClose />
|
||||
</AlertDialogCancel>
|
||||
</AlertDialogTitle>
|
||||
|
|
@ -438,27 +370,25 @@ export default function AdminKeysManagement() {
|
|||
</Button>
|
||||
</AlertDialogTrigger>
|
||||
</div>
|
||||
<div className="flex flex-row flex-wrap w-full gap-8 md:gap-4">
|
||||
<div className="flex flex-row flex-wrap justify-between w-full gap-8 md:gap-4 ">
|
||||
{data1?.map((item: any) => {
|
||||
return (
|
||||
<div
|
||||
key={item.id}
|
||||
className={`flex flex-col justify-center gap-2 w-full md:w-[31%] lg:w-[23%] h-28 px-5 rounded-md shadow-md items-start bg-[#F5F5F5]
|
||||
className={`flex flex-col justify-center gap-2 w-full lg:w-[49%] h-28 px-5 rounded-md shadow-md items-start bg-[#F5F5F5]
|
||||
`}
|
||||
>
|
||||
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||
عنوان کلید:{" "}
|
||||
<span className=" text-slate-800">{item.title}</span>
|
||||
</p>
|
||||
{/* <p className="text-sm font-normal leading-normal text-slate-500">
|
||||
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||
آیدی بازرس:{" "}
|
||||
<span className="self-end text-slate-800">
|
||||
{item.inspectorId}
|
||||
</span>
|
||||
</p> */}
|
||||
{item?.isActive ? (
|
||||
<Check className="self-end w-6 h-6 text-green-600" />
|
||||
) : (
|
||||
</p>
|
||||
|
||||
<AlertDialog open={openEdit} onOpenChange={setOpenEdit}>
|
||||
<AlertDialogTrigger asChild>
|
||||
{/* <Button variant="outline">Show Dialog</Button> */}
|
||||
|
|
@ -500,9 +430,32 @@ export default function AdminKeysManagement() {
|
|||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
{/* <FormField
|
||||
control={formEdit.control}
|
||||
name="publicKeyId"
|
||||
render={({ field }) => (
|
||||
<FormItem className=" w-full lg:w-[48%]">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium ">
|
||||
آی دی کلید عمومی
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
className="mt-2 bg-slate-300"
|
||||
value={item?.id}
|
||||
readOnly={true}
|
||||
// {...field}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/> */}
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
|
||||
<Button
|
||||
// href="/FollowResult"
|
||||
type="submit"
|
||||
className="p-2 text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
|
||||
>
|
||||
|
|
@ -529,7 +482,6 @@ export default function AdminKeysManagement() {
|
|||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ export default function ComplainsDetails({
|
|||
|
||||
const checkKey2 = (item: any) => {
|
||||
const dcKey = Decrypt(item.cipherKeyInspector, selectedFile);
|
||||
console.log(dcKey);
|
||||
if (dcKey != false && dcKey != null) {
|
||||
if (check) {
|
||||
localStorage.setItem("privateKey", selectedFile);
|
||||
|
|
@ -424,7 +425,7 @@ export default function ComplainsDetails({
|
|||
روند شکایت
|
||||
</p>
|
||||
<div
|
||||
className="flex flex-col mt-4 gap-y-4 overflow-y-auto
|
||||
className="flex flex-col mt-4 gap-y-4 overflow-auto
|
||||
scrollbar-thin scrollbar-thumb-gray-500 scrollbar-track-gray-100 "
|
||||
>
|
||||
{data.contents?.map((item: any) => {
|
||||
|
|
@ -446,9 +447,11 @@ export default function ComplainsDetails({
|
|||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<p className="text-[#7C838A] text-sm flex flex-wrap whitespace-normal break-all mt-2">
|
||||
<div className=" text-[#464646] mt-2">
|
||||
<span className="text-[#7C838A] text-sm">
|
||||
{item.text ? item.text : "-"}
|
||||
</p>
|
||||
</span>
|
||||
</div>
|
||||
{item.media.length !== 0 && (
|
||||
<Separator className="mt-2 mb-1 " />
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -157,7 +157,6 @@ export default function InspectorOperations({
|
|||
const deleteFileFromAttachments = (File: any) => {
|
||||
const filtered = file?.filter((item) => item.name !== File);
|
||||
setFile(filtered);
|
||||
// @ts-expect-error
|
||||
form.setValue("media", filtered);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ import { getProfile, revoke } from "@/utils/authenticateApi";
|
|||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { DoorOpen, LogOut } from "lucide-react";
|
||||
import { deleteCookie, getCookie } from "cookies-next";
|
||||
import useSignalR from "@/hooks/useSignalR";
|
||||
|
||||
export default function NavbarPanel() {
|
||||
const [isOpen, setOpen] = useState(false);
|
||||
const ref = useRef(null);
|
||||
|
|
@ -55,7 +53,6 @@ export default function NavbarPanel() {
|
|||
localStorage.removeItem("privatePassword");
|
||||
router.push("/");
|
||||
};
|
||||
const signalr = useSignalR();
|
||||
|
||||
return (
|
||||
<div className="fixed top-0 z-10 flex flex-row items-center justify-between w-full gap-3 px-8 py-4 shadow-md sm:items-center sm:gap-0 bg-blue max-md:px-4 ">
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import * as ProgressPrimitive from "@radix-ui/react-progress"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const Progress = React.forwardRef<
|
||||
React.ElementRef<typeof ProgressPrimitive.Root>,
|
||||
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
|
||||
>(({ className, value, ...props }, ref) => (
|
||||
<ProgressPrimitive.Root
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"relative h-4 w-full overflow-hidden rounded-full bg-secondary",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<ProgressPrimitive.Indicator
|
||||
className="h-full w-full flex-1 bg-primary transition-all"
|
||||
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
||||
/>
|
||||
</ProgressPrimitive.Root>
|
||||
))
|
||||
Progress.displayName = ProgressPrimitive.Root.displayName
|
||||
|
||||
export { Progress }
|
||||
|
|
@ -10,7 +10,7 @@ const Toaster = ({ ...props }: ToasterProps) => {
|
|||
|
||||
return (
|
||||
<Sonner
|
||||
// theme={theme as ToasterProps["theme"]}
|
||||
theme={theme as ToasterProps["theme"]}
|
||||
className="toaster group !font-[yekan]"
|
||||
toastOptions={{
|
||||
classNames: {
|
||||
|
|
|
|||
|
|
@ -1,84 +0,0 @@
|
|||
import { useCallback, useEffect } from "react";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import {
|
||||
HttpTransportType,
|
||||
HubConnectionBuilder,
|
||||
JsonHubProtocol,
|
||||
LogLevel,
|
||||
} from "@microsoft/signalr";
|
||||
import connection from "../utils/signalrConnection";
|
||||
import { postConnectionId } from "@/utils/inspectorApi";
|
||||
import { toast } from "sonner";
|
||||
import { useParams, usePathname } from "next/navigation";
|
||||
|
||||
const useSignalR = () => {
|
||||
const queryClient = useQueryClient();
|
||||
const pathname = usePathname();
|
||||
const param = useParams();
|
||||
const isInComplaintDetailPage = pathname.includes(
|
||||
"/UserPanel/ControllerDashboard/Complaints/"
|
||||
);
|
||||
const postConnectionIdMutation = useMutation({
|
||||
mutationKey: ["connectionId"],
|
||||
mutationFn: postConnectionId,
|
||||
onSuccess: (res) => {},
|
||||
onError: (err) => {},
|
||||
});
|
||||
useEffect(() => {
|
||||
const role = localStorage.getItem("Sootzani_Role");
|
||||
if (role != "Admin") {
|
||||
const startConnection = async () => {
|
||||
try {
|
||||
await connection.start();
|
||||
console.log("SignalR connected");
|
||||
console.log(connection.connectionId);
|
||||
|
||||
postConnectionIdMutation.mutate(connection.connectionId);
|
||||
connection.on("Created", (message) => {
|
||||
queryClient.invalidateQueries(["ComplaintsList"]);
|
||||
toast.info("یک درخواست جدید دارید.");
|
||||
});
|
||||
connection.on("Updated", (message, id) => {
|
||||
toast.info(`${message}`);
|
||||
if (param.id == id) {
|
||||
queryClient.invalidateQueries(["Complaint", id]);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error("SignalR connection failed: ", err);
|
||||
}
|
||||
};
|
||||
|
||||
startConnection();
|
||||
}
|
||||
|
||||
// console.log(connection.connectionId);
|
||||
|
||||
// return () => {
|
||||
// if (connection.state === "Connected") {
|
||||
// connection.stop();
|
||||
// console.log("SignalR disconnected");
|
||||
// }
|
||||
// };
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (connection.connectionId) {
|
||||
console.log(connection.connectionId);
|
||||
}
|
||||
}, [connection]);
|
||||
// console.log(connection.state);
|
||||
// useEffect(() => {
|
||||
// console.log(11111);
|
||||
// console.log(connection.state);
|
||||
// // Subscribe to events and update query data accordingly
|
||||
// // Example: Listen for a "newMessage" event and update a query with the new message data
|
||||
|
||||
// console.log(connection.state);
|
||||
|
||||
// }, [queryClient]);
|
||||
|
||||
// return connection;
|
||||
};
|
||||
|
||||
export default useSignalR;
|
||||
|
|
@ -39,6 +39,7 @@ export function Decrypt(encryptedData: any, privateKey: any) {
|
|||
}
|
||||
|
||||
export function formatBytes(bytes: number, decimals = 2) {
|
||||
console.log(bytes);
|
||||
if (!+bytes) return "0 Bytes";
|
||||
|
||||
const k = 1024;
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
{
|
||||
"name": "sootzani",
|
||||
"version": "0.2.15",
|
||||
"version": "0.2.14",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "sootzani",
|
||||
"version": "0.2.15",
|
||||
"version": "0.2.14",
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.3.2",
|
||||
"@microsoft/signalr": "^8.0.0",
|
||||
"@radix-ui/react-alert-dialog": "^1.0.5",
|
||||
"@radix-ui/react-checkbox": "^1.0.4",
|
||||
"@radix-ui/react-dialog": "^1.0.5",
|
||||
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
||||
"@radix-ui/react-icons": "^1.3.0",
|
||||
"@radix-ui/react-label": "^2.0.2",
|
||||
"@radix-ui/react-progress": "^1.0.3",
|
||||
"@radix-ui/react-radio-group": "^1.1.3",
|
||||
"@radix-ui/react-scroll-area": "^1.0.5",
|
||||
"@radix-ui/react-select": "^2.0.0",
|
||||
|
|
@ -48,7 +46,6 @@
|
|||
"lucide-react": "^0.292.0",
|
||||
"next": "14.0.3",
|
||||
"next-nprogress-bar": "^2.1.2",
|
||||
"next-runtime-env": "^3.2.0",
|
||||
"next-themes": "^0.2.1",
|
||||
"nextjs-toploader": "^1.6.4",
|
||||
"npm": "^10.2.5",
|
||||
|
|
@ -344,18 +341,6 @@
|
|||
"resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz",
|
||||
"integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw=="
|
||||
},
|
||||
"node_modules/@microsoft/signalr": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-8.0.0.tgz",
|
||||
"integrity": "sha512-K/wS/VmzRWePCGqGh8MU8OWbS1Zvu7DG7LSJS62fBB8rJUXwwj4axQtqrAAwKGUZHQF6CuteuQR9xMsVpM2JNA==",
|
||||
"dependencies": {
|
||||
"abort-controller": "^3.0.0",
|
||||
"eventsource": "^2.0.2",
|
||||
"fetch-cookie": "^2.0.3",
|
||||
"node-fetch": "^2.6.7",
|
||||
"ws": "^7.4.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/env": {
|
||||
"version": "14.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/env/-/env-14.0.3.tgz",
|
||||
|
|
@ -1036,30 +1021,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-progress": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-progress/-/react-progress-1.0.3.tgz",
|
||||
"integrity": "sha512-5G6Om/tYSxjSeEdrb1VfKkfZfn/1IlPWd731h2RfPuSbIfNUgfqAwbKfJCg/PP6nuUCTrYzalwHSpSinoWoCag==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.13.10",
|
||||
"@radix-ui/react-context": "1.0.1",
|
||||
"@radix-ui/react-primitive": "1.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-radio-group": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-radio-group/-/react-radio-group-1.1.3.tgz",
|
||||
|
|
@ -1798,17 +1759,6 @@
|
|||
"resolved": "https://registry.npmjs.org/@xobotyi/scrollbar-width/-/scrollbar-width-1.9.5.tgz",
|
||||
"integrity": "sha512-N8tkAACJx2ww8vFMneJmaAgmjAG1tnVBZJRLRcx061tmsLRZHSEZSLuGWnwPtunsSLvSqXQ2wfp7Mgqg1I+2dQ=="
|
||||
},
|
||||
"node_modules/abort-controller": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
||||
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
||||
"dependencies": {
|
||||
"event-target-shim": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.11.2",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
|
||||
|
|
@ -3376,27 +3326,11 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/event-target-shim": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/eventemitter3": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-2.0.3.tgz",
|
||||
"integrity": "sha512-jLN68Dx5kyFHaePoXWPsCGW5qdyZQtLYHkxkg02/Mz6g0kYpDx4FyP6XfArhQdlOC4b8Mv+EMxPo/8La7Tzghg=="
|
||||
},
|
||||
"node_modules/eventsource": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz",
|
||||
"integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/extend": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
|
||||
|
|
@ -3486,15 +3420,6 @@
|
|||
"reusify": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/fetch-cookie": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-2.2.0.tgz",
|
||||
"integrity": "sha512-h9AgfjURuCgA2+2ISl8GbavpUdR+WGAM2McW/ovn4tVccegp8ZqCKWSBR8uRdM8dDNlx5WdKRWxBYUwteLDCNQ==",
|
||||
"dependencies": {
|
||||
"set-cookie-parser": "^2.4.8",
|
||||
"tough-cookie": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/figures": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
|
||||
|
|
@ -4941,19 +4866,6 @@
|
|||
"nprogress": "^0.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/next-runtime-env": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/next-runtime-env/-/next-runtime-env-3.2.0.tgz",
|
||||
"integrity": "sha512-rwe3flUgSRm51hzRN4Vt5MMSYMS4aDMEPJa0r+CMONA3UyUZl8Y5O8zjHSIlaNb3yquTCttZ0ahObPyPprBj9g==",
|
||||
"dependencies": {
|
||||
"next": "^14",
|
||||
"react": "^18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"next": "^14",
|
||||
"react": "^18"
|
||||
}
|
||||
},
|
||||
"node_modules/next-themes": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.2.1.tgz",
|
||||
|
|
@ -4979,25 +4891,6 @@
|
|||
"react-dom": ">= 16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/node-releases": {
|
||||
"version": "2.0.13",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz",
|
||||
|
|
@ -8246,24 +8139,15 @@
|
|||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
|
||||
},
|
||||
"node_modules/psl": {
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
|
||||
"integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag=="
|
||||
},
|
||||
"node_modules/punycode": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/querystringify": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
||||
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="
|
||||
},
|
||||
"node_modules/queue-microtask": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
||||
|
|
@ -8655,11 +8539,6 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/requires-port": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ=="
|
||||
},
|
||||
"node_modules/resize-observer-polyfill": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",
|
||||
|
|
@ -8871,11 +8750,6 @@
|
|||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/set-cookie-parser": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz",
|
||||
"integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ=="
|
||||
},
|
||||
"node_modules/set-function-length": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz",
|
||||
|
|
@ -9460,25 +9334,6 @@
|
|||
"resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz",
|
||||
"integrity": "sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ=="
|
||||
},
|
||||
"node_modules/tough-cookie": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz",
|
||||
"integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==",
|
||||
"dependencies": {
|
||||
"psl": "^1.1.33",
|
||||
"punycode": "^2.1.1",
|
||||
"universalify": "^0.2.0",
|
||||
"url-parse": "^1.5.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
||||
},
|
||||
"node_modules/ts-api-utils": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz",
|
||||
|
|
@ -9641,14 +9496,6 @@
|
|||
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/universalify": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
|
||||
"integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==",
|
||||
"engines": {
|
||||
"node": ">= 4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/update-browserslist-db": {
|
||||
"version": "1.0.13",
|
||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz",
|
||||
|
|
@ -9688,15 +9535,6 @@
|
|||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/url-parse": {
|
||||
"version": "1.5.10",
|
||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
||||
"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
|
||||
"dependencies": {
|
||||
"querystringify": "^2.1.1",
|
||||
"requires-port": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/use-callback-ref": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.0.tgz",
|
||||
|
|
@ -9771,20 +9609,6 @@
|
|||
"defaults": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
||||
},
|
||||
"node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
|
|
@ -9894,26 +9718,6 @@
|
|||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "7.5.9",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
|
||||
"integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
|
||||
"engines": {
|
||||
"node": ">=8.3.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": "^5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "sootzani",
|
||||
"version": "0.2.15",
|
||||
"version": "0.2.14",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
|
@ -10,14 +10,12 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.3.2",
|
||||
"@microsoft/signalr": "^8.0.0",
|
||||
"@radix-ui/react-alert-dialog": "^1.0.5",
|
||||
"@radix-ui/react-checkbox": "^1.0.4",
|
||||
"@radix-ui/react-dialog": "^1.0.5",
|
||||
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
||||
"@radix-ui/react-icons": "^1.3.0",
|
||||
"@radix-ui/react-label": "^2.0.2",
|
||||
"@radix-ui/react-progress": "^1.0.3",
|
||||
"@radix-ui/react-radio-group": "^1.1.3",
|
||||
"@radix-ui/react-scroll-area": "^1.0.5",
|
||||
"@radix-ui/react-select": "^2.0.0",
|
||||
|
|
@ -49,7 +47,6 @@
|
|||
"lucide-react": "^0.292.0",
|
||||
"next": "14.0.3",
|
||||
"next-nprogress-bar": "^2.1.2",
|
||||
"next-runtime-env": "^3.2.0",
|
||||
"next-themes": "^0.2.1",
|
||||
"nextjs-toploader": "^1.6.4",
|
||||
"npm": "^10.2.5",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import axios from "axios";
|
||||
import { CookieValueTypes, getCookie } from "cookies-next";
|
||||
import { env } from "next-runtime-env";
|
||||
const NEXT_PUBLIC_BASE_URL_APP = env("NEXT_PUBLIC_BASE_URL_APP");
|
||||
axios.defaults.baseURL = NEXT_PUBLIC_BASE_URL_APP;
|
||||
|
||||
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
||||
|
||||
axios.interceptors.request.use(function (config) {
|
||||
const token = getCookie("Sootzani_Admin_Token");
|
||||
|
|
@ -28,7 +27,6 @@ export async function AddKey(payload: { title: string; publicKey: string }) {
|
|||
export async function ChangeKey(payload: {
|
||||
privateKey: string;
|
||||
publicKeyId: string;
|
||||
isPolling: boolean;
|
||||
}) {
|
||||
const data = await axios.post("api/Admin/ChangeKey", payload);
|
||||
return data.data;
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@ import {
|
|||
getCookie,
|
||||
setCookie,
|
||||
} from "cookies-next";
|
||||
import { env } from "next-runtime-env";
|
||||
const NEXT_PUBLIC_BASE_URL_APP = env("NEXT_PUBLIC_BASE_URL_APP");
|
||||
axios.defaults.baseURL = NEXT_PUBLIC_BASE_URL_APP;
|
||||
|
||||
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
||||
|
||||
let isRefreshing = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,5 +23,3 @@ export async function getOptions() {
|
|||
const data = await axios.get("/api/Common/Options");
|
||||
return data.data;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import axios from "axios";
|
||||
import { CookieValueTypes, getCookie } from "cookies-next";
|
||||
import { env } from "next-runtime-env";
|
||||
const NEXT_PUBLIC_BASE_URL_APP = env("NEXT_PUBLIC_BASE_URL_APP");
|
||||
axios.defaults.baseURL = NEXT_PUBLIC_BASE_URL_APP;
|
||||
|
||||
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
||||
|
||||
axios.interceptors.request.use(function (config) {
|
||||
const token = getCookie("Sootzani_Admin_Token");
|
||||
|
|
|
|||
|
|
@ -3,9 +3,8 @@
|
|||
import axios from "axios";
|
||||
import { CookieValueTypes, getCookie } from "cookies-next";
|
||||
import { RefreshToken } from "./authenticateApi";
|
||||
import { env } from "next-runtime-env";
|
||||
const NEXT_PUBLIC_BASE_URL_APP = env("NEXT_PUBLIC_BASE_URL_APP");
|
||||
axios.defaults.baseURL = NEXT_PUBLIC_BASE_URL_APP;
|
||||
|
||||
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
||||
|
||||
axios.interceptors.request.use(function (config) {
|
||||
const token = getCookie("Sootzani_Admin_Token");
|
||||
|
|
@ -51,10 +50,3 @@ export async function OperateByInspector(payload: FormData) {
|
|||
});
|
||||
return data.data;
|
||||
}
|
||||
|
||||
export async function postConnectionId(id: string) {
|
||||
const data = await axios.post("/api/Common/ConnectionId", id, {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
return data.data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
import {
|
||||
HttpTransportType,
|
||||
HubConnectionBuilder,
|
||||
JsonHubProtocol,
|
||||
LogLevel,
|
||||
} from "@microsoft/signalr";
|
||||
import { getCookie } from "cookies-next";
|
||||
|
||||
const token = getCookie("Sootzani_Admin_Token");
|
||||
|
||||
const connection = new HubConnectionBuilder()
|
||||
.withUrl("https://sootzaniapi.shetabdahi.ir/notifhub", {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
.withAutomaticReconnect()
|
||||
.withHubProtocol(new JsonHubProtocol())
|
||||
.configureLogging(LogLevel.Debug)
|
||||
.build();
|
||||
|
||||
// Optional: Configure connection options, such as access token or headers
|
||||
// connection.on("your-event", (data) => {
|
||||
// // Handle incoming events
|
||||
// });
|
||||
|
||||
export default connection;
|
||||
Loading…
Reference in New Issue