mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 00:01:10 +08:00
test
This commit is contained in:
parent
b9a7f30705
commit
57f67278a3
5 changed files with 23 additions and 40 deletions
23
auth/auth.go
23
auth/auth.go
|
|
@ -33,26 +33,3 @@ func AuthHandler(c *gin.Context, cfg *config.Config) bool {
|
|||
|
||||
return isValid
|
||||
}
|
||||
|
||||
func IsBlacklisted(username, repo string, blacklist map[string][]string, enabled bool) bool {
|
||||
if !enabled {
|
||||
return false
|
||||
}
|
||||
|
||||
// 检查 blacklist 是否为 nil
|
||||
if blacklist == nil {
|
||||
// 可以选择记录日志或返回 false
|
||||
logw("Warning: Blacklist map is nil")
|
||||
return false
|
||||
}
|
||||
|
||||
if repos, ok := blacklist[username]; ok {
|
||||
for _, blacklistedRepo := range repos {
|
||||
if blacklistedRepo == repo {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
10
auth/blacklist.go
Normal file
10
auth/blacklist.go
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
package auth
|
||||
|
||||
func CheckBlacklist(fullrepo string) bool {
|
||||
if fullrepo == "test/test1" {
|
||||
logw("%s in blacklist", fullrepo)
|
||||
return true
|
||||
}
|
||||
logw("%s not in blacklist", fullrepo)
|
||||
return false
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue