From 5afe2907f11c5c7eeb2610f2761a666ef10be956 Mon Sep 17 00:00:00 2001 From: Chirag Bhalotia Date: Sat, 24 Jun 2023 11:47:45 +0530 Subject: [PATCH 01/26] =?UTF-8?q?Added=20redirect=20to=20/=20without=20log?= =?UTF-8?q?in=20=F0=9F=94=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/(dashboard)/dashboard/layout.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/dashboard/app/(dashboard)/dashboard/layout.tsx b/packages/dashboard/app/(dashboard)/dashboard/layout.tsx index 469dd13..4bc4fa2 100644 --- a/packages/dashboard/app/(dashboard)/dashboard/layout.tsx +++ b/packages/dashboard/app/(dashboard)/dashboard/layout.tsx @@ -1,5 +1,7 @@ import { sidebarGroups } from '@/lib/sidebar'; +import { cookies } from 'next/headers'; import Link from 'next/link'; +import { redirect } from 'next/navigation'; import React from 'react'; interface DashboardLayoutProps { @@ -7,17 +9,24 @@ interface DashboardLayoutProps { } const Layout = ({ children }: DashboardLayoutProps) => { + const cookieList = cookies(); + const apiKey = cookieList.has('apiKey'); + const masterKey = cookieList.has('masterKey'); + const instanceUrl = cookieList.has('instanceUrl'); + if (!apiKey || !masterKey || !instanceUrl) redirect('/'); return (
{sidebarGroups.map((sidebarGrp, index) => { return (
-

{sidebarGrp.name}

+

+ {sidebarGrp.name} +

{sidebarGrp.items.map((item, index) => { return ( @@ -29,7 +38,7 @@ const Layout = ({ children }: DashboardLayoutProps) => { ); })}
-
{children}
+
{children}
); }; From 7a69008bbe97aab45a32d1f567e5b096c22a2449 Mon Sep 17 00:00:00 2001 From: Chirag Bhalotia Date: Sat, 24 Jun 2023 11:58:26 +0530 Subject: [PATCH 02/26] =?UTF-8?q?=E2=86=97=20added=20redirect=20on=20delet?= =?UTF-8?q?ion=20of=20logged=20in=20api=20key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Lists/ApiKeyList/index.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/dashboard/components/Lists/ApiKeyList/index.tsx b/packages/dashboard/components/Lists/ApiKeyList/index.tsx index 534227d..44cb89e 100644 --- a/packages/dashboard/components/Lists/ApiKeyList/index.tsx +++ b/packages/dashboard/components/Lists/ApiKeyList/index.tsx @@ -2,6 +2,8 @@ import api from '@/api'; import Button from '@/components/ui/Button'; +import Cookies from 'js-cookie'; +import { useRouter } from 'next/navigation'; import React, { useState } from 'react'; import { toast } from 'react-hot-toast'; @@ -11,9 +13,17 @@ interface ApiKeyListProps { function ApiKeyList({ data }: ApiKeyListProps) { const [apiKeys, setApiKeys] = useState(data); - const onDisableApiKey = async (id: string) => { + const router = useRouter(); + const onDisableApiKey = async (id: string, key: string) => { try { + const apiKey = Cookies.get().apiKey as string; await api.apiKeys.disableApiKey(id); + if (apiKey.endsWith(key.substring(9))) { + Cookies.remove('apiKey'); + Cookies.remove('masterKey'); + Cookies.remove('instanceUrl'); + router.replace('/'); + } setApiKeys(old => old.filter(key => key.keyID !== id)); } catch (err) { console.error('Error Deleting api key'); @@ -49,7 +59,7 @@ function ApiKeyList({ data }: ApiKeyListProps) { aria-label="Disable Api Key" title="Disable Api Key" className="rounded-full p-2 bg-red-100 text-red-600" - onClick={() => onDisableApiKey(keyID)} + onClick={() => onDisableApiKey(keyID, key)} > Disable From 880e816d83f022f25be705d6aa2678b10e68e2d9 Mon Sep 17 00:00:00 2001 From: Chirag Bhalotia Date: Sat, 24 Jun 2023 12:01:32 +0530 Subject: [PATCH 03/26] =?UTF-8?q?=E2=9A=99=20fixed=20utils=20tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/dashboard/lib/sidebar.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/dashboard/lib/sidebar.ts b/packages/dashboard/lib/sidebar.ts index 1025895..26dd0aa 100644 --- a/packages/dashboard/lib/sidebar.ts +++ b/packages/dashboard/lib/sidebar.ts @@ -32,12 +32,12 @@ export const sidebarGroups: SidebarGroup[] = [ href: '/dashboard/utilities/instance-info', }, { - name: 'Uploads', + name: 'Settings', href: '/dashboard/utilities/settings', }, { - name: 'Notes', - href: '/dashboard/utilites/download-config', + name: 'Download Config', + href: '/dashboard/utilities/download-config', }, ], }, From 4527b564c15288843b2bbf9c7798bd5d501161d2 Mon Sep 17 00:00:00 2001 From: Chirag Bhalotia Date: Sat, 24 Jun 2023 12:10:54 +0530 Subject: [PATCH 04/26] =?UTF-8?q?=F0=9F=97=93=20=20added=20last=20used=20i?= =?UTF-8?q?n=20api=20key=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/dashboard/components/Lists/ApiKeyList/index.tsx | 6 +++++- .../dashboard/components/Lists/UploadsList/LinearList.tsx | 5 +---- packages/dashboard/lib/utils.ts | 4 ++++ packages/dashboard/types/apiKey.d.ts | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/dashboard/components/Lists/ApiKeyList/index.tsx b/packages/dashboard/components/Lists/ApiKeyList/index.tsx index 44cb89e..979e7d8 100644 --- a/packages/dashboard/components/Lists/ApiKeyList/index.tsx +++ b/packages/dashboard/components/Lists/ApiKeyList/index.tsx @@ -2,6 +2,7 @@ import api from '@/api'; import Button from '@/components/ui/Button'; +import { parseDate } from '@/lib/utils'; import Cookies from 'js-cookie'; import { useRouter } from 'next/navigation'; import React, { useState } from 'react'; @@ -47,10 +48,13 @@ function ApiKeyList({ data }: ApiKeyListProps) { - {apiKeys.map(({ key, keyID }) => ( + {apiKeys.map(({ key, keyID, last_used }) => (

{key}

+

+ Last Used: {parseDate(last_used)} +

+ + +
); From 13aa51dc9cd2914b57e2b0a3e47cfc0c8fcf4fda Mon Sep 17 00:00:00 2001 From: Chirag Bhalotia Date: Sat, 24 Jun 2023 20:57:55 +0530 Subject: [PATCH 15/26] added note page and passkey validation --- packages/dashboard/api/notes.ts | 23 ++++---- .../dashboard/app/notes/[id]/NoteContent.tsx | 53 +++++++++++++++++++ packages/dashboard/app/notes/[id]/loading.tsx | 9 ++++ packages/dashboard/app/notes/[id]/page.tsx | 25 +++++++++ 4 files changed, 99 insertions(+), 11 deletions(-) create mode 100644 packages/dashboard/app/notes/[id]/NoteContent.tsx create mode 100644 packages/dashboard/app/notes/[id]/loading.tsx create mode 100644 packages/dashboard/app/notes/[id]/page.tsx diff --git a/packages/dashboard/api/notes.ts b/packages/dashboard/api/notes.ts index a29d20e..3e4bd66 100644 --- a/packages/dashboard/api/notes.ts +++ b/packages/dashboard/api/notes.ts @@ -6,24 +6,25 @@ export class Notes { constructor(axios: Axios) { this.axios = axios; } - async getAllNotes(search?:string) { - const res = await this.axios.get('/gist',{params:{search}}); + async getAllNotes(search?: string) { + const res = await this.axios.get('/gist', { params: { search } }); const data = res.data.data as INote[]; return data; } + async getSingleNote(id: string, passkey: string = '') { + const res = await this.axios.get(`/gist/${id}`, { params: { passkey } }); + const data = res.data.data as INote; + return data; + } async uploadSingleNote(data: AddNoteType) { - console.log("uploading") - if(!data.passkey){ - delete data.passkey - } + console.log('uploading'); + if (!data.passkey) { + delete data.passkey; + } const res = await this.axios.post('/gist', data); return res.data.data as INote; } - async deleteSingleNote({ - noteID, - }: { - noteID: string; - }) { + async deleteSingleNote({ noteID }: { noteID: string }) { const res = await this.axios.delete(`/gist/${noteID}`); return res; } diff --git a/packages/dashboard/app/notes/[id]/NoteContent.tsx b/packages/dashboard/app/notes/[id]/NoteContent.tsx new file mode 100644 index 0000000..5cbce17 --- /dev/null +++ b/packages/dashboard/app/notes/[id]/NoteContent.tsx @@ -0,0 +1,53 @@ +'use client'; + +import api from '@/api'; +import Button from '@/components/ui/Button'; +import Input from '@/components/ui/Input'; +import { Lock } from 'lucide-react'; +import React, { FormEventHandler, useState } from 'react'; +import { toast } from 'react-hot-toast'; + +interface NoteContentProps { + data: INote | null; + id: string; +} + +function NoteContent({ data, id }: NoteContentProps) { + const [note, setNote] = useState(data); + const [input, setInput] = useState(''); + const onSubmit: FormEventHandler = async evt => { + evt.preventDefault(); + try { + const data = await api.notes.getSingleNote(id, input); + setNote(data); + } catch (err) { + console.error(err); + toast.error('Wrong passkey'); + setNote(null); + } + }; + return ( +
+ {note?.content ?? ( +
+ setInput(evt.target.value)} + value={input} + /> + +
+ )} +
+ ); +} + +export default NoteContent; diff --git a/packages/dashboard/app/notes/[id]/loading.tsx b/packages/dashboard/app/notes/[id]/loading.tsx new file mode 100644 index 0000000..76fc0d8 --- /dev/null +++ b/packages/dashboard/app/notes/[id]/loading.tsx @@ -0,0 +1,9 @@ +import React from 'react' + +function Loading() { + return ( +
Loading
+ ) +} + +export default Loading \ No newline at end of file diff --git a/packages/dashboard/app/notes/[id]/page.tsx b/packages/dashboard/app/notes/[id]/page.tsx new file mode 100644 index 0000000..4af75b2 --- /dev/null +++ b/packages/dashboard/app/notes/[id]/page.tsx @@ -0,0 +1,25 @@ +import api from '@/api'; +import React from 'react'; +import NoteContent from './NoteContent'; + +interface NotePageProps { + params: { + id: string; + }; +} + +async function Page({ params: { id } }: NotePageProps) { + let data: INote | null = null; + try { + data = await api.notes.getSingleNote(id); + } catch { + data = null; + } + return ( +
+ +
+ ); +} + +export default Page; From 13d3679020ceada71e3ab4421dd90b6353af6ae7 Mon Sep 17 00:00:00 2001 From: Chirag Bhalotia Date: Sat, 24 Jun 2023 21:07:55 +0530 Subject: [PATCH 16/26] =?UTF-8?q?=E2=9C=8D=20added=20copy=20button=20for?= =?UTF-8?q?=20notes=20link?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Lists/NotesList/index.tsx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/dashboard/components/Lists/NotesList/index.tsx b/packages/dashboard/components/Lists/NotesList/index.tsx index 38b8fe5..54765eb 100644 --- a/packages/dashboard/components/Lists/NotesList/index.tsx +++ b/packages/dashboard/components/Lists/NotesList/index.tsx @@ -1,6 +1,6 @@ import Button from '@/components/ui/Button'; import Cookies from 'js-cookie'; -import { ArrowUpRight, Edit, Trash2 } from 'lucide-react'; +import { ArrowUpRight, Copy, Edit, Trash2 } from 'lucide-react'; import Link from 'next/link'; import { useEffect, useState } from 'react'; @@ -10,10 +10,9 @@ interface NotesLitsProps { } function NotesList({ data, onDeleteNote }: NotesLitsProps) { - const [instanceUrl, setInstanceURL] = useState(''); - useEffect(() => { - setInstanceURL(Cookies.get('instanceUrl') ?? ''); - }, []); + function copyNoteLink(id: string) { + navigator.clipboard.writeText(`${window.location.origin.toString()}/${id}`); + } return (
{data.map(note => { @@ -42,6 +41,16 @@ function NotesList({ data, onDeleteNote }: NotesLitsProps) { > + Date: Sat, 24 Jun 2023 21:16:23 +0530 Subject: [PATCH 17/26] fixed copy note link --- packages/dashboard/components/Lists/NotesList/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dashboard/components/Lists/NotesList/index.tsx b/packages/dashboard/components/Lists/NotesList/index.tsx index 54765eb..93e92bb 100644 --- a/packages/dashboard/components/Lists/NotesList/index.tsx +++ b/packages/dashboard/components/Lists/NotesList/index.tsx @@ -11,7 +11,7 @@ interface NotesLitsProps { function NotesList({ data, onDeleteNote }: NotesLitsProps) { function copyNoteLink(id: string) { - navigator.clipboard.writeText(`${window.location.origin.toString()}/${id}`); + navigator.clipboard.writeText(`${window.location.origin.toString()}/notes/${id}`); } return (
From 4b29715b1d4ddc4e581b96ae835b86b4e59f165a Mon Sep 17 00:00:00 2001 From: Chirag Bhalotia Date: Sat, 24 Jun 2023 21:17:08 +0530 Subject: [PATCH 18/26] changed redirect note to a new tab --- packages/dashboard/components/Lists/NotesList/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/dashboard/components/Lists/NotesList/index.tsx b/packages/dashboard/components/Lists/NotesList/index.tsx index 93e92bb..69e39e7 100644 --- a/packages/dashboard/components/Lists/NotesList/index.tsx +++ b/packages/dashboard/components/Lists/NotesList/index.tsx @@ -11,7 +11,9 @@ interface NotesLitsProps { function NotesList({ data, onDeleteNote }: NotesLitsProps) { function copyNoteLink(id: string) { - navigator.clipboard.writeText(`${window.location.origin.toString()}/notes/${id}`); + navigator.clipboard.writeText( + `${window.location.origin.toString()}/notes/${id}` + ); } return (
@@ -53,6 +55,8 @@ function NotesList({ data, onDeleteNote }: NotesLitsProps) { Date: Sat, 24 Jun 2023 21:21:12 +0530 Subject: [PATCH 19/26] =?UTF-8?q?=F0=9F=9A=91=20fixed=20note=20requires=20?= =?UTF-8?q?password=20when=20note=20is=20not=20private?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/dashboard/api/notes.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/dashboard/api/notes.ts b/packages/dashboard/api/notes.ts index 3e4bd66..866680d 100644 --- a/packages/dashboard/api/notes.ts +++ b/packages/dashboard/api/notes.ts @@ -12,7 +12,9 @@ export class Notes { return data; } async getSingleNote(id: string, passkey: string = '') { - const res = await this.axios.get(`/gist/${id}`, { params: { passkey } }); + const res = await this.axios.get(`/gist/${id}`, { + params: passkey ? { passkey } : {}, + }); const data = res.data.data as INote; return data; } From 6fd6bbd982194745942a1fa8365528f66ff3b210 Mon Sep 17 00:00:00 2001 From: Chirag Bhalotia Date: Sat, 24 Jun 2023 22:44:32 +0530 Subject: [PATCH 20/26] removed edit note button --- packages/dashboard/components/Lists/NotesList/index.tsx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/packages/dashboard/components/Lists/NotesList/index.tsx b/packages/dashboard/components/Lists/NotesList/index.tsx index 69e39e7..8dd61e5 100644 --- a/packages/dashboard/components/Lists/NotesList/index.tsx +++ b/packages/dashboard/components/Lists/NotesList/index.tsx @@ -34,15 +34,6 @@ function NotesList({ data, onDeleteNote }: NotesLitsProps) { > - diff --git a/packages/dashboard/lib/validators/login.ts b/packages/dashboard/lib/validators/login.ts index 5018ef6..317af4e 100644 --- a/packages/dashboard/lib/validators/login.ts +++ b/packages/dashboard/lib/validators/login.ts @@ -2,7 +2,6 @@ import { z } from 'zod'; export const LoginSchema = z.object({ masterkey: z.string().max(256), - instanceUrl: z.string().url(), }); export type LoginType = z.infer; From 36e9ab352e88d6b3a004fcc1dfaa819ebb8beae8 Mon Sep 17 00:00:00 2001 From: Chirag Bhalotia Date: Sun, 25 Jun 2023 01:12:46 +0530 Subject: [PATCH 22/26] added download link --- .../utilities/download-config/page.tsx | 79 ++++++++++++++++--- 1 file changed, 68 insertions(+), 11 deletions(-) diff --git a/packages/dashboard/app/(dashboard)/dashboard/utilities/download-config/page.tsx b/packages/dashboard/app/(dashboard)/dashboard/utilities/download-config/page.tsx index 45ee81d..a7cbe14 100644 --- a/packages/dashboard/app/(dashboard)/dashboard/utilities/download-config/page.tsx +++ b/packages/dashboard/app/(dashboard)/dashboard/utilities/download-config/page.tsx @@ -1,37 +1,94 @@ +'use client'; + import Button from '@/components/ui/Button'; +import axios from 'axios'; +import Cookies from 'js-cookie'; import { Download } from 'lucide-react'; -import React from 'react'; +import React, { useEffect, useState } from 'react'; +import { toast } from 'react-hot-toast'; const configs = [ { - name: 'Lorem Ipsum Config', + name: 'Image Config', + filename: 'image.sxcu', + url: `${process.env.NEXT_PUBLIC_INSTANCE_URL}/config/image.sxcu?apikey=`, id: '1', }, { - name: 'Lorem Cnofig', - id: '12', + name: 'Gist Config', + filename: 'gist.sxcu', + url: `${process.env.NEXT_PUBLIC_INSTANCE_URL}/config/gist.sxcu?apikey=`, + id: '2', }, { - name: 'Lorem Config Config', - id: '13', + name: 'URL Config', + filename: 'url.sxcu', + url: `${process.env.NEXT_PUBLIC_INSTANCE_URL}/config/url.sxcu?apikey=`, + id: '3', }, { - name: 'Lorem ', - id: '14', + name: 'File Config', + filename: 'file.sxcu', + url: `${process.env.NEXT_PUBLIC_INSTANCE_URL}/config/file.sxcu?apikey=`, + id: '4', }, ]; - +const downloadFile = ({ + data, + fileName, + fileType, +}: { + data: string; + fileName: string; + fileType: string; +}) => { + // Create a blob with the data we want to download as a file + const blob = new Blob([data], { type: fileType }); + // Create an anchor element and dispatch a click event on it + // to trigger a download + const a = document.createElement('a'); + a.download = fileName; + a.href = window.URL.createObjectURL(blob); + const clickEvt = new MouseEvent('click', { + view: window, + bubbles: true, + cancelable: true, + }); + a.dispatchEvent(clickEvt); + a.remove(); +}; function Page() { + const [apiKey, setApiKey] = useState(''); + useEffect(() => { + setApiKey(Cookies.get('apiKey') ?? ''); + }); + + async function onDownloadFile(url: string, filename: string) { + try { + const { data } = await axios.get(url); + console.log(data); + downloadFile({ + data: JSON.stringify(data), + fileName: filename, + fileType: 'text/json', + }); + } catch { + toast.error('Error downloading file'); + } + } return ( <> - {configs.map(({ name, id }) => { + {configs.map(({ name, id, url, filename }) => { return (

{name}

-
From 60af98a1e7ec58eee0769a787a143ba72f2c200e Mon Sep 17 00:00:00 2001 From: Chirag Bhalotia Date: Sun, 25 Jun 2023 01:13:44 +0530 Subject: [PATCH 23/26] removed instanceurl field in settings --- .../(dashboard)/dashboard/utilities/settings/page.tsx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/packages/dashboard/app/(dashboard)/dashboard/utilities/settings/page.tsx b/packages/dashboard/app/(dashboard)/dashboard/utilities/settings/page.tsx index bbd05c8..224f176 100644 --- a/packages/dashboard/app/(dashboard)/dashboard/utilities/settings/page.tsx +++ b/packages/dashboard/app/(dashboard)/dashboard/utilities/settings/page.tsx @@ -112,16 +112,6 @@ function Page() { Save
-
- - -
Date: Sun, 25 Jun 2023 01:18:13 +0530 Subject: [PATCH 24/26] added remove tag --- .../dashboard/utilities/settings/page.tsx | 10 ++++++++++ packages/dashboard/components/TagInput.tsx | 12 ++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/dashboard/app/(dashboard)/dashboard/utilities/settings/page.tsx b/packages/dashboard/app/(dashboard)/dashboard/utilities/settings/page.tsx index 224f176..2502018 100644 --- a/packages/dashboard/app/(dashboard)/dashboard/utilities/settings/page.tsx +++ b/packages/dashboard/app/(dashboard)/dashboard/utilities/settings/page.tsx @@ -117,6 +117,11 @@ function Page() { tags={settings.imageExtensions} onAddTags={addImageExt} placeholder="Image Extensions" + onChange={value => + setSettings(old => { + return { ...old, imageExtensions: value }; + }) + } /> ))} From f6f612e899bc6d083e289a2824577b032e862379 Mon Sep 17 00:00:00 2001 From: Chirag Bhalotia Date: Sun, 25 Jun 2023 01:28:56 +0530 Subject: [PATCH 25/26] integrated sys info api --- packages/dashboard/api/settings.ts | 7 ++++-- .../utilities/instance-info/page.tsx | 24 ++++++------------- packages/dashboard/types/settings.d.ts | 11 ++++++++- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/packages/dashboard/api/settings.ts b/packages/dashboard/api/settings.ts index 08672d2..bcc5455 100644 --- a/packages/dashboard/api/settings.ts +++ b/packages/dashboard/api/settings.ts @@ -15,8 +15,11 @@ export class Settings { return res } async getInstanceInfo(){ - - } + const res = await this.axios.get('/info/sys'); + delete res.data.data.cpuUsage + delete res.data.data.memoryUsage + return res.data.data as ISysSettings + } } export default Settings; diff --git a/packages/dashboard/app/(dashboard)/dashboard/utilities/instance-info/page.tsx b/packages/dashboard/app/(dashboard)/dashboard/utilities/instance-info/page.tsx index 43a4672..bffcac2 100644 --- a/packages/dashboard/app/(dashboard)/dashboard/utilities/instance-info/page.tsx +++ b/packages/dashboard/app/(dashboard)/dashboard/utilities/instance-info/page.tsx @@ -1,13 +1,9 @@ +import api from '@/api'; import React from 'react'; -function Page() { - const urls = [ - { - id: 'afdas', - originalURL: 'https://www.google.com', - shortenedURL: 'https://www.google.com', - }, - ]; +async function Page() { + const res = await api.settings.getInstanceInfo(); + const data = Object.entries(res); return (
@@ -29,19 +25,13 @@ function Page() { - {urls.map(({ originalURL, shortenedURL, id }) => ( + {data.map((val, id) => ( -
- {originalURL} - -
+
{val[0]}
-
- {shortenedURL} - -
+
{val[1]}
))} diff --git a/packages/dashboard/types/settings.d.ts b/packages/dashboard/types/settings.d.ts index 8c23a6d..68068f0 100644 --- a/packages/dashboard/types/settings.d.ts +++ b/packages/dashboard/types/settings.d.ts @@ -3,4 +3,13 @@ interface ISettings { language: string; imageExtensions: string[]; fileExtensions: string[]; -} \ No newline at end of file +} + +interface ISysSettings { + platform: string; + arch: string; + nodeVersion: string; + uptime: string; + kernelVersion: string; + hostname: string; +} From d0ff7da7e8c820e98104c8b15228d9e94a9b7633 Mon Sep 17 00:00:00 2001 From: Chirag Bhalotia Date: Sun, 25 Jun 2023 01:38:52 +0530 Subject: [PATCH 26/26] removed warnings --- packages/dashboard/api/notes.ts | 2 +- .../(dashboard)/dashboard/utilities/download-config/page.tsx | 2 +- .../app/(dashboard)/dashboard/utilities/settings/page.tsx | 1 - packages/dashboard/components/Lists/NotesList/index.tsx | 4 +--- packages/dashboard/components/Lists/ShortenUrlList/index.tsx | 3 +-- 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/dashboard/api/notes.ts b/packages/dashboard/api/notes.ts index 866680d..1287cf3 100644 --- a/packages/dashboard/api/notes.ts +++ b/packages/dashboard/api/notes.ts @@ -11,7 +11,7 @@ export class Notes { const data = res.data.data as INote[]; return data; } - async getSingleNote(id: string, passkey: string = '') { + async getSingleNote(id: string, passkey = '') { const res = await this.axios.get(`/gist/${id}`, { params: passkey ? { passkey } : {}, }); diff --git a/packages/dashboard/app/(dashboard)/dashboard/utilities/download-config/page.tsx b/packages/dashboard/app/(dashboard)/dashboard/utilities/download-config/page.tsx index a7cbe14..8042d4d 100644 --- a/packages/dashboard/app/(dashboard)/dashboard/utilities/download-config/page.tsx +++ b/packages/dashboard/app/(dashboard)/dashboard/utilities/download-config/page.tsx @@ -61,7 +61,7 @@ function Page() { const [apiKey, setApiKey] = useState(''); useEffect(() => { setApiKey(Cookies.get('apiKey') ?? ''); - }); + },[]); async function onDownloadFile(url: string, filename: string) { try { diff --git a/packages/dashboard/app/(dashboard)/dashboard/utilities/settings/page.tsx b/packages/dashboard/app/(dashboard)/dashboard/utilities/settings/page.tsx index 2502018..d5aec14 100644 --- a/packages/dashboard/app/(dashboard)/dashboard/utilities/settings/page.tsx +++ b/packages/dashboard/app/(dashboard)/dashboard/utilities/settings/page.tsx @@ -2,7 +2,6 @@ import React, { ChangeEventHandler, useEffect, useState } from 'react'; import Button from '@/components/ui/Button'; -import Input from '@/components/ui/Input'; import TagInput from '@/components/TagInput'; import api from '@/api'; import { toast } from 'react-hot-toast'; diff --git a/packages/dashboard/components/Lists/NotesList/index.tsx b/packages/dashboard/components/Lists/NotesList/index.tsx index 8dd61e5..b1fbc9a 100644 --- a/packages/dashboard/components/Lists/NotesList/index.tsx +++ b/packages/dashboard/components/Lists/NotesList/index.tsx @@ -1,8 +1,6 @@ import Button from '@/components/ui/Button'; -import Cookies from 'js-cookie'; -import { ArrowUpRight, Copy, Edit, Trash2 } from 'lucide-react'; +import { ArrowUpRight, Copy, Trash2 } from 'lucide-react'; import Link from 'next/link'; -import { useEffect, useState } from 'react'; interface NotesLitsProps { data: INote[]; diff --git a/packages/dashboard/components/Lists/ShortenUrlList/index.tsx b/packages/dashboard/components/Lists/ShortenUrlList/index.tsx index 7f986f2..bd0513a 100644 --- a/packages/dashboard/components/Lists/ShortenUrlList/index.tsx +++ b/packages/dashboard/components/Lists/ShortenUrlList/index.tsx @@ -1,6 +1,6 @@ 'use client'; -import React, { useEffect, useState } from 'react'; +import React, { useState } from 'react'; import Button from '@/components/ui/Button'; import { Trash, Edit2, ArrowUpRight, X } from 'lucide-react'; import URLControls from './URLControls'; @@ -9,7 +9,6 @@ import Input from '@/components/ui/Input'; import api from '@/api'; import { useRouter } from 'next/navigation'; import { toast } from 'react-hot-toast'; -import Cookies from 'js-cookie'; interface ShortenUrlListProps { data: IUrl[];