aboutsummaryrefslogtreecommitdiffstats
path: root/routers/private/internal.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-12-26 11:29:45 +0000
committerLauris BH <lauris@nix.lv>2019-12-26 13:29:45 +0200
commit7bfb83e0642530183cc15f3c9208d95f88fdc79a (patch)
tree7e3670ea97ac6e9304a8df5488fed6839d1f3dc4 /routers/private/internal.go
parent114d474f02f8e4148b9fd65c8f2bc7b47f924c17 (diff)
downloadgitea-7bfb83e0642530183cc15f3c9208d95f88fdc79a.tar.gz
gitea-7bfb83e0642530183cc15f3c9208d95f88fdc79a.zip
Batch hook pre- and post-receive calls (#8602)
* make notifyWatchers work on multiple actions * more efficient multiple notifyWatchers * Make CommitRepoAction take advantage of multiple actions * Batch post and pre-receive results * Set batch to 30 * Auto adjust timeout & add logging * adjust processing message * Add some messages to pre-receive * Make any non-200 status code from pre-receive an error * Add missing hookPrintResults * Remove shortcut for single action * mistaken merge fix * oops * Move master branch to the front * If repo was empty and the master branch is pushed ensure that that is set as the default branch * fixup * fixup * Missed HookOptions in setdefaultbranch * Batch PushUpdateAddTag and PushUpdateDelTag Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers/private/internal.go')
-rw-r--r--routers/private/internal.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/routers/private/internal.go b/routers/private/internal.go
index dafcd88822..913a52e404 100644
--- a/routers/private/internal.go
+++ b/routers/private/internal.go
@@ -10,8 +10,10 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/private"
"code.gitea.io/gitea/modules/setting"
+ "gitea.com/macaron/binding"
"gitea.com/macaron/macaron"
)
@@ -77,11 +79,14 @@ func CheckUnitUser(ctx *macaron.Context) {
// RegisterRoutes registers all internal APIs routes to web application.
// These APIs will be invoked by internal commands for example `gitea serv` and etc.
func RegisterRoutes(m *macaron.Macaron) {
+ bind := binding.Bind
+
m.Group("/", func() {
m.Post("/ssh/authorized_keys", AuthorizedPublicKeyByContent)
m.Post("/ssh/:id/update/:repoid", UpdatePublicKeyInRepo)
- m.Get("/hook/pre-receive/:owner/:repo", HookPreReceive)
- m.Get("/hook/post-receive/:owner/:repo", HookPostReceive)
+ m.Post("/hook/pre-receive/:owner/:repo", bind(private.HookOptions{}), HookPreReceive)
+ m.Post("/hook/post-receive/:owner/:repo", bind(private.HookOptions{}), HookPostReceive)
+ m.Post("/hook/set-default-branch/:owner/:repo/:branch", SetDefaultBranch)
m.Get("/serv/none/:keyid", ServNoCommand)
m.Get("/serv/command/:keyid/:owner/:repo", ServCommand)
}, CheckInternalToken)