This commit is contained in:
WJQSERVER 2024-10-08 05:28:56 +08:00
parent f5d7d0994e
commit dc8f4a28e9
9 changed files with 112 additions and 13 deletions

View file

@ -55,6 +55,15 @@ func NoRouteHandler(cfg *config.Config) gin.HandlerFunc {
logw("Blacklist Check > Username: %s, Repo: %s", username, repo)
fullrepo := fmt.Sprintf("%s/%s", username, repo)
// 白名单检查
whitelistpass := auth.CheckWhitelist(fullrepo)
if !whitelistpass {
errMsg := fmt.Sprintf("Whitelist Blocked repo: %s", fullrepo)
c.JSON(http.StatusForbidden, gin.H{"error": errMsg})
logw(errMsg)
return
}
// 黑名单检查
blacklistpass := auth.CheckBlacklist(fullrepo)
if blacklistpass {