Skip to content

Commit 40cdb44

Browse files
committed
fix: 修复UsageAPI配置逻辑,确保正确处理新配置并优化登出路径判断
1 parent 676b188 commit 40cdb44

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

_worker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export default {
130130
} else if (newConfig.AccountID && newConfig.APIToken) {
131131
CF_JSON.AccountID = newConfig.AccountID;
132132
CF_JSON.APIToken = newConfig.APIToken;
133-
} else if (newConfig.UsageAPI){
133+
} else if (newConfig.UsageAPI) {
134134
CF_JSON.UsageAPI = newConfig.UsageAPI;
135135
} else {
136136
return new Response(JSON.stringify({ error: '配置不完整' }), { status: 400, headers: { 'Content-Type': 'application/json;charset=utf-8' } });
@@ -184,7 +184,7 @@ export default {
184184

185185
ctx.waitUntil(请求日志记录(env, request, 访问IP, 'Admin_Login', config_JSON));
186186
return fetch(Pages静态页面 + '/admin');
187-
} else if (访问路径 === 'logout') {//清除cookie并跳转到登录页面
187+
} else if (访问路径 === 'logout' || uuidRegex.test(访问路径)) {//清除cookie并跳转到登录页面
188188
const 响应 = new Response('重定向中...', { status: 302, headers: { 'Location': '/login' } });
189189
响应.headers.set('Set-Cookie', 'auth=; Path=/; Max-Age=0; HttpOnly');
190190
return 响应;

0 commit comments

Comments
 (0)