mirror of
https://github.com/jackhh66/ChatGPT_Web_accessToken.git
synced 2026-12-03 21:39:32 +00:00
perf: 优化部份判断
This commit is contained in:
1 parent
b3cfe7a976
commit
2ad7567548
5 files changed
+63
-45
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import { isNotEmptyString } from '../utils/is'
|
||||
|
||||
const auth = async (req, res, next) => {
|
||||
const AUTH_SECRET_KEY = process.env.AUTH_SECRET_KEY
|
||||
if (typeof AUTH_SECRET_KEY === 'string' && AUTH_SECRET_KEY.length > 0) {
|
||||
if (isNotEmptyString(AUTH_SECRET_KEY)) {
|
||||
try {
|
||||
const Authorization = req.header('Authorization')
|
||||
if (!Authorization || Authorization.replace('Bearer ', '').trim() !== AUTH_SECRET_KEY.trim())
|
||||
|
||||
Reference in new issue
Block a user