update
This commit is contained in:
parent
d4e7f83131
commit
cfaf82def3
12 changed files with 232 additions and 10 deletions
12
api/auth.go
12
api/auth.go
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue