mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-09 04:02:41 +08:00
This commit is contained in:
@@ -39,9 +39,22 @@ async function handle(
|
||||
10 * 60 * 1000,
|
||||
);
|
||||
|
||||
const authResult = auth(req);
|
||||
if (authResult.error) {
|
||||
return NextResponse.json(authResult, {
|
||||
status: 401,
|
||||
});
|
||||
}
|
||||
|
||||
const bearToken = req.headers.get("Authorization") ?? "";
|
||||
const token = bearToken.trim().replaceAll("Bearer ", "").trim();
|
||||
|
||||
console.log(
|
||||
bearToken,
|
||||
serverConfig.googleApiKey,
|
||||
token ? token : serverConfig.googleApiKey,
|
||||
);
|
||||
|
||||
const key = token ? token : serverConfig.googleApiKey;
|
||||
if (!key) {
|
||||
return NextResponse.json(
|
||||
|
Reference in New Issue
Block a user