diff --git a/src/app/@file.grid.tsx b/src/app/@file.grid.tsx index 7b70949..f86b9ca 100644 --- a/src/app/@file.grid.tsx +++ b/src/app/@file.grid.tsx @@ -42,9 +42,9 @@ type Props = { export default function FileGrid({ data }: Props) { const pathname = usePathname(); const filePath = useMemo(() => { - const currentPath = pathname.startsWith("/e") ? pathname : `/e${pathname}`; + // const currentPath = pathname.startsWith("/e") ? pathname : `/e${pathname}`; // Set to pathname to remove the /e prefix - const path = [currentPath, encodeURIComponent(data.name)] + const path = [pathname, encodeURIComponent(data.name)] .join("/") .replace(/\/+/g, "/"); diff --git a/src/app/@file.list.tsx b/src/app/@file.list.tsx index cf8ab38..e61a5ac 100644 --- a/src/app/@file.list.tsx +++ b/src/app/@file.list.tsx @@ -42,9 +42,9 @@ export default function FileList({ data }: Props) { const pathname = usePathname(); const filePath = useMemo(() => { - const currentPath = pathname.startsWith("/e") ? pathname : `/e${pathname}`; + // const currentPath = pathname.startsWith("/e") ? pathname : `/e${pathname}`; // Set to pathname to remove the /e prefix - const path = [currentPath, encodeURIComponent(data.name)] + const path = [pathname, encodeURIComponent(data.name)] .join("/") .replace(/\/+/g, "/"); diff --git a/src/app/e/[...rest]/page.tsx b/src/app/[...rest]/page.tsx similarity index 90% rename from src/app/e/[...rest]/page.tsx rename to src/app/[...rest]/page.tsx index d80d1af..42f946a 100644 --- a/src/app/e/[...rest]/page.tsx +++ b/src/app/[...rest]/page.tsx @@ -11,19 +11,19 @@ import { decryptData } from "~/utils/encryptionHelper/hash"; import gdrive from "~/utils/gdriveInstance"; import { getFileType } from "~/utils/previewHelper"; -import FileBrowser from "../../@explorer"; -import Header from "../../@header"; -import HeaderButton from "../../@header.button"; -import Markdown from "../../@markdown"; -import Password from "../../@password"; -import PreviewAction from "../../@preview.action"; -import PreviewAudio from "../../@preview.audio"; -import PreviewDoc from "../../@preview.doc"; -import PreviewImage from "../../@preview.image"; -import PreviewManga from "../../@preview.manga"; -import PreviewRich from "../../@preview.rich"; -import PreviewUnknown from "../../@preview.unknown"; -import PreviewVideo from "../../@preview.video"; +import FileBrowser from "../@explorer"; +import Header from "../@header"; +import HeaderButton from "../@header.button"; +import Markdown from "../@markdown"; +import Password from "../@password"; +import PreviewAction from "../@preview.action"; +import PreviewAudio from "../@preview.audio"; +import PreviewDoc from "../@preview.doc"; +import PreviewImage from "../@preview.image"; +import PreviewManga from "../@preview.manga"; +import PreviewRich from "../@preview.rich"; +import PreviewUnknown from "../@preview.unknown"; +import PreviewVideo from "../@preview.video"; import { CheckPassword, CheckPaths, @@ -31,7 +31,7 @@ import { GetFile, GetFiles, GetReadme, -} from "../../actions"; +} from "../actions"; export const revalidate = 300; export const dynamic = "force-dynamic"; diff --git a/src/app/api/download/[encryptedId]/route.ts b/src/app/api/download/[encryptedId]/route.ts index de65231..bba8c4e 100644 --- a/src/app/api/download/[encryptedId]/route.ts +++ b/src/app/api/download/[encryptedId]/route.ts @@ -1,5 +1,4 @@ import { NextRequest, NextResponse } from "next/server"; - import { CheckDownloadToken, CheckPassword, @@ -9,7 +8,7 @@ import { } from "~/app/actions"; import { decryptData } from "~/utils/encryptionHelper/hash"; -import gdrive from "~/utils/gdriveInstance"; +import { gdriveNoCache as gdrive } from "~/utils/gdriveInstance"; import config from "~/config/gIndex.config"; diff --git a/src/app/api/raw/[...rest]/route.ts b/src/app/api/raw/[...rest]/route.ts index 7701563..832c865 100644 --- a/src/app/api/raw/[...rest]/route.ts +++ b/src/app/api/raw/[...rest]/route.ts @@ -1,5 +1,4 @@ import { NextRequest, NextResponse } from "next/server"; - import { CheckPassword, CheckPaths, GetFile } from "~/app/actions"; import { decryptData } from "~/utils/encryptionHelper/hash"; diff --git a/src/utils/gdriveInstance.ts b/src/utils/gdriveInstance.ts index fe8a25f..f399f0e 100644 --- a/src/utils/gdriveInstance.ts +++ b/src/utils/gdriveInstance.ts @@ -53,14 +53,18 @@ if (!gdrive) { gdrive = google.drive({ version: "v3", auth: serviceAccountAuth, - // fetchImplementation: (url, init) => - // fetch(url, { - // ...init, - // next: { - // revalidate: 3600, - // }, - // }), + fetchImplementation: (url, init) => + fetch(url, { + ...init, + next: { + revalidate: 3600, + }, + }), }); } +export const gdriveNoCache = google.drive({ + version: "v3", + auth: serviceAccountAuth, +}); export default gdrive as drive_v3.Drive;