mirror of
https://github.com/Nezumi-2711/next-gdrive-index.git
synced 2026-09-22 13:38:38 +00:00
Remove /e prefix on file
This commit is contained in:
@@ -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, "/");
|
||||
|
||||
|
||||
@@ -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,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,5 +1,4 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
import { CheckPassword, CheckPaths, GetFile } from "~/app/actions";
|
||||
|
||||
import { decryptData } from "~/utils/encryptionHelper/hash";
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user