mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 00:01:10 +08:00
25w16c
This commit is contained in:
parent
e2faa497ab
commit
498266e08e
12 changed files with 207 additions and 166 deletions
25
main.go
25
main.go
|
|
@ -12,7 +12,6 @@ import (
|
|||
"ghproxy/api"
|
||||
"ghproxy/auth"
|
||||
"ghproxy/config"
|
||||
"ghproxy/gitclone"
|
||||
"ghproxy/middleware/loggin"
|
||||
"ghproxy/middleware/timing"
|
||||
"ghproxy/proxy"
|
||||
|
|
@ -225,23 +224,6 @@ func init() {
|
|||
|
||||
setupPages(cfg, router)
|
||||
|
||||
if cfg.GitClone.Mode == "cache" {
|
||||
router.GET("/github.com/:username/:repo/info/refs", gitclone.HttpInfoRefs(cfg))
|
||||
//router.GET("/https://github.com/:username/:repo/info/refs", gitclone.HttpInfoRefs(cfg))
|
||||
|
||||
router.POST("/github.com/:username/:repo/git-upload-pack", gitclone.HttpGitUploadPack(cfg))
|
||||
//router.POST("/https://github.com/:username/:repo/git-upload-pack", gitclone.HttpGitUploadPack(cfg))
|
||||
} else {
|
||||
// 3. GitHub Info/Git- - Use distinct path segments for type (or combine under a common prefix)
|
||||
|
||||
router.GET("/github.com/:username/:repo/info/*filepath", func(c *gin.Context) { // Distinct path for info
|
||||
proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c)
|
||||
})
|
||||
router.GET("/github.com/:username/:repo/git-*filepath", func(c *gin.Context) { // Distinct path for git-* (or a more specific prefix)
|
||||
proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c)
|
||||
})
|
||||
}
|
||||
|
||||
// 1. GitHub Releases/Archive - Use distinct path segments for type
|
||||
router.GET("/github.com/:username/:repo/releases/*filepath", func(c *gin.Context) { // Distinct path for releases
|
||||
proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c)
|
||||
|
|
@ -260,6 +242,13 @@ func init() {
|
|||
proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c)
|
||||
})
|
||||
|
||||
router.GET("/github.com/:username/:repo/info/*filepath", func(c *gin.Context) { // Distinct path for info
|
||||
proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c)
|
||||
})
|
||||
router.GET("/github.com/:username/:repo/git-upload-pack", func(c *gin.Context) {
|
||||
proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c)
|
||||
})
|
||||
|
||||
// 4. Raw GitHubusercontent - Keep as is (assuming it's distinct enough)
|
||||
router.GET("/raw.githubusercontent.com/:username/:repo/*filepath", func(c *gin.Context) {
|
||||
proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue