This commit is contained in:
wjqserver 2025-07-01 10:32:26 +08:00
parent d4e7f83131
commit cfaf82def3
12 changed files with 232 additions and 10 deletions

View file

@ -20,6 +20,7 @@ var (
"/v0/api/auth/init": {},
"/init.html": {},
"/favicon.ico": {},
"/v0/api/info": {},
}
prefixMatchPaths = []string{ // 保持前缀匹配,因为数量少
"/js/",
@ -38,17 +39,18 @@ var (
)
func isPassPath(requestPath string) bool {
// 精确匹配
if _, ok := exactMatchPaths[requestPath]; ok {
return true
}
// 前缀匹配
for _, prefix := range prefixMatchPaths {
if strings.HasPrefix(requestPath, prefix) {
return true
}
}
// 精确匹配
if _, ok := exactMatchPaths[requestPath]; ok {
return true
}
return false
}