fix: 添加身份验证检查,未登录用户重定向至根目录
This commit is contained in:
@@ -8,6 +8,11 @@ localProxy.initFromAssistantConfig(assistantConfig);
|
||||
|
||||
export const proxyRoute = async (req: http.IncomingMessage, res: http.ServerResponse) => {
|
||||
const _assistantConfig = assistantConfig.getCacheAssistantConfig();
|
||||
const auth = _assistantConfig?.auth;
|
||||
if (!auth.username) {
|
||||
res.writeHead(302, { Location: `/root/cli/setting/` });
|
||||
return res.end();
|
||||
}
|
||||
const url = new URL(req.url, 'http://localhost');
|
||||
const pathname = decodeURIComponent(url.pathname);
|
||||
if (pathname === '/' && _assistantConfig?.home) {
|
||||
|
||||
Reference in New Issue
Block a user