Replace cookie name with the one in constant

This commit is contained in:
mbaharip
2023-05-25 23:17:39 +07:00
parent 75929d57fa
commit 020d6a7e76
2 changed files with 9 additions and 5 deletions
@@ -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(
+4 -2
View File
@@ -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(