feat: 更新authFilter以允许对/root路径的公共访问并修改相关消息
This commit is contained in:
@@ -48,10 +48,10 @@ const authFilter = async (req: http.IncomingMessage, res: http.ServerResponse) =
|
||||
return { code: 200, message: '允许访问首页' };
|
||||
}
|
||||
// 放开api, 以 /api, /v1, /client, /serve 开头的请求
|
||||
const openApiPaths = ['/api', '/v1', '/client', '/serve', '/proxy'];
|
||||
const openApiPaths = ['/api', '/v1', '/client', '/serve', '/proxy', '/root'];
|
||||
for (const openPath of openApiPaths) {
|
||||
if (pathname.startsWith(openPath)) {
|
||||
return { code: 200, message: '允许访问API' };
|
||||
return { code: 200, message: '允许公共访问模块' };
|
||||
}
|
||||
}
|
||||
if (share === 'public') {
|
||||
@@ -65,7 +65,6 @@ const authFilter = async (req: http.IncomingMessage, res: http.ServerResponse) =
|
||||
return { code: 500, message: '未登录' };
|
||||
}
|
||||
const tokenUser = await getTokenUserCache(token);
|
||||
console.log('authFilter tokenUser', tokenUser, token);
|
||||
if (share === 'protected' && tokenUser?.code === 200) {
|
||||
return { code: 200, message: '受保护模式已登录允许访问' };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user