#835: Realtime webhooks

This commit is contained in:
Unknwon 2015-07-25 21:32:04 +08:00
parent 2b1442f3df
commit fa298a2c30
13 changed files with 140 additions and 69 deletions

View file

@ -16,6 +16,7 @@ import (
"github.com/codegangsta/cli"
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/httplib"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/setting"
"github.com/gogits/gogs/modules/uuid"
@ -193,6 +194,12 @@ func runServ(c *cli.Context) {
}
}
// Send deliver hook request.
resp, err := httplib.Head(setting.AppUrl + setting.AppSubUrl + repoUserName + "/" + repoName + "/hooks/trigger").Response()
if err == nil {
resp.Body.Close()
}
// Update key activity.
key, err := models.GetPublicKeyById(keyId)
if err != nil {

View file

@ -451,6 +451,7 @@ func runWeb(ctx *cli.Context) {
m.Get("/archive/*", repo.Download)
m.Get("/pulls2/", repo.PullRequest2)
m.Get("/milestone2/", repo.Milestones2)
m.Head("/hooks/trigger", repo.TriggerHook)
m.Group("", func() {
m.Get("/src/*", repo.Home)