Update index.js

This commit is contained in:
yutian81
2025-11-19 13:04:09 +08:00
committed by GitHub
parent 7a6f9c6c20
commit d84bb7fd90

View File

@@ -53,7 +53,8 @@ export default {
return handleLogin(request, env);
}
const config = getConfig(env);
const config = getConfig(env); // 加载环境变量
// 定义需要豁免认证的路径
const authExemptPaths = ['/api/config', '/cron', '/login'];
const isExempt = authExemptPaths.includes(pathname);
@@ -77,14 +78,7 @@ export default {
// 处理根目录请求
if (pathname === '/') {
return new Response(HTML_TEMPLATE(
config.siteName,
config.siteIcon,
config.bgimgURL,
config.githubURL,
config.blogURL,
config.blogName
), {
return new Response(HTML_TEMPLATE(config.siteName, config.siteIcon, config.bgimgURL, config.githubURL, config.blogURL, config.blogName), {
headers: {
'Content-Type': 'text/html;charset=UTF-8',
'Cache-Control': 'no-cache, no-store, must-revalidate'