diff --git a/src/app/api/getPassword/route.ts b/src/app/api/getPassword/route.ts index 432e023..d3a1afa 100644 --- a/src/app/api/getPassword/route.ts +++ b/src/app/api/getPassword/route.ts @@ -47,6 +47,7 @@ export async function GET(request: NextRequest) { { fileId: path.passwordId as string, alt: "media", + supportsAllDrives: gIndexConfig.apiConfig.isTeamDrive, }, { responseType: "text" }, ) diff --git a/src/app/api/search/redirect/[encryptedId]/route.ts b/src/app/api/search/redirect/[encryptedId]/route.ts index c33e76a..40bc12d 100644 --- a/src/app/api/search/redirect/[encryptedId]/route.ts +++ b/src/app/api/search/redirect/[encryptedId]/route.ts @@ -20,6 +20,7 @@ export async function GET(request: NextRequest, { params }: { params: { encrypte const fileContent = await gdrive.files.get({ fileId: lastId, fields: "id, name, mimeType, parents", + supportsAllDrives: gIndexConfig.apiConfig.isTeamDrive, }); if (fileContent) { path.push(fileContent.data.name as string); @@ -29,6 +30,7 @@ export async function GET(request: NextRequest, { params }: { params: { encrypte const folderContent = await gdrive.files.get({ fileId: lastId, fields: "id, name, mimeType, parents", + supportsAllDrives: gIndexConfig.apiConfig.isTeamDrive, }); if (folderContent.data.id === gIndexConfig.apiConfig.rootFolder) { lastId = ""; diff --git a/src/app/api/search/route.ts b/src/app/api/search/route.ts index 6c1f365..2b448ba 100644 --- a/src/app/api/search/route.ts +++ b/src/app/api/search/route.ts @@ -5,7 +5,6 @@ import getSearchParams from "utils/apiHelper/getSearchParams"; import { encryptData } from "utils/encryptionHelper/hash"; import ExtendedError from "utils/extendedError"; import { gdriveFilesList } from "utils/gdrive"; -import gdrive from "utils/gdriveInstance"; import { IGDriveFiles } from "types/api/files"; import { APISearchResponse, ErrorResponse } from "types/api/response"; diff --git a/src/config/gIndex.config.ts b/src/config/gIndex.config.ts index 774bfa1..f077f5c 100644 --- a/src/config/gIndex.config.ts +++ b/src/config/gIndex.config.ts @@ -39,7 +39,7 @@ const config: gIndexConfig = { * You need to create a new folder and share it with the service account * Then, copy the folder id and paste it here */ - rootFolder: "", + rootFolder: "1KgPV6QB1GYT8fmn2uTfbtr9rDXqcRR0j", isTeamDrive: false, // Set this to true if you're using Team Drive defaultQuery: ["trashed = false", "(not mimeType contains 'google-apps' or mimeType contains 'folder')"], defaultField: diff --git a/src/pages/[...path]/index.tsx b/src/pages/[...path]/index.tsx index 1857586..9a3a67d 100644 --- a/src/pages/[...path]/index.tsx +++ b/src/pages/[...path]/index.tsx @@ -197,7 +197,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { const fetchRootId = gdrive.files.get({ fileId: gIndexConfig.apiConfig.rootFolder, fields: "id", - supportsAllDrives: true, + supportsAllDrives: gIndexConfig.apiConfig.isTeamDrive, }); const fetchPathId = path.map(async (path) => { const query = ["trashed = false", `name = '${path}'`];