mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-02 22:01:44 +02:00
1 parent
f0ee33267c
commit
404867f206
13 files changed
+443
-360
No files matched your search
@@ -5,7 +5,7 @@ Gogs - Go Git Service [
|

|
||||||
|
|
||||||
##### Current version: 0.7.31 Beta
|
##### Current version: 0.7.32 Beta
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -397,6 +397,7 @@ func runWeb(ctx *cli.Context) {
|
|||||||
m.Post("/gogs/new", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksNewPost)
|
m.Post("/gogs/new", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksNewPost)
|
||||||
m.Post("/slack/new", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksNewPost)
|
m.Post("/slack/new", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksNewPost)
|
||||||
m.Get("/:id", repo.WebHooksEdit)
|
m.Get("/:id", repo.WebHooksEdit)
|
||||||
|
m.Post("/:id/test", repo.TestWebhook)
|
||||||
m.Post("/gogs/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
|
m.Post("/gogs/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
|
||||||
m.Post("/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost)
|
m.Post("/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost)
|
||||||
|
|
||||||
|
|||||||
@@ -597,6 +597,9 @@ settings.hooks_desc = Webhooks are much like basic HTTP POST event triggers. Whe
|
|||||||
settings.webhook_deletion = Delete Webhook
|
settings.webhook_deletion = Delete Webhook
|
||||||
settings.webhook_deletion_desc = Delete this webhook will remove its information and all delivery history. Do you want to continue?
|
settings.webhook_deletion_desc = Delete this webhook will remove its information and all delivery history. Do you want to continue?
|
||||||
settings.webhook_deletion_success = Webhook has been deleted successfully!
|
settings.webhook_deletion_success = Webhook has been deleted successfully!
|
||||||
|
settings.webhook.test_delivery = Test Delivery
|
||||||
|
settings.webhook.test_delivery_desc = Send a fake push event delivery to test your webhook settings
|
||||||
|
settings.webhook.test_delivery_success = Test webhook has been added to delivery queue. It may taks few seconds before it shows up in the delivery history.
|
||||||
settings.webhook.request = Request
|
settings.webhook.request = Request
|
||||||
settings.webhook.response = Response
|
settings.webhook.response = Response
|
||||||
settings.webhook.headers = Headers
|
settings.webhook.headers = Headers
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.7.31.1205 Beta"
|
const APP_VER = "0.7.32.1205 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|||||||
+2
-17
@@ -451,24 +451,9 @@ func CommitRepoAction(
|
|||||||
IsPrivate: repo.IsPrivate,
|
IsPrivate: repo.IsPrivate,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return fmt.Errorf("NotifyWatchers: %v", err)
|
return fmt.Errorf("NotifyWatchers: %v", err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repoLink := fmt.Sprintf("%s%s/%s", setting.AppUrl, repoUserName, repoName)
|
payloadRepo := repo.ComposePayload()
|
||||||
payloadRepo := &api.PayloadRepo{
|
|
||||||
ID: repo.ID,
|
|
||||||
Name: repo.LowerName,
|
|
||||||
URL: repoLink,
|
|
||||||
Description: repo.Description,
|
|
||||||
Website: repo.Website,
|
|
||||||
Watchers: repo.NumWatches,
|
|
||||||
Owner: &api.PayloadAuthor{
|
|
||||||
Name: repo.Owner.DisplayName(),
|
|
||||||
Email: repo.Owner.Email,
|
|
||||||
UserName: repo.Owner.Name,
|
|
||||||
},
|
|
||||||
Private: repo.IsPrivate,
|
|
||||||
}
|
|
||||||
|
|
||||||
pusher_email, pusher_name := "", ""
|
pusher_email, pusher_name := "", ""
|
||||||
pusher, err := GetUserByName(userName)
|
pusher, err := GetUserByName(userName)
|
||||||
@@ -494,7 +479,7 @@ func CommitRepoAction(
|
|||||||
commits[i] = &api.PayloadCommit{
|
commits[i] = &api.PayloadCommit{
|
||||||
ID: cmt.Sha1,
|
ID: cmt.Sha1,
|
||||||
Message: cmt.Message,
|
Message: cmt.Message,
|
||||||
URL: fmt.Sprintf("%s/commit/%s", repoLink, cmt.Sha1),
|
URL: fmt.Sprintf("%s/commit/%s", repo.RepoLink(), cmt.Sha1),
|
||||||
Author: &api.PayloadAuthor{
|
Author: &api.PayloadAuthor{
|
||||||
Name: cmt.AuthorName,
|
Name: cmt.AuthorName,
|
||||||
Email: cmt.AuthorEmail,
|
Email: cmt.AuthorEmail,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import (
|
|||||||
"gopkg.in/ini.v1"
|
"gopkg.in/ini.v1"
|
||||||
|
|
||||||
"github.com/gogits/git-shell"
|
"github.com/gogits/git-shell"
|
||||||
|
api "github.com/gogits/go-gogs-client"
|
||||||
|
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
"github.com/gogits/gogs/modules/bindata"
|
"github.com/gogits/gogs/modules/bindata"
|
||||||
@@ -380,6 +381,27 @@ func (repo *Repository) SavePatch(index int64, patch []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ComposePayload composes and returns *api.PayloadRepo corresponding to the repository.
|
||||||
|
func (repo *Repository) ComposePayload() *api.PayloadRepo {
|
||||||
|
cl := repo.CloneLink()
|
||||||
|
return &api.PayloadRepo{
|
||||||
|
ID: repo.ID,
|
||||||
|
Name: repo.LowerName,
|
||||||
|
URL: repo.RepoLink(),
|
||||||
|
SSHURL: cl.SSH,
|
||||||
|
CloneURL: cl.HTTPS,
|
||||||
|
Description: repo.Description,
|
||||||
|
Website: repo.Website,
|
||||||
|
Watchers: repo.NumWatches,
|
||||||
|
Owner: &api.PayloadAuthor{
|
||||||
|
Name: repo.MustOwner().DisplayName(),
|
||||||
|
Email: repo.MustOwner().Email,
|
||||||
|
UserName: repo.MustOwner().Name,
|
||||||
|
},
|
||||||
|
Private: repo.IsPrivate,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func isRepositoryExist(e Engine, u *User, repoName string) (bool, error) {
|
func isRepositoryExist(e Engine, u *User, repoName string) (bool, error) {
|
||||||
has, err := e.Get(&Repository{
|
has, err := e.Get(&Repository{
|
||||||
OwnerID: u.Id,
|
OwnerID: u.Id,
|
||||||
|
|||||||
+6
-6
@@ -335,7 +335,7 @@ func (t *HookTask) AfterSet(colName string, _ xorm.Cell) {
|
|||||||
|
|
||||||
t.ResponseInfo = &HookResponse{}
|
t.ResponseInfo = &HookResponse{}
|
||||||
if err = json.Unmarshal([]byte(t.ResponseContent), t.ResponseInfo); err != nil {
|
if err = json.Unmarshal([]byte(t.ResponseContent), t.ResponseInfo); err != nil {
|
||||||
log.Error(3, "Unmarshal[%d]: %v", t.ID, err)
|
log.Error(3, "Unmarshal [%d]: %v", t.ID, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -343,7 +343,7 @@ func (t *HookTask) AfterSet(colName string, _ xorm.Cell) {
|
|||||||
func (t *HookTask) MarshalJSON(v interface{}) string {
|
func (t *HookTask) MarshalJSON(v interface{}) string {
|
||||||
p, err := json.Marshal(v)
|
p, err := json.Marshal(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(3, "Marshal[%d]: %v", t.ID, err)
|
log.Error(3, "Marshal [%d]: %v", t.ID, err)
|
||||||
}
|
}
|
||||||
return string(p)
|
return string(p)
|
||||||
}
|
}
|
||||||
@@ -590,24 +590,24 @@ func DeliverHooks() {
|
|||||||
// Update hook task status.
|
// Update hook task status.
|
||||||
for _, t := range tasks {
|
for _, t := range tasks {
|
||||||
if err := UpdateHookTask(t); err != nil {
|
if err := UpdateHookTask(t); err != nil {
|
||||||
log.Error(4, "UpdateHookTask(%d): %v", t.ID, err)
|
log.Error(4, "UpdateHookTask [%d]: %v", t.ID, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start listening on new hook requests.
|
// Start listening on new hook requests.
|
||||||
for repoID := range HookQueue.Queue() {
|
for repoID := range HookQueue.Queue() {
|
||||||
log.Trace("DeliverHooks[%v]: processing delivery hooks", repoID)
|
log.Trace("DeliverHooks [%v]: processing delivery hooks", repoID)
|
||||||
HookQueue.Remove(repoID)
|
HookQueue.Remove(repoID)
|
||||||
|
|
||||||
tasks = make([]*HookTask, 0, 5)
|
tasks = make([]*HookTask, 0, 5)
|
||||||
if err := x.Where("repo_id=? AND is_delivered=?", repoID, false).Find(&tasks); err != nil {
|
if err := x.Where("repo_id=? AND is_delivered=?", repoID, false).Find(&tasks); err != nil {
|
||||||
log.Error(4, "Get repository(%d) hook tasks: %v", repoID, err)
|
log.Error(4, "Get repository [%d] hook tasks: %v", repoID, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, t := range tasks {
|
for _, t := range tasks {
|
||||||
t.deliver()
|
t.deliver()
|
||||||
if err := UpdateHookTask(t); err != nil {
|
if err := UpdateHookTask(t); err != nil {
|
||||||
log.Error(4, "UpdateHookTask[%d]: %v", t.ID, err)
|
log.Error(4, "UpdateHookTask [%d]: %v", t.ID, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4364,7 +4364,7 @@ func confLocaleLocale_deDeIni() (*asset, error) {
|
|||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _confLocaleLocale_enUsIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xbc\x7d\xfd\x72\xdc\x46\xae\xef\xff\x7c\x0a\xc6\x5b\x2e\x27\x55\xf2\xa4\x92\x9c\xfb\x51\xa9\x38\xb9\x8a\x1d\x7f\x9c\x63\x59\x3a\x96\xb2\x7b\xf7\xa6\x5c\x13\x6a\x48\x8d\x78\x3c\x43\xce\x92\x1c\xcb\xda\xad\x7d\x83\xfb\x00\xf7\xf9\xee\x93\x5c\xe0\x07\xa0\x1b\x4d\x72\x24\x7b\xcf\xd6\xf5\x1f\x16\xa7\x1b\xfd\x85\x46\xa3\xd1\x68\x00\x5d\xec\x76\xcb\xb2\xea\x57\xf9\x93\xfc\x38\xdf\x15\x75\xb3\xa9\xfa\x3e\xef\xab\xcd\xd5\xe3\xeb\xb6\x1f\xaa\x32\x7f\x51\x0f\xf4\xbb\xfb\x50\xaf\xaa\x2c\xbb\x6e\xb7\x15\x81\xbe\xa4\x3f\x59\x59\xf4\xd7\x97\x6d\xd1\x95\x94\xf0\xcc\xbe\xb3\xea\xe3\x6e\xd3\x76\x0c\xf4\x8b\x7c\x65\xd7\xd5\x66\xc7\x65\xe8\x4f\xd6\xd7\xeb\x66\x59\x37\xf4\xf3\x9c\xbe\xf2\x57\x8d\xa4\xb4\xfb\xc1\x92\x4e\xf7\x83\xa4\xed\x77\x96\xf4\xeb\x2e\xeb\xaa\x75\x4d\xbd\xe9\x28\xe9\xad\x7e\x66\x37\xd5\x65\x5f\x0f\xdc\xd2\x9f\xe4\x2b\xfb\x50\x75\x7d\xdd\x72\xed\x7f\x94\xaf\x6c\x57\xac\x19\xe0\x8c\xfe\x64\x43\xb5\xdd\x6d\x0a\x14\xb8\xd0\xcf\x6c\x53\x34\xeb\xbd\xc0\xbc\xd6\xcf\x6c\xd5\x55\x94\xb5\x6c\xaa\x1b\x4a\x7d\x8a\x1f\x8b\xc5\x22\xdb\x13\x12\x96\xbb\xae\xbd\xaa\x37\xd5\xb2\x68\xca\xe5\x56\x86\xf9\x2b\xa5\xe7\x9a\x9e\x53\x7a\xce\xe9\x18\x42\x55\xd2\x50\x97\x45\xaf\xe3\x20\x5c\xd2\xc8\x8b\x3e\x43\x55\x4d\xb1\xb5\xd2\xfc\x99\x55\xdb\xa2\xde\x30\xd6\xf8\x2f\xf5\xbb\xef\x6f\x5a\xa0\xf6\x4c\x3f\x09\x07\xcb\xe1\x76\x57\x01\x05\x8f\x2f\xe8\x2b\x5b\x15\xbb\x61\x75\x5d\x70\x37\xe5\x2b\x23\xa0\x5d\x4b\xb8\x68\xbb\x5b\xc0\xd9\x8f\xac\xed\xd6\x45\x53\xff\xb5\x18\x04\x3f\xa7\xee\x67\xb6\xad\xbb\xae\x65\xd4\x9e\xe0\x23\xa3\x91\x2f\xb9\x1e\x4a\x79\x43\x48\x70\xb5\x70\xce\xb6\x5e\x77\x82\x45\xce\x3c\xc1\x2f\xae\x85\xf3\xae\xda\xee\xbd\x66\x3c\xe7\xcf\x51\x51\xea\x84\xe6\xa6\xed\x17\x0d\xe1\x5d\x73\x4f\xf0\x23\x01\xe8\xb3\xa2\xdc\x12\x26\x77\x45\x53\x31\x8a\x8e\xf9\x17\xe1\x85\x7e\x65\xc5\x6a\xd5\xee\x9b\x61\xd9\x57\xc3\x50\x37\x6b\xc6\xf5\xb1\x24\xe5\xe7\x9a\x94\xb9\xbc\x90\x76\xdb\xee\xc3\x6c\x52\xfa\x9f\xe9\x67\x7e\x26\x3f\x25\xcf\x15\x42\x66\x28\xc9\x23\xe9\x97\x57\x55\x55\xca\x58\xfa\xfc\x39\x7d\x67\xbb\xfd\x66\x43\x58\xfb\xcb\xbe\xea\x07\x2e\x74\x46\xbf\x69\xfc\xf2\x3b\xab\xfb\x9e\x3e\x28\xf9\x15\x3e\x32\x9a\xba\x66\x85\xc1\x3c\xc5\x47\x96\xfd\xd6\x57\x45\xb7\xba\x7e\x97\xc9\x5f\xf4\x95\x3f\x98\xf4\x0e\x4d\x2a\xd3\x91\xd2\x90\xb4\x60\x0d\x64\xab\xb6\xe4\x1f\x4f\xe9\x0f\x55\x5d\x37\xfd\x50\x6c\x36\xef\x32\xfd\x60\x30\xf9\x92\x09\x18\xea\x01\x58\xd0\xc4\xfc\x7c\xa8\x76\x3d\xcf\x60\xfe\xbc\xee\xfa\xe1\xf1\x50\x13\xad\xbe\xdd\x37\x59\xd9\xae\xde\xd3\x2a\xe0\x15\x8d\x96\x5f\x5d\xe5\x84\xac\x47\xb4\x0e\xba\x7d\xd3\x10\x7a\xf2\x17\x2d\xa1\x8c\x9a\xa9\xa9\xfd\x67\x80\x3e\xca\x77\x9b\xaa\xe8\x09\xa4\x2a\xca\xfc\x87\x22\x1f\x8a\x6e\x5d\x0d\x4f\x1e\x2c\x2f\x69\xf5\xbd\x7f\x90\x5f\x77\xd5\xd5\x93\x07\x0f\xfb\x07\x3f\xbe\xd8\x53\xb1\x4d\xdd\x54\xfd\x0f\x5f\x17\x3f\xe6\xab\x82\x72\x08\x8d\xb7\xf9\x65\x75\xc5\x8b\x8d\xda\xca\x89\xca\x9b\x35\x2f\xb4\xdb\xe1\x9a\x1b\x24\x4a\xa0\x8f\x3e\xe7\x95\xfe\x45\xc6\x13\x40\x9c\x60\x59\x5e\x1a\x57\x43\x87\x90\xdc\xd1\x04\x9c\xdc\x9e\xff\xfb\xeb\xa3\xfc\x8c\x58\xdb\xba\xab\xf0\x4d\xff\x51\x89\xef\x72\x1a\xed\x45\xfd\xec\xe7\x45\x46\x65\x0d\x21\xcf\x8a\xa1\xb8\xe4\xbe\x87\xd9\xe7\x4c\x59\x84\x21\x0f\x4b\x91\x99\x25\x18\x63\x3f\x24\xd3\x32\xb7\x90\xa9\x0e\x5d\xfd\xa1\x8e\x37\xcc\x02\x28\x3d\x60\xf6\x4c\x70\x46\x55\xe5\xaf\xde\xbc\x39\x7d\xf6\x73\x5e\x35\x6b\xc2\x4c\x7e\x53\x0f\xd7\xf9\x7e\xb8\xfa\xef\xcb\x75\xd5\x54\x5d\xb1\x59\xae\x6a\x46\x4a\x47\x04\x9b\x13\x96\x64\x88\x8b\xac\xef\x37\xc4\xa1\x40\x05\xe7\xe7\xaf\xf3\x13\xa6\x84\x5d\x31\x5c\xa3\x23\xc3\x75\xd6\xff\x65\xc3\x88\x0a\x0d\x5e\x5c\x57\x39\x16\x03\x80\xda\xab\x31\x5e\xf2\x52\xfb\xba\xc8\xaa\xae\x5b\x12\x03\x1d\x6e\x19\xcd\x5a\xe7\x21\x68\xa9\x8e\xa8\xbd\x69\x07\x9a\xc6\x1c\xe5\xa4\x8a\xba\xf9\x50\x6c\xea\x92\x90\x1d\x11\x92\x96\x45\x62\xd9\xd2\xbc\x71\x69\xa2\xcc\xf6\x06\x43\x2d\x56\xc4\xff\xfb\xfc\xc1\xe2\x01\x18\xee\x83\xc7\x0f\x16\x59\xd3\x2e\x85\x4b\x30\x6b\x2e\xeb\xbe\xb8\x24\x36\x2d\xdb\x46\x67\x5c\xef\xcf\x4c\x3f\xd2\x15\x85\xc8\x13\x08\xc6\x2d\x6f\x45\xd8\x01\x98\xb8\x0a\xe2\xd7\x60\x36\xca\x66\xfc\xd8\x8d\x27\x85\xf9\x15\xb6\x14\x12\x26\x63\xce\x6c\xc2\x8c\xba\x8e\x77\xbb\x4d\xbd\x92\xa6\x5f\x48\x5e\x24\x34\xde\x98\x15\x29\x1e\x0e\x84\x62\x79\x8e\x5c\xa8\xd7\xcc\xb6\xf2\x84\xcf\xa3\xfc\x75\x45\x2b\xe7\x7a\xbf\x96\xcd\x69\xd3\xee\xcb\x2f\xc0\x50\x6c\xe6\x22\x3f\xc9\xdf\xb6\xd4\x61\x50\x47\x00\x88\x4d\x1c\x13\x63\x60\x59\xa0\xab\xb6\xed\xc0\x88\xd3\x62\x35\x4d\xcf\x4d\x4d\x99\x34\xd2\xbe\xf8\x40\x6c\x71\x68\x65\x49\x96\xb4\xe4\x56\x5c\x31\x71\xb0\x3d\x6d\xe8\xb2\x2c\x88\x8f\xc8\xd2\xb0\xb4\x94\x06\x01\xb5\xdd\xd3\x6a\xba\xa6\xca\x18\xf1\x2c\x90\x50\x95\x73\xfd\xc4\x90\xa8\x1e\xac\x72\x5a\xb9\x2d\x6d\x9e\x3c\xd1\xcf\xf0\xa1\xbf\x7d\xfd\xd4\xab\xe2\xea\x8a\x7a\xd5\xd3\xaa\x78\x99\xaf\x36\x2d\x2d\xa9\x5f\xdf\xbe\xee\x79\xc1\x5c\x2f\x77\x6d\x07\x41\x84\xb2\xce\xe8\x33\xa4\x39\x44\x33\x44\xb3\xdf\x5e\xd2\xaf\x9b\xeb\x9a\x18\x35\xd0\xce\x25\x58\x48\xa2\x54\x6a\x62\xdf\xdLine truncated
|
var _confLocaleLocale_enUsIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xbc\x7d\xfd\x72\xdc\x46\xae\xef\xff\x7c\x0a\xc6\x5b\x2e\x27\x55\xf2\xa4\x92\x9c\xfb\x51\xa9\x38\xb9\x8a\x1d\x7f\x9c\x63\x59\x3a\x96\xb2\x7b\xf7\xa6\x5c\x13\x6a\x48\x8d\x78\x3c\x43\xce\x92\x1c\xcb\xda\xad\x7d\x83\xfb\x00\xf7\xf9\xee\x93\x5c\xe0\x07\xa0\x1b\x4d\x72\x24\x7b\xcf\xd6\xf5\x1f\x16\xa7\x1b\xfd\x8d\x46\x03\x68\x00\x5d\xec\x76\xcb\xb2\xea\x57\xf9\x93\xfc\x38\xdf\x15\x75\xb3\xa9\xfa\x3e\xef\xab\xcd\xd5\xe3\xeb\xb6\x1f\xaa\x32\x7f\x51\x0f\xf4\xbb\xfb\x50\xaf\xaa\x2c\xbb\x6e\xb7\x15\x81\xbe\xa4\x3f\x59\x59\xf4\xd7\x97\x6d\xd1\x95\x94\xf0\xcc\xbe\xb3\xea\xe3\x6e\xd3\x76\x0c\xf4\x8b\x7c\x65\xd7\xd5\x66\xc7\x65\xe8\x4f\xd6\xd7\xeb\x66\x59\x37\xf4\xf3\x9c\xbe\xf2\x57\x8d\xa4\xb4\xfb\xc1\x92\x4e\xf7\x83\xa4\xed\x77\x96\xf4\xeb\x2e\xeb\xaa\x75\x4d\xbd\xe9\x28\xe9\xad\x7e\x66\x37\xd5\x65\x5f\x0f\xdc\xd2\x9f\xe4\x2b\xfb\x50\x75\x7d\xdd\x72\xed\x7f\x94\xaf\x6c\x57\xac\x19\xe0\x8c\xfe\x64\x43\xb5\xdd\x6d\x0a\x14\xb8\xd0\xcf\x6c\x53\x34\xeb\xbd\xc0\xbc\xd6\xcf\x6c\xd5\x55\x94\xb5\x6c\xaa\x1b\x4a\x7d\x8a\x1f\x8b\xc5\x22\xdb\xd3\x24\x2c\x77\x5d\x7b\x55\x6f\xaa\x65\xd1\x94\xcb\xad\x0c\xf3\x57\x4a\xcf\x35\x3d\xa7\xf4\x9c\xd3\x31\x84\xaa\xa4\xa1\x2e\x8b\x5e\xc7\x41\x73\x49\x23\x2f\xfa\x0c\x55\x35\xc5\xd6\x4a\xf3\x67\x56\x6d\x8b\x7a\xc3\xb3\xc6\x7f\xa9\xdf\x7d\x7f\xd3\x62\x6a\xcf\xf4\x93\xe6\x60\x39\xdc\xee\x2a\x4c\xc1\xe3\x0b\xfa\xca\x56\xc5\x6e\x58\x5d\x17\xdc\x4d\xf9\xca\x08\x68\xd7\xd2\x5c\xb4\xdd\x2d\xe0\xec\x47\xd6\x76\xeb\xa2\xa9\xff\x5a\x0c\x32\x3f\xa7\xee\x67\xb6\xad\xbb\xae\xe5\xa9\x3d\xc1\x47\x46\x23\x5f\x72\x3d\x94\xf2\x86\x26\xc1\xd5\xc2\x39\xdb\x7a\xdd\xc9\x2c\x72\xe6\x09\x7e\x71\x2d\x9c\x77\xd5\x76\xef\x35\xe3\x39\x7f\x8e\x8a\x52\x27\x34\x37\x6d\xbf\x68\x68\xde\x35\xf7\x04\x3f\x12\x80\x3e\x2b\xca\x2d\xcd\xe4\xae\x68\x2a\x9e\xa2\x63\xfe\x45\xf3\x42\xbf\xb2\x62\xb5\x6a\xf7\xcd\xb0\xec\xab\x61\xa8\x9b\x35\xcf\xf5\xb1\x24\xe5\xe7\x9a\x94\xb9\xbc\x90\x76\xdb\xee\xc3\x6a\x52\xfa\x9f\xe9\x67\x7e\x26\x3f\x25\xcf\x15\x42\x66\x28\xc9\x23\xe9\x97\x57\x55\x55\xca\x58\xfa\xfc\x39\x7d\x67\xbb\xfd\x66\x43\xb3\xf6\x97\x7d\xd5\x0f\x5c\xe8\x8c\x7e\xd3\xf8\xe5\x77\x56\xf7\x3d\x7d\x50\xf2\x2b\x7c\x64\xb4\x74\xcd\x0a\x83\x79\x8a\x8f\x2c\xfb\xad\xaf\x8a\x6e\x75\xfd\x2e\x93\xbf\xe8\x2b\x7f\x30\xea\x1d\x5a\x54\xc6\x23\xc5\x21\x69\xc1\x1a\xc8\x56\x6d\xc9\x3f\x9e\xd2\x1f\xaa\xba\x6e\xfa\xa1\xd8\x6c\xde\x65\xfa\xc1\x60\xf2\x25\x0b\x30\xd4\x03\x66\x41\x13\xf3\xf3\xa1\xda\xf5\xbc\x82\xf9\xf3\xba\xeb\x87\xc7\x43\x4d\xb8\xfa\x76\xdf\x64\x65\xbb\x7a\x4f\xbb\x80\x77\x34\x5a\x7e\x75\x95\xd3\x64\x3d\xa2\x7d\xd0\xed\x9b\x86\xa6\x27\x7f\xd1\xd2\x94\x51\x33\x35\xb5\xff\x0c\xd0\x47\xf9\x6e\x53\x15\x3d\x81\x54\x45\x99\xff\x50\xe4\x43\xd1\xad\xab\xe1\xc9\x83\xe5\x25\xed\xbe\xf7\x0f\xf2\xeb\xae\xba\x7a\xf2\xe0\x61\xff\xe0\xc7\x17\x7b\x2a\xb6\xa9\x9b\xaa\xff\xe1\xeb\xe2\xc7\x7c\x55\x50\x0e\x4d\xe3\x6d\x7e\x59\x5d\xf1\x66\xa3\xb6\x72\xc2\xf2\x66\xcd\x1b\xed\x76\xb8\xe6\x06\x09\x13\xe8\xa3\xcf\x79\xa7\x7f\x91\xf1\x02\x10\x25\x58\x96\x97\x46\xd5\xd0\x21\x24\x77\xb4\x00\x27\xb7\xe7\xff\xfe\xfa\x28\x3f\x23\xd2\xb6\xee\x2a\x7c\xd3\x7f\x54\xe2\xbb\x9c\x46\x7b\x51\x3f\xfb\x79\x91\x51\x59\x9b\x90\x67\xc5\x50\x5c\x72\xdf\xc3\xea\x73\xa6\x6c\xc2\x90\x87\xad\xc8\xc4\x12\x84\xb1\x1f\x92\x65\x99\xdb\xc8\x54\x87\xee\xfe\x50\xc7\x1b\x26\x01\x94\x1e\x66\xf6\x4c\xe6\x8c\xaa\xca\x5f\xbd\x79\x73\xfa\xec\xe7\xbc\x6a\xd6\x34\x33\xf9\x4d\x3d\x5c\xe7\xfb\xe1\xea\xbf\x2f\xd7\x55\x53\x75\xc5\x66\xb9\xaa\x79\x52\x3a\x42\xd8\x9c\x66\x49\x86\xb8\xc8\xfa\x7e\x43\x14\x0a\x58\x70\x7e\xfe\x3a\x3f\x61\x4c\xd8\x15\xc3\x35\x3a\x32\x5c\x67\xfd\x5f\x36\x3c\x51\xa1\xc1\x8b\xeb\x2a\xc7\x66\x00\x50\x7b\x35\x9e\x97\xbc\xd4\xbe\x2e\xb2\xaa\xeb\x96\x44\x40\x87\x5b\x9e\x66\xad\xf3\x10\xb4\x54\x47\xd8\xde\xb4\x03\x2d\x63\x8e\x72\x52\x45\xdd\x7c\x28\x36\x75\x49\x93\x1d\x27\x24\x2d\x8b\xc4\xb2\xa5\x75\xe3\xd2\x84\x99\xed\x0d\x86\x5a\xac\x88\xfe\xf7\xf9\x83\xc5\x03\x10\xdc\x07\x8f\x1f\x2c\xb2\xa6\x5d\x0a\x95\x60\xd2\x5c\xd6\x7d\x71\x49\x64\x5a\x8e\x8d\xce\xa8\xde\x9f\x19\x7f\xa4\x2b\x0a\x91\x27\x10\x3c\xb7\x7c\x14\xe1\x04\x60\xe4\x2a\x88\x5e\x83\xd8\x28\x99\xf1\x63\x37\x9a\x14\xd6\x57\xc8\x52\x48\x98\x8c\x39\xb3\x05\x33\xec\x3a\xde\xed\x36\xf5\x4a\x9a\x7e\x21\x79\x11\xd1\xf8\x60\xd6\x49\xf1\x70\x40\x14\xcb\x73\xe8\x42\xbd\x66\xb2\x95\x27\x74\x1e\xe5\xaf\x2b\xda\x39\xd7\xfb\xb5\x1c\x4e\x9b\x76\x5f\x7e\x01\x82\x62\x2b\x17\xe9\x49\xfe\xb6\xa5\x0e\x03\x3b\x02\x40\x6c\xe2\x98\x08\x03\xf3\x02\x5d\xb5\x6d\x07\x9e\x38\x2d\x56\xd3\xf2\xdc\xd4\x94\x49\x23\xed\x8b\x0f\x44\x16\x87\x56\xb6\x64\x49\x5b\x6e\xc5\x15\x13\x05\xdb\xd3\x81\x2e\xdb\x82\xe8\x88\x6c\x0d\x4b\x4b\x71\x10\x50\xdb\x3d\xed\xa6\x6b\xaa\x8c\x27\x9e\x19\x12\xaa\x72\xae\x9f\x18\x12\xd5\x83\x5d\x4e\x3b\xb7\xa5\xc3\x93\x17\xfa\x19\x3e\xf4\xb7\xaf\x9f\x7a\x55\x5c\x5d\x51\xaf\x7a\xda\x15\x2f\xf3\xd5\xa6\xa5\x2d\xf5\xeb\xdb\xd7\x3d\x6f\x98\xeb\xe5\xae\xed\xc0\x88\x50\xd6\x19\x7d\x86\x34\x37\xd1\x0c\xd1\xec\xb7\x97\xf4\xeb\xe6\xba\x26\x42\x8d\x69\xe7\x12\xcc\x24\x51\x2Line truncated
|
||||||
|
|
||||||
func confLocaleLocale_enUsIniBytes() ([]byte, error) {
|
func confLocaleLocale_enUsIniBytes() ([]byte, error) {
|
||||||
return bindataRead(
|
return bindataRead(
|
||||||
@@ -4379,7 +4379,7 @@ func confLocaleLocale_enUsIni() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 47166, mode: os.FileMode(420), modTime: time.Unix(1449295691, 0)}
|
info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 47469, mode: os.FileMode(420), modTime: time.Unix(1449339530, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -548,6 +548,19 @@ function initWebhook() {
|
|||||||
$('.events.fields').hide();
|
$('.events.fields').hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Test delivery
|
||||||
|
$('#test-delivery').click(function () {
|
||||||
|
var $this = $(this);
|
||||||
|
$this.addClass('loading disabled');
|
||||||
|
$.post($this.data('link'), {
|
||||||
|
"_csrf": csrf
|
||||||
|
}).done(
|
||||||
|
setTimeout(function () {
|
||||||
|
window.location.href = $this.data('redirect');
|
||||||
|
}, 5000)
|
||||||
|
)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,9 @@
|
|||||||
package repo
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Unknwon/com"
|
|
||||||
|
|
||||||
"github.com/gogits/gogs/models"
|
"github.com/gogits/gogs/models"
|
||||||
"github.com/gogits/gogs/modules/auth"
|
"github.com/gogits/gogs/modules/auth"
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
@@ -26,9 +21,6 @@ import (
|
|||||||
const (
|
const (
|
||||||
SETTINGS_OPTIONS base.TplName = "repo/settings/options"
|
SETTINGS_OPTIONS base.TplName = "repo/settings/options"
|
||||||
COLLABORATION base.TplName = "repo/settings/collaboration"
|
COLLABORATION base.TplName = "repo/settings/collaboration"
|
||||||
HOOKS base.TplName = "repo/settings/hooks"
|
|
||||||
HOOK_NEW base.TplName = "repo/settings/hook_new"
|
|
||||||
ORG_HOOK_NEW base.TplName = "org/settings/hook_new"
|
|
||||||
GITHOOKS base.TplName = "repo/settings/githooks"
|
GITHOOKS base.TplName = "repo/settings/githooks"
|
||||||
GITHOOK_EDIT base.TplName = "repo/settings/githook_edit"
|
GITHOOK_EDIT base.TplName = "repo/settings/githook_edit"
|
||||||
DEPLOY_KEYS base.TplName = "repo/settings/deploy_keys"
|
DEPLOY_KEYS base.TplName = "repo/settings/deploy_keys"
|
||||||
@@ -270,330 +262,6 @@ func Collaboration(ctx *middleware.Context) {
|
|||||||
ctx.HTML(200, COLLABORATION)
|
ctx.HTML(200, COLLABORATION)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Webhooks(ctx *middleware.Context) {
|
|
||||||
ctx.Data["Title"] = ctx.Tr("repo.settings.hooks")
|
|
||||||
ctx.Data["PageIsSettingsHooks"] = true
|
|
||||||
ctx.Data["BaseLink"] = ctx.Repo.RepoLink
|
|
||||||
ctx.Data["Description"] = ctx.Tr("repo.settings.hooks_desc", "https://github.com/gogits/go-gogs-client/wiki/Repositories-Webhooks")
|
|
||||||
|
|
||||||
ws, err := models.GetWebhooksByRepoID(ctx.Repo.Repository.ID)
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "GetWebhooksByRepoID", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ctx.Data["Webhooks"] = ws
|
|
||||||
|
|
||||||
ctx.HTML(200, HOOKS)
|
|
||||||
}
|
|
||||||
|
|
||||||
type OrgRepoCtx struct {
|
|
||||||
OrgID int64
|
|
||||||
RepoID int64
|
|
||||||
Link string
|
|
||||||
NewTemplate base.TplName
|
|
||||||
}
|
|
||||||
|
|
||||||
// getOrgRepoCtx determines whether this is a repo context or organization context.
|
|
||||||
func getOrgRepoCtx(ctx *middleware.Context) (*OrgRepoCtx, error) {
|
|
||||||
if len(ctx.Repo.RepoLink) > 0 {
|
|
||||||
return &OrgRepoCtx{
|
|
||||||
RepoID: ctx.Repo.Repository.ID,
|
|
||||||
Link: ctx.Repo.RepoLink,
|
|
||||||
NewTemplate: HOOK_NEW,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(ctx.Org.OrgLink) > 0 {
|
|
||||||
return &OrgRepoCtx{
|
|
||||||
OrgID: ctx.Org.Organization.Id,
|
|
||||||
Link: ctx.Org.OrgLink,
|
|
||||||
NewTemplate: ORG_HOOK_NEW,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, errors.New("Unable to set OrgRepo context")
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkHookType(ctx *middleware.Context) string {
|
|
||||||
hookType := strings.ToLower(ctx.Params(":type"))
|
|
||||||
if !com.IsSliceContainsStr(setting.Webhook.Types, hookType) {
|
|
||||||
ctx.Handle(404, "checkHookType", nil)
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return hookType
|
|
||||||
}
|
|
||||||
|
|
||||||
func WebhooksNew(ctx *middleware.Context) {
|
|
||||||
ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook")
|
|
||||||
ctx.Data["PageIsSettingsHooks"] = true
|
|
||||||
ctx.Data["PageIsSettingsHooksNew"] = true
|
|
||||||
ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}}
|
|
||||||
|
|
||||||
orCtx, err := getOrgRepoCtx(ctx)
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "getOrgRepoCtx", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.Data["HookType"] = checkHookType(ctx)
|
|
||||||
if ctx.Written() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ctx.Data["BaseLink"] = orCtx.Link
|
|
||||||
|
|
||||||
ctx.HTML(200, orCtx.NewTemplate)
|
|
||||||
}
|
|
||||||
|
|
||||||
func ParseHookEvent(form auth.WebhookForm) *models.HookEvent {
|
|
||||||
return &models.HookEvent{
|
|
||||||
PushOnly: form.PushOnly(),
|
|
||||||
SendEverything: form.SendEverything(),
|
|
||||||
ChooseEvents: form.ChooseEvents(),
|
|
||||||
HookEvents: models.HookEvents{
|
|
||||||
Create: form.Create,
|
|
||||||
Push: form.Push,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func WebHooksNewPost(ctx *middleware.Context, form auth.NewWebhookForm) {
|
|
||||||
ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook")
|
|
||||||
ctx.Data["PageIsSettingsHooks"] = true
|
|
||||||
ctx.Data["PageIsSettingsHooksNew"] = true
|
|
||||||
ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}}
|
|
||||||
ctx.Data["HookType"] = "gogs"
|
|
||||||
|
|
||||||
orCtx, err := getOrgRepoCtx(ctx)
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "getOrgRepoCtx", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ctx.Data["BaseLink"] = orCtx.Link
|
|
||||||
|
|
||||||
if ctx.HasError() {
|
|
||||||
ctx.HTML(200, orCtx.NewTemplate)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
contentType := models.JSON
|
|
||||||
if models.HookContentType(form.ContentType) == models.FORM {
|
|
||||||
contentType = models.FORM
|
|
||||||
}
|
|
||||||
|
|
||||||
w := &models.Webhook{
|
|
||||||
RepoID: orCtx.RepoID,
|
|
||||||
URL: form.PayloadURL,
|
|
||||||
ContentType: contentType,
|
|
||||||
Secret: form.Secret,
|
|
||||||
HookEvent: ParseHookEvent(form.WebhookForm),
|
|
||||||
IsActive: form.Active,
|
|
||||||
HookTaskType: models.GOGS,
|
|
||||||
OrgID: orCtx.OrgID,
|
|
||||||
}
|
|
||||||
if err := w.UpdateEvent(); err != nil {
|
|
||||||
ctx.Handle(500, "UpdateEvent", err)
|
|
||||||
return
|
|
||||||
} else if err := models.CreateWebhook(w); err != nil {
|
|
||||||
ctx.Handle(500, "CreateWebhook", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("repo.settings.add_hook_success"))
|
|
||||||
ctx.Redirect(orCtx.Link + "/settings/hooks")
|
|
||||||
}
|
|
||||||
|
|
||||||
func SlackHooksNewPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
|
|
||||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
|
||||||
ctx.Data["PageIsSettingsHooks"] = true
|
|
||||||
ctx.Data["PageIsSettingsHooksNew"] = true
|
|
||||||
ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}}
|
|
||||||
|
|
||||||
orCtx, err := getOrgRepoCtx(ctx)
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "getOrgRepoCtx", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if ctx.HasError() {
|
|
||||||
ctx.HTML(200, orCtx.NewTemplate)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
meta, err := json.Marshal(&models.SlackMeta{
|
|
||||||
Channel: form.Channel,
|
|
||||||
Username: form.Username,
|
|
||||||
IconURL: form.IconURL,
|
|
||||||
Color: form.Color,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "Marshal", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
w := &models.Webhook{
|
|
||||||
RepoID: orCtx.RepoID,
|
|
||||||
URL: form.PayloadURL,
|
|
||||||
ContentType: models.JSON,
|
|
||||||
HookEvent: ParseHookEvent(form.WebhookForm),
|
|
||||||
IsActive: form.Active,
|
|
||||||
HookTaskType: models.SLACK,
|
|
||||||
Meta: string(meta),
|
|
||||||
OrgID: orCtx.OrgID,
|
|
||||||
}
|
|
||||||
if err := w.UpdateEvent(); err != nil {
|
|
||||||
ctx.Handle(500, "UpdateEvent", err)
|
|
||||||
return
|
|
||||||
} else if err := models.CreateWebhook(w); err != nil {
|
|
||||||
ctx.Handle(500, "CreateWebhook", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("repo.settings.add_hook_success"))
|
|
||||||
ctx.Redirect(orCtx.Link + "/settings/hooks")
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkWebhook(ctx *middleware.Context) (*OrgRepoCtx, *models.Webhook) {
|
|
||||||
ctx.Data["RequireHighlightJS"] = true
|
|
||||||
|
|
||||||
orCtx, err := getOrgRepoCtx(ctx)
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "getOrgRepoCtx", err)
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
ctx.Data["BaseLink"] = orCtx.Link
|
|
||||||
|
|
||||||
w, err := models.GetWebhookByID(ctx.ParamsInt64(":id"))
|
|
||||||
if err != nil {
|
|
||||||
if models.IsErrWebhookNotExist(err) {
|
|
||||||
ctx.Handle(404, "GetWebhookByID", nil)
|
|
||||||
} else {
|
|
||||||
ctx.Handle(500, "GetWebhookByID", err)
|
|
||||||
}
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch w.HookTaskType {
|
|
||||||
case models.SLACK:
|
|
||||||
ctx.Data["SlackHook"] = w.GetSlackHook()
|
|
||||||
ctx.Data["HookType"] = "slack"
|
|
||||||
default:
|
|
||||||
ctx.Data["HookType"] = "gogs"
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.Data["History"], err = w.History(1)
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "History", err)
|
|
||||||
}
|
|
||||||
return orCtx, w
|
|
||||||
}
|
|
||||||
|
|
||||||
func WebHooksEdit(ctx *middleware.Context) {
|
|
||||||
ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook")
|
|
||||||
ctx.Data["PageIsSettingsHooks"] = true
|
|
||||||
ctx.Data["PageIsSettingsHooksEdit"] = true
|
|
||||||
|
|
||||||
orCtx, w := checkWebhook(ctx)
|
|
||||||
if ctx.Written() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ctx.Data["Webhook"] = w
|
|
||||||
|
|
||||||
ctx.HTML(200, orCtx.NewTemplate)
|
|
||||||
}
|
|
||||||
|
|
||||||
func WebHooksEditPost(ctx *middleware.Context, form auth.NewWebhookForm) {
|
|
||||||
ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook")
|
|
||||||
ctx.Data["PageIsSettingsHooks"] = true
|
|
||||||
ctx.Data["PageIsSettingsHooksEdit"] = true
|
|
||||||
|
|
||||||
orCtx, w := checkWebhook(ctx)
|
|
||||||
if ctx.Written() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ctx.Data["Webhook"] = w
|
|
||||||
|
|
||||||
if ctx.HasError() {
|
|
||||||
ctx.HTML(200, orCtx.NewTemplate)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
contentType := models.JSON
|
|
||||||
if models.HookContentType(form.ContentType) == models.FORM {
|
|
||||||
contentType = models.FORM
|
|
||||||
}
|
|
||||||
|
|
||||||
w.URL = form.PayloadURL
|
|
||||||
w.ContentType = contentType
|
|
||||||
w.Secret = form.Secret
|
|
||||||
w.HookEvent = ParseHookEvent(form.WebhookForm)
|
|
||||||
w.IsActive = form.Active
|
|
||||||
if err := w.UpdateEvent(); err != nil {
|
|
||||||
ctx.Handle(500, "UpdateEvent", err)
|
|
||||||
return
|
|
||||||
} else if err := models.UpdateWebhook(w); err != nil {
|
|
||||||
ctx.Handle(500, "WebHooksEditPost", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("repo.settings.update_hook_success"))
|
|
||||||
ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", orCtx.Link, w.ID))
|
|
||||||
}
|
|
||||||
|
|
||||||
func SlackHooksEditPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
|
|
||||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
|
||||||
ctx.Data["PageIsSettingsHooks"] = true
|
|
||||||
ctx.Data["PageIsSettingsHooksEdit"] = true
|
|
||||||
|
|
||||||
orCtx, w := checkWebhook(ctx)
|
|
||||||
if ctx.Written() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ctx.Data["Webhook"] = w
|
|
||||||
|
|
||||||
if ctx.HasError() {
|
|
||||||
ctx.HTML(200, orCtx.NewTemplate)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
meta, err := json.Marshal(&models.SlackMeta{
|
|
||||||
Channel: form.Channel,
|
|
||||||
Username: form.Username,
|
|
||||||
IconURL: form.IconURL,
|
|
||||||
Color: form.Color,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "Marshal", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
w.URL = form.PayloadURL
|
|
||||||
w.Meta = string(meta)
|
|
||||||
w.HookEvent = ParseHookEvent(form.WebhookForm)
|
|
||||||
w.IsActive = form.Active
|
|
||||||
if err := w.UpdateEvent(); err != nil {
|
|
||||||
ctx.Handle(500, "UpdateEvent", err)
|
|
||||||
return
|
|
||||||
} else if err := models.UpdateWebhook(w); err != nil {
|
|
||||||
ctx.Handle(500, "UpdateWebhook", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("repo.settings.update_hook_success"))
|
|
||||||
ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", orCtx.Link, w.ID))
|
|
||||||
}
|
|
||||||
|
|
||||||
func DeleteWebhook(ctx *middleware.Context) {
|
|
||||||
if err := models.DeleteWebhook(ctx.QueryInt64("id")); err != nil {
|
|
||||||
ctx.Flash.Error("DeleteWebhook: " + err.Error())
|
|
||||||
} else {
|
|
||||||
ctx.Flash.Success(ctx.Tr("repo.settings.webhook_deletion_success"))
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.JSON(200, map[string]interface{}{
|
|
||||||
"redirect": ctx.Repo.RepoLink + "/settings/hooks",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func parseOwnerAndRepo(ctx *middleware.Context) (*models.User, *models.Repository) {
|
func parseOwnerAndRepo(ctx *middleware.Context) (*models.User, *models.Repository) {
|
||||||
owner, err := models.GetUserByName(ctx.Params(":username"))
|
owner, err := models.GetUserByName(ctx.Params(":username"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -0,0 +1,385 @@
|
|||||||
|
// Copyright 2015 The Gogs Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package repo
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/Unknwon/com"
|
||||||
|
|
||||||
|
api "github.com/gogits/go-gogs-client"
|
||||||
|
|
||||||
|
"github.com/gogits/gogs/models"
|
||||||
|
"github.com/gogits/gogs/modules/auth"
|
||||||
|
"github.com/gogits/gogs/modules/base"
|
||||||
|
"github.com/gogits/gogs/modules/middleware"
|
||||||
|
"github.com/gogits/gogs/modules/setting"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
HOOKS base.TplName = "repo/settings/hooks"
|
||||||
|
HOOK_NEW base.TplName = "repo/settings/hook_new"
|
||||||
|
ORG_HOOK_NEW base.TplName = "org/settings/hook_new"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Webhooks(ctx *middleware.Context) {
|
||||||
|
ctx.Data["Title"] = ctx.Tr("repo.settings.hooks")
|
||||||
|
ctx.Data["PageIsSettingsHooks"] = true
|
||||||
|
ctx.Data["BaseLink"] = ctx.Repo.RepoLink
|
||||||
|
ctx.Data["Description"] = ctx.Tr("repo.settings.hooks_desc", "https://github.com/gogits/go-gogs-client/wiki/Repositories-Webhooks")
|
||||||
|
|
||||||
|
ws, err := models.GetWebhooksByRepoID(ctx.Repo.Repository.ID)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "GetWebhooksByRepoID", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Data["Webhooks"] = ws
|
||||||
|
|
||||||
|
ctx.HTML(200, HOOKS)
|
||||||
|
}
|
||||||
|
|
||||||
|
type OrgRepoCtx struct {
|
||||||
|
OrgID int64
|
||||||
|
RepoID int64
|
||||||
|
Link string
|
||||||
|
NewTemplate base.TplName
|
||||||
|
}
|
||||||
|
|
||||||
|
// getOrgRepoCtx determines whether this is a repo context or organization context.
|
||||||
|
func getOrgRepoCtx(ctx *middleware.Context) (*OrgRepoCtx, error) {
|
||||||
|
if len(ctx.Repo.RepoLink) > 0 {
|
||||||
|
return &OrgRepoCtx{
|
||||||
|
RepoID: ctx.Repo.Repository.ID,
|
||||||
|
Link: ctx.Repo.RepoLink,
|
||||||
|
NewTemplate: HOOK_NEW,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(ctx.Org.OrgLink) > 0 {
|
||||||
|
return &OrgRepoCtx{
|
||||||
|
OrgID: ctx.Org.Organization.Id,
|
||||||
|
Link: ctx.Org.OrgLink,
|
||||||
|
NewTemplate: ORG_HOOK_NEW,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, errors.New("Unable to set OrgRepo context")
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkHookType(ctx *middleware.Context) string {
|
||||||
|
hookType := strings.ToLower(ctx.Params(":type"))
|
||||||
|
if !com.IsSliceContainsStr(setting.Webhook.Types, hookType) {
|
||||||
|
ctx.Handle(404, "checkHookType", nil)
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return hookType
|
||||||
|
}
|
||||||
|
|
||||||
|
func WebhooksNew(ctx *middleware.Context) {
|
||||||
|
ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook")
|
||||||
|
ctx.Data["PageIsSettingsHooks"] = true
|
||||||
|
ctx.Data["PageIsSettingsHooksNew"] = true
|
||||||
|
ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}}
|
||||||
|
|
||||||
|
orCtx, err := getOrgRepoCtx(ctx)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "getOrgRepoCtx", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.Data["HookType"] = checkHookType(ctx)
|
||||||
|
if ctx.Written() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Data["BaseLink"] = orCtx.Link
|
||||||
|
|
||||||
|
ctx.HTML(200, orCtx.NewTemplate)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ParseHookEvent(form auth.WebhookForm) *models.HookEvent {
|
||||||
|
return &models.HookEvent{
|
||||||
|
PushOnly: form.PushOnly(),
|
||||||
|
SendEverything: form.SendEverything(),
|
||||||
|
ChooseEvents: form.ChooseEvents(),
|
||||||
|
HookEvents: models.HookEvents{
|
||||||
|
Create: form.Create,
|
||||||
|
Push: form.Push,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WebHooksNewPost(ctx *middleware.Context, form auth.NewWebhookForm) {
|
||||||
|
ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook")
|
||||||
|
ctx.Data["PageIsSettingsHooks"] = true
|
||||||
|
ctx.Data["PageIsSettingsHooksNew"] = true
|
||||||
|
ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}}
|
||||||
|
ctx.Data["HookType"] = "gogs"
|
||||||
|
|
||||||
|
orCtx, err := getOrgRepoCtx(ctx)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "getOrgRepoCtx", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Data["BaseLink"] = orCtx.Link
|
||||||
|
|
||||||
|
if ctx.HasError() {
|
||||||
|
ctx.HTML(200, orCtx.NewTemplate)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
contentType := models.JSON
|
||||||
|
if models.HookContentType(form.ContentType) == models.FORM {
|
||||||
|
contentType = models.FORM
|
||||||
|
}
|
||||||
|
|
||||||
|
w := &models.Webhook{
|
||||||
|
RepoID: orCtx.RepoID,
|
||||||
|
URL: form.PayloadURL,
|
||||||
|
ContentType: contentType,
|
||||||
|
Secret: form.Secret,
|
||||||
|
HookEvent: ParseHookEvent(form.WebhookForm),
|
||||||
|
IsActive: form.Active,
|
||||||
|
HookTaskType: models.GOGS,
|
||||||
|
OrgID: orCtx.OrgID,
|
||||||
|
}
|
||||||
|
if err := w.UpdateEvent(); err != nil {
|
||||||
|
ctx.Handle(500, "UpdateEvent", err)
|
||||||
|
return
|
||||||
|
} else if err := models.CreateWebhook(w); err != nil {
|
||||||
|
ctx.Handle(500, "CreateWebhook", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.Flash.Success(ctx.Tr("repo.settings.add_hook_success"))
|
||||||
|
ctx.Redirect(orCtx.Link + "/settings/hooks")
|
||||||
|
}
|
||||||
|
|
||||||
|
func SlackHooksNewPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
|
||||||
|
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||||
|
ctx.Data["PageIsSettingsHooks"] = true
|
||||||
|
ctx.Data["PageIsSettingsHooksNew"] = true
|
||||||
|
ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}}
|
||||||
|
|
||||||
|
orCtx, err := getOrgRepoCtx(ctx)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "getOrgRepoCtx", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if ctx.HasError() {
|
||||||
|
ctx.HTML(200, orCtx.NewTemplate)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
meta, err := json.Marshal(&models.SlackMeta{
|
||||||
|
Channel: form.Channel,
|
||||||
|
Username: form.Username,
|
||||||
|
IconURL: form.IconURL,
|
||||||
|
Color: form.Color,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "Marshal", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
w := &models.Webhook{
|
||||||
|
RepoID: orCtx.RepoID,
|
||||||
|
URL: form.PayloadURL,
|
||||||
|
ContentType: models.JSON,
|
||||||
|
HookEvent: ParseHookEvent(form.WebhookForm),
|
||||||
|
IsActive: form.Active,
|
||||||
|
HookTaskType: models.SLACK,
|
||||||
|
Meta: string(meta),
|
||||||
|
OrgID: orCtx.OrgID,
|
||||||
|
}
|
||||||
|
if err := w.UpdateEvent(); err != nil {
|
||||||
|
ctx.Handle(500, "UpdateEvent", err)
|
||||||
|
return
|
||||||
|
} else if err := models.CreateWebhook(w); err != nil {
|
||||||
|
ctx.Handle(500, "CreateWebhook", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.Flash.Success(ctx.Tr("repo.settings.add_hook_success"))
|
||||||
|
ctx.Redirect(orCtx.Link + "/settings/hooks")
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkWebhook(ctx *middleware.Context) (*OrgRepoCtx, *models.Webhook) {
|
||||||
|
ctx.Data["RequireHighlightJS"] = true
|
||||||
|
|
||||||
|
orCtx, err := getOrgRepoCtx(ctx)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "getOrgRepoCtx", err)
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
ctx.Data["BaseLink"] = orCtx.Link
|
||||||
|
|
||||||
|
w, err := models.GetWebhookByID(ctx.ParamsInt64(":id"))
|
||||||
|
if err != nil {
|
||||||
|
if models.IsErrWebhookNotExist(err) {
|
||||||
|
ctx.Handle(404, "GetWebhookByID", nil)
|
||||||
|
} else {
|
||||||
|
ctx.Handle(500, "GetWebhookByID", err)
|
||||||
|
}
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch w.HookTaskType {
|
||||||
|
case models.SLACK:
|
||||||
|
ctx.Data["SlackHook"] = w.GetSlackHook()
|
||||||
|
ctx.Data["HookType"] = "slack"
|
||||||
|
default:
|
||||||
|
ctx.Data["HookType"] = "gogs"
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.Data["History"], err = w.History(1)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "History", err)
|
||||||
|
}
|
||||||
|
return orCtx, w
|
||||||
|
}
|
||||||
|
|
||||||
|
func WebHooksEdit(ctx *middleware.Context) {
|
||||||
|
ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook")
|
||||||
|
ctx.Data["PageIsSettingsHooks"] = true
|
||||||
|
ctx.Data["PageIsSettingsHooksEdit"] = true
|
||||||
|
|
||||||
|
orCtx, w := checkWebhook(ctx)
|
||||||
|
if ctx.Written() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Data["Webhook"] = w
|
||||||
|
|
||||||
|
ctx.HTML(200, orCtx.NewTemplate)
|
||||||
|
}
|
||||||
|
|
||||||
|
func WebHooksEditPost(ctx *middleware.Context, form auth.NewWebhookForm) {
|
||||||
|
ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook")
|
||||||
|
ctx.Data["PageIsSettingsHooks"] = true
|
||||||
|
ctx.Data["PageIsSettingsHooksEdit"] = true
|
||||||
|
|
||||||
|
orCtx, w := checkWebhook(ctx)
|
||||||
|
if ctx.Written() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Data["Webhook"] = w
|
||||||
|
|
||||||
|
if ctx.HasError() {
|
||||||
|
ctx.HTML(200, orCtx.NewTemplate)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
contentType := models.JSON
|
||||||
|
if models.HookContentType(form.ContentType) == models.FORM {
|
||||||
|
contentType = models.FORM
|
||||||
|
}
|
||||||
|
|
||||||
|
w.URL = form.PayloadURL
|
||||||
|
w.ContentType = contentType
|
||||||
|
w.Secret = form.Secret
|
||||||
|
w.HookEvent = ParseHookEvent(form.WebhookForm)
|
||||||
|
w.IsActive = form.Active
|
||||||
|
if err := w.UpdateEvent(); err != nil {
|
||||||
|
ctx.Handle(500, "UpdateEvent", err)
|
||||||
|
return
|
||||||
|
} else if err := models.UpdateWebhook(w); err != nil {
|
||||||
|
ctx.Handle(500, "WebHooksEditPost", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.Flash.Success(ctx.Tr("repo.settings.update_hook_success"))
|
||||||
|
ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", orCtx.Link, w.ID))
|
||||||
|
}
|
||||||
|
|
||||||
|
func SlackHooksEditPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
|
||||||
|
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||||
|
ctx.Data["PageIsSettingsHooks"] = true
|
||||||
|
ctx.Data["PageIsSettingsHooksEdit"] = true
|
||||||
|
|
||||||
|
orCtx, w := checkWebhook(ctx)
|
||||||
|
if ctx.Written() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Data["Webhook"] = w
|
||||||
|
|
||||||
|
if ctx.HasError() {
|
||||||
|
ctx.HTML(200, orCtx.NewTemplate)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
meta, err := json.Marshal(&models.SlackMeta{
|
||||||
|
Channel: form.Channel,
|
||||||
|
Username: form.Username,
|
||||||
|
IconURL: form.IconURL,
|
||||||
|
Color: form.Color,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "Marshal", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
w.URL = form.PayloadURL
|
||||||
|
w.Meta = string(meta)
|
||||||
|
w.HookEvent = ParseHookEvent(form.WebhookForm)
|
||||||
|
w.IsActive = form.Active
|
||||||
|
if err := w.UpdateEvent(); err != nil {
|
||||||
|
ctx.Handle(500, "UpdateEvent", err)
|
||||||
|
return
|
||||||
|
} else if err := models.UpdateWebhook(w); err != nil {
|
||||||
|
ctx.Handle(500, "UpdateWebhook", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.Flash.Success(ctx.Tr("repo.settings.update_hook_success"))
|
||||||
|
ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", orCtx.Link, w.ID))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWebhook(ctx *middleware.Context) {
|
||||||
|
p := &api.PushPayload{
|
||||||
|
Ref: ctx.Repo.Repository.DefaultBranch,
|
||||||
|
Before: ctx.Repo.CommitID,
|
||||||
|
After: ctx.Repo.CommitID,
|
||||||
|
Commits: []*api.PayloadCommit{
|
||||||
|
{
|
||||||
|
ID: ctx.Repo.CommitID,
|
||||||
|
Message: ctx.Repo.Commit.Message(),
|
||||||
|
URL: ctx.Repo.RepoLink + "/commit/" + ctx.Repo.CommitID,
|
||||||
|
Author: &api.PayloadAuthor{
|
||||||
|
Name: ctx.Repo.Commit.Author.Name,
|
||||||
|
Email: ctx.Repo.Commit.Author.Email,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Repo: ctx.Repo.Repository.ComposePayload(),
|
||||||
|
Sender: &api.PayloadUser{
|
||||||
|
UserName: ctx.User.Name,
|
||||||
|
ID: ctx.User.Id,
|
||||||
|
AvatarUrl: setting.AppUrl + ctx.User.RelAvatarLink(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
if err := models.PrepareWebhooks(ctx.Repo.Repository, models.HOOK_EVENT_PUSH, p); err != nil {
|
||||||
|
ctx.Flash.Error("PrepareWebhooks: " + err.Error())
|
||||||
|
ctx.Status(500)
|
||||||
|
} else {
|
||||||
|
go models.HookQueue.Add(ctx.Repo.Repository.ID)
|
||||||
|
ctx.Flash.Info(ctx.Tr("repo.settings.webhook.test_delivery_success"))
|
||||||
|
ctx.Status(200)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func DeleteWebhook(ctx *middleware.Context) {
|
||||||
|
if err := models.DeleteWebhook(ctx.QueryInt64("id")); err != nil {
|
||||||
|
ctx.Flash.Error("DeleteWebhook: " + err.Error())
|
||||||
|
} else {
|
||||||
|
ctx.Flash.Success(ctx.Tr("repo.settings.webhook_deletion_success"))
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.JSON(200, map[string]interface{}{
|
||||||
|
"redirect": ctx.Repo.RepoLink + "/settings/hooks",
|
||||||
|
})
|
||||||
|
}
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
0.7.31.1205 Beta
|
0.7.32.1205 Beta
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
{{if .PageIsSettingsHooksEdit}}
|
{{if .PageIsSettingsHooksEdit}}
|
||||||
<h4 class="ui top attached header">
|
<h4 class="ui top attached header">
|
||||||
{{.i18n.Tr "repo.settings.recent_deliveries"}}
|
{{.i18n.Tr "repo.settings.recent_deliveries"}}
|
||||||
|
{{if .IsRepositoryAdmin}}
|
||||||
|
<div class="ui right">
|
||||||
|
<button class="ui teal tiny button poping up" id="test-delivery" data-content=
|
||||||
|
"{{.i18n.Tr "repo.settings.webhook.test_delivery_desc"}}" data-variation="inverted tiny" data-link="{{.Link}}/test" data-redirect="{{.Link}}">{{.i18n.Tr "repo.settings.webhook.test_delivery"}}</button>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
</h4>
|
</h4>
|
||||||
<div class="ui attached table segment">
|
<div class="ui attached table segment">
|
||||||
<div class="ui hook history list">
|
<div class="ui hook history list">
|
||||||
|
|||||||
Reference in new issue
Block a user