mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 00:01:10 +08:00
4.1.1
This commit is contained in:
parent
e629b5db47
commit
933aeee518
6 changed files with 21 additions and 19 deletions
21
main.go
21
main.go
|
|
@ -414,16 +414,21 @@ func main() {
|
|||
proxy.RoutingHandler(cfg)(c)
|
||||
})
|
||||
|
||||
r.GET("/v2/", r.UseIf(cfg.Docker.Auth, bauth.BasicAuthForStatic(cfg.Docker.Credentials, "GHProxy Docker Proxy")), func(c *touka.Context) {
|
||||
emptyJSON := "{}"
|
||||
c.Header("Content-Type", "application/json")
|
||||
c.Header("Content-Length", fmt.Sprint(len(emptyJSON)))
|
||||
r.GET("/v2/",
|
||||
r.UseIf(cfg.Docker.Auth, func() touka.HandlerFunc {
|
||||
return bauth.BasicAuthForStatic(cfg.Docker.Credentials, "GHProxy Docker Proxy")
|
||||
}),
|
||||
func(c *touka.Context) {
|
||||
emptyJSON := "{}"
|
||||
c.Header("Content-Type", "application/json")
|
||||
c.Header("Content-Length", fmt.Sprint(len(emptyJSON)))
|
||||
|
||||
c.Header("Docker-Distribution-API-Version", "registry/2.0")
|
||||
c.Header("Docker-Distribution-API-Version", "registry/2.0")
|
||||
|
||||
c.Status(200)
|
||||
c.Writer.Write([]byte(emptyJSON))
|
||||
})
|
||||
c.Status(200)
|
||||
c.Writer.Write([]byte(emptyJSON))
|
||||
},
|
||||
)
|
||||
|
||||
r.GET("/v2", func(c *touka.Context) {
|
||||
// 重定向到 /v2/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue