diff --git a/.prettierrc.js b/.prettierrc.js index 90b13b7..1f50f3e 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -27,7 +27,7 @@ module.exports = { importOrder: [ "", - "^~/components/(.*)$", + "^~/(app|components)/(.*)$", "^~/(utils|hooks|context)/(.*)$", "^~/types/(.*)$", "^~/(config|styles)/(.*)$", diff --git a/src/app/@file.grid.tsx b/src/app/@file.grid.tsx index 4e6c7a7..7b70949 100644 --- a/src/app/@file.grid.tsx +++ b/src/app/@file.grid.tsx @@ -42,7 +42,9 @@ type Props = { export default function FileGrid({ data }: Props) { const pathname = usePathname(); const filePath = useMemo(() => { - const path = [pathname, encodeURIComponent(data.name)] + const currentPath = pathname.startsWith("/e") ? pathname : `/e${pathname}`; + // Set to pathname to remove the /e prefix + const path = [currentPath, encodeURIComponent(data.name)] .join("/") .replace(/\/+/g, "/"); diff --git a/src/app/@file.list.tsx b/src/app/@file.list.tsx index ae2a21a..cf8ab38 100644 --- a/src/app/@file.list.tsx +++ b/src/app/@file.list.tsx @@ -42,7 +42,9 @@ export default function FileList({ data }: Props) { const pathname = usePathname(); const filePath = useMemo(() => { - const path = [pathname, encodeURIComponent(data.name)] + const currentPath = pathname.startsWith("/e") ? pathname : `/e${pathname}`; + // Set to pathname to remove the /e prefix + const path = [currentPath, encodeURIComponent(data.name)] .join("/") .replace(/\/+/g, "/"); diff --git a/src/app/api/download/[encryptedId]/route.ts b/src/app/api/download/[encryptedId]/route.ts index e142ef3..de65231 100644 --- a/src/app/api/download/[encryptedId]/route.ts +++ b/src/app/api/download/[encryptedId]/route.ts @@ -1,4 +1,5 @@ import { NextRequest, NextResponse } from "next/server"; + import { CheckDownloadToken, CheckPassword, diff --git a/src/app/api/raw/[...rest]/route.ts b/src/app/api/raw/[...rest]/route.ts index 832c865..7701563 100644 --- a/src/app/api/raw/[...rest]/route.ts +++ b/src/app/api/raw/[...rest]/route.ts @@ -1,4 +1,5 @@ import { NextRequest, NextResponse } from "next/server"; + import { CheckPassword, CheckPaths, GetFile } from "~/app/actions"; import { decryptData } from "~/utils/encryptionHelper/hash"; diff --git a/src/app/[...rest]/page.tsx b/src/app/e/[...rest]/page.tsx similarity index 90% rename from src/app/[...rest]/page.tsx rename to src/app/e/[...rest]/page.tsx index 42f946a..d80d1af 100644 --- a/src/app/[...rest]/page.tsx +++ b/src/app/e/[...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/page.tsx b/src/app/page.tsx index 7735c4b..3cd1812 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -10,7 +10,7 @@ import Markdown from "./@markdown"; import { GetFiles, GetReadme } from "./actions"; export const revalidate = 300; -export const dynamic = 'force-dynamic' +export const dynamic = "force-dynamic"; export default async function RootPage() { const [data, readme] = await Promise.all([