mirror of
https://github.com/go-gitea/gitea.git
synced 2024-09-05 23:34:19 -04:00
fix private repo cannot trigger hook by SSH
This commit is contained in:
parent
45adb9b7a3
commit
3d0583df0f
@ -461,7 +461,6 @@ func runWeb(ctx *cli.Context) {
|
|||||||
m.Get("/branches", repo.Branches)
|
m.Get("/branches", repo.Branches)
|
||||||
m.Get("/archive/*", repo.Download)
|
m.Get("/archive/*", repo.Download)
|
||||||
m.Get("/pulls2/", repo.PullRequest2)
|
m.Get("/pulls2/", repo.PullRequest2)
|
||||||
m.Head("/hooks/trigger", repo.TriggerHook)
|
|
||||||
|
|
||||||
m.Group("", func() {
|
m.Group("", func() {
|
||||||
m.Get("/src/*", repo.Home)
|
m.Get("/src/*", repo.Home)
|
||||||
@ -479,7 +478,10 @@ func runWeb(ctx *cli.Context) {
|
|||||||
m.Get(".git", repo.Home)
|
m.Get(".git", repo.Home)
|
||||||
}, ignSignIn, middleware.RepoAssignment(true, true), middleware.RepoRef())
|
}, ignSignIn, middleware.RepoAssignment(true, true), middleware.RepoRef())
|
||||||
|
|
||||||
m.Any("/:reponame/*", ignSignInAndCsrf, repo.Http)
|
m.Group("/:reponame", func() {
|
||||||
|
m.Any("/*", ignSignInAndCsrf, repo.Http)
|
||||||
|
m.Head("/hooks/trigger", repo.TriggerHook)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// robots.txt
|
// robots.txt
|
||||||
|
2
gogs.go
2
gogs.go
@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.6.4.0806 Beta"
|
const APP_VER = "0.6.4.0808 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
@ -586,7 +586,26 @@ func getOrgRepoCtx(ctx *middleware.Context) (*OrgRepoCtx, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TriggerHook(ctx *middleware.Context) {
|
func TriggerHook(ctx *middleware.Context) {
|
||||||
models.HookQueue.AddRepoID(ctx.Repo.Repository.Id)
|
u, err := models.GetUserByName(ctx.Params(":username"))
|
||||||
|
if err != nil {
|
||||||
|
if models.IsErrUserNotExist(err) {
|
||||||
|
ctx.Handle(404, "GetUserByName", err)
|
||||||
|
} else {
|
||||||
|
ctx.Handle(500, "GetUserByName", err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
repo, err := models.GetRepositoryByName(u.Id, ctx.Params(":reponame"))
|
||||||
|
if err != nil {
|
||||||
|
if models.IsErrRepoNotExist(err) {
|
||||||
|
ctx.Handle(404, "GetRepositoryByName", err)
|
||||||
|
} else {
|
||||||
|
ctx.Handle(500, "GetRepositoryByName", err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
models.HookQueue.AddRepoID(repo.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GitHooks(ctx *middleware.Context) {
|
func GitHooks(ctx *middleware.Context) {
|
||||||
|
@ -1 +1 @@
|
|||||||
0.6.4.0806 Beta
|
0.6.4.0808 Beta
|
Loading…
Reference in New Issue
Block a user