Merge pull request #909 from cmliu/beta2.0

fix: 向下兼容UUID路径跳转登录页面
This commit is contained in:
CMLiussss
2026-01-12 23:57:06 +08:00
committed by GitHub

View File

@@ -130,7 +130,7 @@ export default {
} else if (newConfig.AccountID && newConfig.APIToken) { } else if (newConfig.AccountID && newConfig.APIToken) {
CF_JSON.AccountID = newConfig.AccountID; CF_JSON.AccountID = newConfig.AccountID;
CF_JSON.APIToken = newConfig.APIToken; CF_JSON.APIToken = newConfig.APIToken;
} else if (newConfig.UsageAPI){ } else if (newConfig.UsageAPI) {
CF_JSON.UsageAPI = newConfig.UsageAPI; CF_JSON.UsageAPI = newConfig.UsageAPI;
} else { } else {
return new Response(JSON.stringify({ error: '配置不完整' }), { status: 400, headers: { 'Content-Type': 'application/json;charset=utf-8' } }); return new Response(JSON.stringify({ error: '配置不完整' }), { status: 400, headers: { 'Content-Type': 'application/json;charset=utf-8' } });
@@ -184,7 +184,7 @@ export default {
ctx.waitUntil(请求日志记录(env, request, 访问IP, 'Admin_Login', config_JSON)); ctx.waitUntil(请求日志记录(env, request, 访问IP, 'Admin_Login', config_JSON));
return fetch(Pages静态页面 + '/admin'); return fetch(Pages静态页面 + '/admin');
} else if (访问路径 === 'logout') {//清除cookie并跳转到登录页面 } else if (访问路径 === 'logout' || uuidRegex.test(访问路径)) {//清除cookie并跳转到登录页面
const 响应 = new Response('重定向中...', { status: 302, headers: { 'Location': '/login' } }); const 响应 = new Response('重定向中...', { status: 302, headers: { 'Location': '/login' } });
响应.headers.set('Set-Cookie', 'auth=; Path=/; Max-Age=0; HttpOnly'); 响应.headers.set('Set-Cookie', 'auth=; Path=/; Max-Age=0; HttpOnly');
return 响应; return 响应;