This commit is contained in:
wjqserver 2025-06-05 20:14:58 +08:00
parent 1370617f5b
commit 6be6e1ba2c
14 changed files with 49 additions and 60 deletions

View file

@ -35,35 +35,6 @@ func InitWeakCache() *weakcache.Cache[string] {
return cache
}
/*
func GhcrRouting(cfg *config.Config) app.HandlerFunc {
return func(ctx context.Context, c *app.RequestContext) {
charToFind := '.'
reqTarget := c.Param("target")
path := ""
target := ""
if strings.ContainsRune(reqTarget, charToFind) {
path = c.Param("filepath")
if reqTarget == "docker.io" {
target = dockerhubTarget
} else if reqTarget == "ghcr.io" {
target = ghcrTarget
} else {
target = reqTarget
}
} else {
path = string(c.Request.RequestURI())
}
GhcrToTarget(ctx, c, cfg, target, path, nil)
}
}
*/
func GhcrWithImageRouting(cfg *config.Config) app.HandlerFunc {
return func(ctx context.Context, c *app.RequestContext) {

View file

@ -10,7 +10,9 @@ import (
)
func listCheck(cfg *config.Config, c *app.RequestContext, user string, repo string, rawPath string) bool {
if cfg.Auth.ForceAllowApi && cfg.Auth.ForceAllowApiPassList {
return false
}
// 白名单检查
if cfg.Whitelist.Enabled {
whitelist := auth.CheckWhitelist(user, repo)