github-actions[bot] commited on
Commit ·
6d5559e
1
Parent(s): e9894d4
Update from GitHub Actions
Browse files- functions/utils/cors.ts +1 -1
- functions/utils/jwt.ts +1 -0
- index.ts +2 -2
functions/utils/cors.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
export const CORS_HEADERS = {
|
| 5 |
'Access-Control-Allow-Origin': '*', // 允许所有来源
|
| 6 |
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', // 允许的HTTP方法
|
| 7 |
-
'Access-Control-Allow-Headers': '
|
| 8 |
'Access-Control-Max-Age': '86400', // 预检请求的有效期
|
| 9 |
};
|
| 10 |
|
|
|
|
| 4 |
export const CORS_HEADERS = {
|
| 5 |
'Access-Control-Allow-Origin': '*', // 允许所有来源
|
| 6 |
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', // 允许的HTTP方法
|
| 7 |
+
'Access-Control-Allow-Headers': '*', // 允许的请求头
|
| 8 |
'Access-Control-Max-Age': '86400', // 预检请求的有效期
|
| 9 |
};
|
| 10 |
|
functions/utils/jwt.ts
CHANGED
|
@@ -31,6 +31,7 @@ export async function generateToken(username: string, secret: string): Promise<s
|
|
| 31 |
* @returns 验证是否通过
|
| 32 |
*/
|
| 33 |
export async function verifyToken(request: Request, secret: string): Promise<boolean> {
|
|
|
|
| 34 |
let authHeader = request.headers.get('Authorization');
|
| 35 |
if (!authHeader) {
|
| 36 |
authHeader = request.headers.get('x-app-token');
|
|
|
|
| 31 |
* @returns 验证是否通过
|
| 32 |
*/
|
| 33 |
export async function verifyToken(request: Request, secret: string): Promise<boolean> {
|
| 34 |
+
console.log(request.headers)
|
| 35 |
let authHeader = request.headers.get('Authorization');
|
| 36 |
if (!authHeader) {
|
| 37 |
authHeader = request.headers.get('x-app-token');
|
index.ts
CHANGED
|
@@ -37,8 +37,8 @@ app.use(trimTrailingSlash());
|
|
| 37 |
app.use('*', cors({
|
| 38 |
origin: '*',
|
| 39 |
allowMethods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
|
| 40 |
-
allowHeaders: ['
|
| 41 |
-
exposeHeaders: ['
|
| 42 |
credentials: true,
|
| 43 |
}));
|
| 44 |
|
|
|
|
| 37 |
app.use('*', cors({
|
| 38 |
origin: '*',
|
| 39 |
allowMethods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
|
| 40 |
+
allowHeaders: ['*'], // Allow all headers
|
| 41 |
+
exposeHeaders: ['*'], // Expose all headers
|
| 42 |
credentials: true,
|
| 43 |
}));
|
| 44 |
|