Remove /e prefix on file

This commit is contained in:
mbaharip
2024-04-07 00:09:28 +07:00
parent 1b3c7f0f79
commit ea72ae7ca5
6 changed files with 30 additions and 28 deletions
+2 -2
View File
@@ -42,9 +42,9 @@ type Props = {
export default function FileGrid({ data }: Props) {
const pathname = usePathname();
const filePath = useMemo<string>(() => {
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, "/");
+2 -2
View File
@@ -42,9 +42,9 @@ export default function FileList({ data }: Props) {
const pathname = usePathname();
const filePath = useMemo<string>(() => {
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, "/");
@@ -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";
+1 -2
View File
@@ -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";
-1
View File
@@ -1,5 +1,4 @@
import { NextRequest, NextResponse } from "next/server";
import { CheckPassword, CheckPaths, GetFile } from "~/app/actions";
import { decryptData } from "~/utils/encryptionHelper/hash";
+11 -7
View File
@@ -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;