mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-10 03:56:37 +08:00
鉴权
This commit is contained in:
parent
8ec37bc7f1
commit
8c4669af3b
@ -10,6 +10,7 @@ export async function requestOpenai(req: NextRequest) {
|
|||||||
const openaiPath = req.headers.get("path");
|
const openaiPath = req.headers.get("path");
|
||||||
|
|
||||||
console.log("[Proxy] ", openaiPath);
|
console.log("[Proxy] ", openaiPath);
|
||||||
|
console.log("[apiKey] ", apiKey);
|
||||||
|
|
||||||
return fetch(`${PROTOCOL}://${BASE_URL}/${openaiPath}`, {
|
return fetch(`${PROTOCOL}://${BASE_URL}/${openaiPath}`, {
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -3,7 +3,8 @@ import { isMobileScreen } from "../utils";
|
|||||||
const cn = {
|
const cn = {
|
||||||
WIP: "该功能仍在开发中……",
|
WIP: "该功能仍在开发中……",
|
||||||
Error: {
|
Error: {
|
||||||
Unauthorized: "现在是未授权状态,请在设置页输入访问密码。",
|
Unauthorized:
|
||||||
|
"现在是未授权状态,\n 关注微信公众号【coder思维】回复关键词:`ai` \n 获取授权链接",
|
||||||
},
|
},
|
||||||
ChatItem: {
|
ChatItem: {
|
||||||
ChatItemCount: (count: number) => `${count} 条对话`,
|
ChatItemCount: (count: number) => `${count} 条对话`,
|
||||||
|
@ -15,7 +15,7 @@ export function middleware(req: NextRequest) {
|
|||||||
console.log("[Auth] got access code:", accessCode);
|
console.log("[Auth] got access code:", accessCode);
|
||||||
console.log("[Auth] hashed access code:", hashedCode);
|
console.log("[Auth] hashed access code:", hashedCode);
|
||||||
|
|
||||||
if (ACCESS_CODES.size > 0 && !ACCESS_CODES.has(hashedCode) && !token) {
|
if (!accessCode) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
error: true,
|
error: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user