mirror of
https://github.com/Nezumi-2711/next-gdrive-index.git
synced 2026-09-22 20:01:36 +00:00
Replace cookie name with the one in constant
This commit is contained in:
@@ -146,7 +146,9 @@ export async function GET(
|
||||
);
|
||||
const nearestProtectedFolder =
|
||||
protectedFolder[protectedFolder.length - 1] ?? null;
|
||||
const masterKey = request.headers.get("x-gdrive-key");
|
||||
const masterKey = request.headers.get(
|
||||
Constant.cookieMaster,
|
||||
);
|
||||
const validMasterKey = passwordHash.verify(
|
||||
masterKey || "",
|
||||
apiConfig.masterKey,
|
||||
@@ -166,7 +168,7 @@ export async function GET(
|
||||
);
|
||||
|
||||
const userPassword = cookies().get(
|
||||
`next-gdrive-password`,
|
||||
Constant.cookiePassword,
|
||||
)?.value;
|
||||
if (!userPassword) {
|
||||
throw new ExtendedError(
|
||||
@@ -212,7 +214,7 @@ export async function GET(
|
||||
!validMasterKey
|
||||
) {
|
||||
const userPassword = cookies().get(
|
||||
`next-gdrive-password`,
|
||||
Constant.cookiePassword,
|
||||
)?.value;
|
||||
if (!userPassword) {
|
||||
throw new ExtendedError(
|
||||
|
||||
@@ -16,7 +16,9 @@ export async function GET(request: NextRequest) {
|
||||
const _start = Date.now();
|
||||
|
||||
try {
|
||||
const masterKey = request.headers.get("x-gdrive-key");
|
||||
const masterKey = request.headers.get(
|
||||
Constant.cookieMaster,
|
||||
);
|
||||
const validMasterKey = passwordHash.verify(
|
||||
masterKey || "",
|
||||
apiConfig.masterKey,
|
||||
@@ -24,7 +26,7 @@ export async function GET(request: NextRequest) {
|
||||
|
||||
if (siteConfig.privateIndex && !validMasterKey) {
|
||||
const userPassword = cookies().get(
|
||||
`next-gdrive-password`,
|
||||
Constant.cookiePassword,
|
||||
)?.value;
|
||||
if (!userPassword) {
|
||||
throw new ExtendedError(
|
||||
|
||||
Reference in New Issue
Block a user