mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-09 11:36:38 +08:00
添加middleware
This commit is contained in:
parent
8239551e8e
commit
202fddd6e8
@ -31,12 +31,7 @@ export function middleware(req: NextRequest) {
|
||||
const [user, pwd] = atob(authValue).split(':')
|
||||
|
||||
if (user === '4dmin' && pwd === 'testpwd123') {
|
||||
return NextResponse.next()
|
||||
}
|
||||
}else{
|
||||
url.pathname = '/api/auth'
|
||||
return NextResponse.rewrite(url)
|
||||
}
|
||||
// return NextResponse.next()
|
||||
console.log("[Auth] allowed hashed codes: ", [...serverConfig.codes]);
|
||||
console.log("[Auth] got access code:", accessCode);
|
||||
console.log("[Auth] hashed access code:", hashedCode);
|
||||
@ -82,4 +77,9 @@ export function middleware(req: NextRequest) {
|
||||
headers: req.headers,
|
||||
},
|
||||
});
|
||||
}
|
||||
}else{
|
||||
url.pathname = '/api/auth'
|
||||
return NextResponse.rewrite(url)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user