This commit is contained in:
WJQSERVER 2024-10-06 00:22:42 +08:00
parent b9a7f30705
commit 57f67278a3
5 changed files with 23 additions and 40 deletions

View file

@ -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
}