other: Add root & shared drive id check on dev server

This commit is contained in:
mbaharip
2025-03-10 21:57:09 +07:00
parent 54e8c2a463
commit 7b3b555ad4
+32
View File
@@ -0,0 +1,32 @@
import { NextResponse } from "next/server";
import { encryptionService } from "~/lib/utils.server";
import config from "~/config/gIndex.config";
export const dynamic = "force-dynamic";
export async function GET() {
try {
if (process.env.NODE_ENV !== "development") {
throw new Error("This route is only available in development environment");
}
const rootId = await encryptionService.decrypt(config.apiConfig.rootFolder);
const sharedDriveId = config.apiConfig.sharedDrive
? await encryptionService.decrypt(config.apiConfig.sharedDrive)
: undefined;
return NextResponse.json(
{
rootId,
sharedDriveId,
},
{ status: 200 },
);
} catch (error) {
const e = error as Error;
console.error(e);
return new Response(e.message, { status: 500 });
}
}