add webhook recent deliveries

This commit is contained in:
Unknwon committed 2015-08-27 23:06:14 +08:00
1 parent fc2d0e5470
commit 23f42d92c9
18 files changed
+474 -233

No files matched your search

+2
View File
@@ -97,6 +97,8 @@ QUEUE_LENGTH = 1000
DELIVER_TIMEOUT = 5
; Allow insecure certification
SKIP_TLS_VERIFY = false
; Number of history information in each page
PAGING_NUM = 10
[mailer]
ENABLED = false
+5
View File
@@ -513,6 +513,11 @@ settings.hooks_desc = Webhooks are much like basic HTTP POST event triggers. Whe
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_success = Webhook has been deleted successfully!
settings.webhook.request = Request
settings.webhook.response = Response
settings.webhook.headers = Headers
settings.webhook.payload = Payload
settings.webhook.body = Body
settings.githooks_desc = Git Hooks are powered by Git itself, you can edit files of supported hooks in the list below to perform custom operations.
settings.githook_edit_desc = If the hook is inactive, sample content will be presented. Leaving content to an empty value will disable this hook.
settings.githook_name = Hook Name
+2 -2
View File
@@ -448,11 +448,11 @@ func CommitRepoAction(userID, repoUserID int64, userName, actEmail string,
RepoID: repo.ID,
HookID: w.ID,
Type: w.HookTaskType,
Url: w.URL,
URL: w.URL,
BasePayload: payload,
ContentType: w.ContentType,
EventType: HOOK_EVENT_PUSH,
IsSsl: w.IsSSL,
IsSSL: w.IsSSL,
}); err != nil {
return fmt.Errorf("CreateHookTask: %v", err)
}
+21 -1
View File
@@ -236,7 +236,27 @@ func IsErrRepoAlreadyExist(err error) bool {
}
func (err ErrRepoAlreadyExist) Error() string {
return fmt.Sprintf("repository already exists [uname: %d, name: %s]", err.Uname, err.Name)
return fmt.Sprintf("repository already exists [uname: %s, name: %s]", err.Uname, err.Name)
}
// __ __ ___. .__ __
// / \ / \ ____\_ |__ | |__ ____ ____ | | __
// \ \/\/ // __ \| __ \| | \ / _ \ / _ \| |/ /
// \ /\ ___/| \_\ \ Y ( <_> | <_> ) <
// \__/\ / \___ >___ /___| /\____/ \____/|__|_ \
// \/ \/ \/ \/ \/
type ErrWebhookNotExist struct {
ID int64
}
func IsErrWebhookNotExist(err error) bool {
_, ok := err.(ErrWebhookNotExist)
return ok
}
func (err ErrWebhookNotExist) Error() string {
return fmt.Sprintf("webhook does not exist [id: %d]", err.ID)
}
// .___
+5
View File
@@ -84,6 +84,11 @@ func init() {
new(UpdateTask), new(HookTask),
new(Team), new(OrgUser), new(TeamUser), new(TeamRepo),
new(Notice), new(EmailAddress))
gonicNames := []string{"SSL"}
for _, name := range gonicNames {
core.LintGonicMapper[name] = true
}
}
func LoadModelsConfig() {
+164 -62
View File
@@ -7,21 +7,20 @@ package models
import (
"crypto/tls"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"strings"
"sync"
"time"
"github.com/go-xorm/xorm"
"github.com/gogits/gogs/modules/httplib"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/setting"
"github.com/gogits/gogs/modules/uuid"
)
var (
ErrWebhookNotExist = errors.New("Webhook does not exist")
)
type HookContentType int
const (
@@ -103,6 +102,11 @@ func (w *Webhook) GetSlackHook() *Slack {
return s
}
// History returns history of webhook by given conditions.
func (w *Webhook) History(page int) ([]*HookTask, error) {
return HookTasks(w.ID, page)
}
// UpdateEvent handles conversion from HookEvent to Events.
func (w *Webhook) UpdateEvent() error {
data, err := json.Marshal(w.HookEvent)
@@ -124,14 +128,14 @@ func CreateWebhook(w *Webhook) error {
return err
}
// GetWebhookById returns webhook by given ID.
func GetWebhookById(hookId int64) (*Webhook, error) {
w := &Webhook{ID: hookId}
has, err := x.Get(w)
// GetWebhookByID returns webhook by given ID.
func GetWebhookByID(id int64) (*Webhook, error) {
w := new(Webhook)
has, err := x.Id(id).Get(w)
if err != nil {
return nil, err
} else if !has {
return nil, ErrWebhookNotExist
return nil, ErrWebhookNotExist{id}
}
return w, nil
}
@@ -271,29 +275,99 @@ type Payload struct {
}
func (p Payload) GetJSONPayload() ([]byte, error) {
data, err := json.Marshal(p)
data, err := json.MarshalIndent(p, "", " ")
if err != nil {
return []byte{}, err
}
return data, nil
}
// HookRequest represents hook task request information.
type HookRequest struct {
Headers map[string]string `json:"headers"`
}
// HookResponse represents hook task response information.
type HookResponse struct {
Status int `json:"status"`
Headers map[string]string `json:"headers"`
Body string `json:"body"`
}
// HookTask represents a hook task.
type HookTask struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX"`
HookID int64
Uuid string
Type HookTaskType
Url string
BasePayload `xorm:"-"`
PayloadContent string `xorm:"TEXT"`
ContentType HookContentType
EventType HookEventType
IsSsl bool
IsDelivered bool
Delivered int64
IsSucceed bool
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX"`
HookID int64
UUID string
Type HookTaskType
URL string
BasePayload `xorm:"-"`
PayloadContent string `xorm:"TEXT"`
ContentType HookContentType
EventType HookEventType
IsSSL bool
IsDelivered bool
Delivered int64
DeliveredString string `xorm:"-"`
// History info.
IsSucceed bool
RequestContent string `xorm:"TEXT"`
RequestInfo *HookRequest `xorm:"-"`
ResponseContent string `xorm:"TEXT"`
ResponseInfo *HookResponse `xorm:"-"`
}
func (t *HookTask) BeforeUpdate() {
if t.RequestInfo != nil {
t.RequestContent = t.MarshalJSON(t.RequestInfo)
}
if t.ResponseInfo != nil {
t.ResponseContent = t.MarshalJSON(t.ResponseInfo)
}
}
func (t *HookTask) AfterSet(colName string, _ xorm.Cell) {
var err error
switch colName {
case "delivered":
t.DeliveredString = time.Unix(0, t.Delivered).Format("2006-01-02 15:04:05 MST")
case "request_content":
if len(t.RequestContent) == 0 {
return
}
t.RequestInfo = &HookRequest{}
if err = json.Unmarshal([]byte(t.RequestContent), t.RequestInfo); err != nil {
log.Error(3, "Unmarshal[%d]: %v", t.ID, err)
}
case "response_content":
if len(t.ResponseContent) == 0 {
return
}
t.ResponseInfo = &HookResponse{}
if err = json.Unmarshal([]byte(t.ResponseContent), t.ResponseInfo); err != nil {
log.Error(3, "Unmarshal[%d]: %v", t.ID, err)
}
}
}
func (t *HookTask) MarshalJSON(v interface{}) string {
p, err := json.Marshal(v)
if err != nil {
log.Error(3, "Marshal[%d]: %v", t.ID, err)
}
return string(p)
}
// HookTasks returns a list of hook tasks by given conditions.
func HookTasks(hookID int64, page int) ([]*HookTask, error) {
tasks := make([]*HookTask, 0, setting.Webhook.PagingNum)
return tasks, x.Limit(setting.Webhook.PagingNum, (page-1)*setting.Webhook.PagingNum).Desc("id").Find(&tasks)
}
// CreateHookTask creates a new hook task,
@@ -303,7 +377,7 @@ func CreateHookTask(t *HookTask) error {
if err != nil {
return err
}
t.Uuid = uuid.NewV4().String()
t.UUID = uuid.NewV4().String()
t.PayloadContent = string(data)
_, err = x.Insert(t)
return err
@@ -348,9 +422,11 @@ func (q *hookQueue) AddRepoID(id int64) {
var HookQueue *hookQueue
func deliverHook(t *HookTask) {
t.IsDelivered = true
timeout := time.Duration(setting.Webhook.DeliverTimeout) * time.Second
req := httplib.Post(t.Url).SetTimeout(timeout, timeout).
Header("X-Gogs-Delivery", t.Uuid).
req := httplib.Post(t.URL).SetTimeout(timeout, timeout).
Header("X-Gogs-Delivery", t.UUID).
Header("X-Gogs-Event", string(t.EventType)).
SetTLSClientConfig(&tls.Config{InsecureSkipVerify: setting.Webhook.SkipTLSVerify})
@@ -361,42 +437,68 @@ func deliverHook(t *HookTask) {
req.Param("payload", t.PayloadContent)
}
t.IsDelivered = true
// FIXME: record response.
switch t.Type {
case GOGS:
{
if resp, err := req.Response(); err != nil {
log.Error(5, "Delivery: %v", err)
} else {
resp.Body.Close()
t.IsSucceed = true
}
}
case SLACK:
{
if resp, err := req.Response(); err != nil {
log.Error(5, "Delivery: %v", err)
} else {
defer resp.Body.Close()
contents, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Error(5, "%s", err)
} else {
if string(contents) != "ok" {
log.Error(5, "slack failed with: %s", string(contents))
} else {
t.IsSucceed = true
}
}
}
}
// Record delivery information.
t.RequestInfo = &HookRequest{
Headers: map[string]string{},
}
for k, vals := range req.Headers() {
t.RequestInfo.Headers[k] = strings.Join(vals, ",")
}
t.Delivered = time.Now().UTC().UnixNano()
if t.IsSucceed {
log.Trace("Hook delivered(%s): %s", t.Uuid, t.PayloadContent)
t.ResponseInfo = &HookResponse{
Headers: map[string]string{},
}
defer func() {
t.Delivered = time.Now().UTC().UnixNano()
if t.IsSucceed {
log.Trace("Hook delivered: %s", t.UUID)
}
// Update webhook last delivery status.
w, err := GetWebhookByID(t.HookID)
if err != nil {
log.Error(5, "GetWebhookByID: %v", err)
return
}
if t.IsSucceed {
w.LastStatus = HOOK_STATUS_SUCCEED
} else {
w.LastStatus = HOOK_STATUS_FAILED
}
if err = UpdateWebhook(w); err != nil {
log.Error(5, "UpdateWebhook: %v", err)
return
}
}()
resp, err := req.Response()
if err != nil {
t.ResponseInfo.Body = fmt.Sprintf("Delivery: %v", err)
return
}
defer resp.Body.Close()
// Status code is 20x can be seen as succeed.
t.IsSucceed = resp.StatusCode/100 == 2
t.ResponseInfo.Status = resp.StatusCode
for k, vals := range resp.Header {
t.ResponseInfo.Headers[k] = strings.Join(vals, ",")
}
p, err := ioutil.ReadAll(resp.Body)
if err != nil {
t.ResponseInfo.Body = fmt.Sprintf("read body: %s", err)
return
}
t.ResponseInfo.Body = string(p)
switch t.Type {
case SLACK:
if t.ResponseInfo.Body != "ok" {
log.Error(5, "slack failed with: %s", t.ResponseInfo.Body)
t.IsSucceed = false
}
}
}
+4 -4
View File
@@ -112,7 +112,7 @@ func (fi bindataFileInfo) Sys() interface{} {
return nil
}
var _confAppIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xb4\x5a\x4b\x8f\xe3\x56\x76\xde\xf3\x57\x5c\x97\xe3\xb8\x1d\x48\xaa\x97\xfb\xe1\xb2\x2b\x69\x95\x44\xa9\x38\xad\x97\x49\xa9\xcb\xed\x46\x81\xc5\x22\xaf\x24\x76\x51\xa4\x9a\x97\xac\x6a\x19\x59\x8c\x91\x45\x80\x2c\x93\x41\xb2\x09\x82\x64\x11\x04\x98\x3c\x90\x41\x36\x33\x13\x64\x65\x64\xdf\xfd\x1f\x0c\xcf\xe4\x5f\xe4\x3b\xe7\x92\x12\x55\x5d\xee\xf1\x4c\x32\xe8\x46\x89\xba\x8f\x73\xef\xf9\xee\x79\x7c\xe7\x52\xef\x8b\x81\xf9\xd4\xb4\x05\xff\xe9\x0f\xdb\x56\xe7\x99\x18\x9f\x5a\x8e\xe8\x58\x3d\xd3\x78\x5f\x8c\x7a\x66\xd3\x31\x45\xbf\xf9\xc4\x14\xad\xd3\xe6\xa0\x6b\x3a\x62\x38\x10\xad\xa1\x6d\x9b\xce\x68\x38\x68\x5b\x83\xae\x68\x4d\x9c\xf1\xb0\x8f\xc6\x41\xc7\xea\xea\x99\xc6\xa7\xa2\xb9\x5c\x8a\xd8\x5b\x48\x91\xcd\xbd\x4c\xa8\x79\x72\xa3\x44\x12\x0b\x79\x2d\xd3\x95\x58\x7a\x33\x74\x84\x59\x24\x8d\xe6\x68\xe4\x0e\x9a\x7d\x53\x1c\x8b\x6e\x32\x53\x47\xf8\x2b\xba\x61\x26\x1c\x99\x5e\x87\xbe\x84\xa4\xd6\xdc\x8b\x31\x1c\x6d\xe1\x54\xac\x92\x5c\xa4\x79\x2c\xa2\xc4\xf7\xa2\x68\x65\xd8\x93\x81\x3b\x71\xb0\xfb\x63\x31\x0b\x33\x8c\x36\xc3\x6c\x2e\x53\xb1\x13\xc8\xeb\x9d\x9a\xd8\x59\xa6\x49\xb0\x23\x12\x34\x64\x52\x65\x68\x09\xe4\xd4\xcb\x23\xc8\x52\x7a\x0c\x4b\x80\xea\xb4\x01\x7c\x37\x8c\xe7\xa9\x5c\x26\x2a\xcc\x92\x74\x75\x6e\xd8\xc3\xe1\x58\x1c\x1b\x4e\xcb\xb6\x46\x63\x77\xfc\x6c\x44\xc3\x2e\x3d\x35\xc7\xb8\x3c\x3c\xc7\x7a\x83\x7c\x71\x89\xf5\x92\x29\x24\xaa\x5c\x2a\xad\xaf\x97\x4a\xd6\x59\x06\x22\x8c\xa1\xb7\x64\x95\x0d\xcb\x71\x26\xa6\x3b\x6a\x76\x81\x9b\x3b\x98\xf4\x21\x6c\x7f\x0f\xa2\x14\x94\x95\xe9\xb9\x31\xb2\x87\xe3\x61\x6b\xd8\x43\xfb\x3c\xcb\x96\x46\x7b\xd8\x6f\x5a\x03\x7c\x63\x75\xe7\x89\xca\x78\x47\xee\xc4\xa6\x21\x1f\xdc\x2b\xc7\x7f\xa4\x8e\x76\x77\x3f\xb8\xa7\x87\xe3\xcb\x07\xf7\x4e\xc7\xe3\x91\x3b\x1a\xda\xe3\x8f\xd4\xae\xc1\x5f\x9a\xed\x36\x50\x32\xd6\x1d\x10\x70\xb8\xb7\xb7\x07\x15\xda\xa1\xf2\x2e\x23\x29\x1c\xe7\x54\x4c\xa5\x97\xe5\xd8\xfc\xcd\x5c\xc6\x22\x4e\xa0\xc9\xb5\x17\x46\xd4\x6d\xb4\x2d\xa7\x79\xd2\x33\x5d\x1a\x76\x2c\xa6\x5e\xa4\xa4\x81\xe7\x52\xd8\xc1\x41\x45\x54\xab\x3d\xa0\xa3\x8e\x49\xfb\xe2\x0c\x16\x49\x20\x8d\x61\xa7\xd3\xb3\x06\x66\x09\xb8\x16\x52\x0a\xb6\x87\x93\xb1\x69\xbb\xbd\x61\x77\xdd\xf5\xa9\xe8\xca\x58\xa6\x5e\x06\x38\x33\xb9\x54\x47\x68\xf9\x03\xe1\x07\x80\x33\x9b\xef\x66\xc9\xee\x0c\x36\xb3\xeb\xe7\x2a\x4b\x16\xbb\x04\x99\xe2\x01\x0d\x6e\x17\xbe\x4c\x33\x51\xf7\xbd\xe3\x2c\xcd\xa5\xa8\x07\x39\x04\x85\x49\x7c\xfc\xe8\xe1\x83\xbd\xf9\xde\x62\x4f\x89\x3a\x61\x7a\xbc\x58\xd1\x47\x43\xbe\xf2\x16\xcb\x48\x36\xfc\x64\x61\x7c\x0a\x39\xc3\x54\x4c\xd3\x64\x21\x3c\xd1\x58\x4e\x5f\x89\x69\x08\xc5\xe4\xab\x65\x92\x66\x38\x56\xee\x81\xa9\x89\xb3\x30\x0e\xc8\xb8\x69\xb1\x70\x1a\xfa\x7a\xaf\x09\x30\xbc\x17\x24\x90\x42\x20\x4e\x93\x74\x26\x33\x91\x25\xc5\x7c\x9e\xb8\x4c\xc3\x6b\x1a\x7c\x25\x57\x1f\x69\xbd\x92\xa5\x8c\x95\x8a\xc4\xf2\xca\x57\xfb\x07\xa2\x0e\xf0\x48\x2a\xaf\x5e\x4f\xf2\xac\xf8\x26\x17\xa2\x1e\x27\x98\xa6\x7e\xd8\x2c\x8c\x2c\x27\x51\x87\xa2\x87\x40\x2a\xa3\x65\xda\x63\x97\xfc\x15\x70\x57\x21\xdc\x2d\x97\x31\x9e\x98\xcf\xee\x1c\x50\x48\xc4\xf2\x93\xe5\x12\xd6\x1f\xe1\xac\x23\xf2\x81\x4c\x02\x41\x52\xca\x8b\x03\xa0\x00\xb8\x7d\x8d\x1b\x9d\x17\x86\x57\xbc\x8f\x21\x40\x2b\x99\x1a\xc0\x22\xe7\xa7\x66\xf9\x4a\xfa\x39\x00\x36\x9c\x71\x73\x6c\xb5\x5c\xb6\xf7\x51\x73\x0c\x9b\xd3\x51\x25\x22\x88\x71\x8a\xc5\xa2\xdd\x2f\xad\x91\x50\xf9\x92\x60\x35\xcc\x01\x1b\x12\xb7\x6d\x4c\xa8\x87\xcd\x84\xf1\x4c\x47\x1d\x1c\x05\x8e\x24\xae\x47\xc9\x6c\x86\x63\xcc\xe1\x7a\xaa\x26\x7c\x2f\x16\x97\x52\xec\xcc\x93\x85\xd4\xe1\x02\x07\x15\xe1\x10\x77\x8c\x5e\x93\xc3\x1c\x79\x2d\xe1\x40\x23\xe0\xb1\x81\x97\x79\x88\x03\xf2\xbc\x12\x72\x16\x2b\xf5\x32\xe2\xa0\x03\x6b\x9a\xa5\x52\x69\x49\x68\x0c\x33\x79\x88\x8e\x30\xfb\x50\x51\x04\x4b\x85\x3f\x4f\x28\xb8\xb5\x4f\xca\x98\xc2\x73\x8d\xd3\xa1\x43\xae\xb4\x7f\xf0\xb0\xb1\x87\x7f\xfb\x47\x87\x87\x7b\x0f\x8c\x22\x3c\x92\x49\x1b\x45\xac\x4b\x93\x24\x33\x46\x4d\xc7\x39\x6b\x33\x2e\x1d\x5a\xa8\xb2\x6c\x1c\xad\x6a\x42\x96\xa1\x50\x3b\x25\xed\x2c\x95\x2f\xf3\x30\x2d\x54\x44\xc8\x09\xa7\xab\xfa\x34\x8f\xa2\x1d\x78\x72\x6f\x1d\x06\xf5\xf8\x52\x6c\xb9\x7f\x96\x6a\xe8\xa3\x10\xa4\x3f\x3b\x59\x23\xb8\x04\x1c\x5e\xb0\x08\xe3\x73\x8e\x64\x7e\x9e\x86\x19\x42\xa7\x35\xc0\x09\xf6\x7a\x70\xe7\xd6\x93\xca\x61\xbc\xf7\x9e\x4e\x24\x3a\xcf\x8c\x87\xe2\x89\x69\x8e\xc4\xb3\xe1\xc4\x16\xac\x5b\xbb\x39\x6e\x0a\xa7\xd9\x31\xdf\x7b\xcf\x70\xcc\x96\x6d\x8e\x5d\x58\x21\x04\xbc\xf7\xfe\xe3\x4e\xdb\x3c\xb3\xf1\xff\x0f\xff\xe8\x1e\xd9\x42\x9e\x25\x74\x8c\xb0\xf7\x54\x2e\x24\x87\xe1\xc0\x83\x53\x20\x80\x58\x03\xd7\x36\xfb\x66\xff\x04\xf1\xa4\xdd\x7c\xe6\x60\xfe\x43\xa3\x35\x1c\x3e\xb1\x4c\x4e\x17\x15\x48\x5d\xef\x46\x2a\x3a\xd4\xa2\x7b\x3d\xaf\x3a\x26\x8c\xfd\x54\x06\xa1\x46\xc5\xa6\x24\xa6\xc8\x81\x93\x57\x2b\xe1\xe5\x40\x39\xce\x4a\xab\x9c\x4b\x2f\xc0\x46\x38\xf5\xc1\x21\xc8\xbe\xf8\x8b\x61\x53\x92\x75\x10\xfd\xed\xe1\x17\xcf\xdc\xe6\x64\x7c\x6a\x0e\x60\xe0\x30\xf2\xe1\x3a\x85\x7d\x51\x3f\x33\x4f\xa8\xab\x4e\x0d\x45\x62\x80\xa1\x9c\x1b\Line truncated
var _confAppIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xb4\x5a\x4b\x8f\xe3\x56\x76\xde\xf3\x57\x5c\x97\xe3\xb8\x1d\x48\xaa\x97\xfb\xe1\xb2\x2b\x69\x95\x44\xa9\x38\xad\x97\x49\xa9\xcb\xed\x46\x81\xc5\x22\xaf\x24\x76\x51\xa4\x9a\x97\xac\x6a\x19\x59\x8c\x91\x45\x80\x2c\x93\x41\xb2\x09\x82\x64\x11\x04\x98\x3c\x90\x41\x36\x33\x13\x64\x65\x64\xdf\xfd\x1f\x0c\xcf\xe4\x5f\xe4\x3b\xe7\x92\x12\x55\x5d\xee\xf1\x4c\x32\xe8\x46\x89\xba\x8f\x73\xef\xf9\xee\x79\x7c\xe7\x52\xef\x8b\x81\xf9\xd4\xb4\x05\xff\xe9\x0f\xdb\x56\xe7\x99\x18\x9f\x5a\x8e\xe8\x58\x3d\xd3\x78\x5f\x8c\x7a\x66\xd3\x31\x45\xbf\xf9\xc4\x14\xad\xd3\xe6\xa0\x6b\x3a\x62\x38\x10\xad\xa1\x6d\x9b\xce\x68\x38\x68\x5b\x83\xae\x68\x4d\x9c\xf1\xb0\x8f\xc6\x41\xc7\xea\xea\x99\xc6\xa7\xa2\xb9\x5c\x8a\xd8\x5b\x48\x91\xcd\xbd\x4c\xa8\x79\x72\xa3\x44\x12\x0b\x79\x2d\xd3\x95\x58\x7a\x33\x74\x84\x59\x24\x8d\xe6\x68\xe4\x0e\x9a\x7d\x53\x1c\x8b\x6e\x32\x53\x47\xf8\x2b\xba\x61\x26\x1c\x99\x5e\x87\xbe\x84\xa4\xd6\xdc\x8b\x31\x1c\x6d\xe1\x54\xac\x92\x5c\xa4\x79\x2c\xa2\xc4\xf7\xa2\x68\x65\xd8\x93\x81\x3b\x71\xb0\xfb\x63\x31\x0b\x33\x8c\x36\xc3\x6c\x2e\x53\xb1\x13\xc8\xeb\x9d\x9a\xd8\x59\xa6\x49\xb0\x23\x12\x34\x64\x52\x65\x68\x09\xe4\xd4\xcb\x23\xc8\x52\x7a\x0c\x4b\x80\xea\xb4\x01\x7c\x37\x8c\xe7\xa9\x5c\x26\x2a\xcc\x92\x74\x75\x6e\xd8\xc3\xe1\x58\x1c\x1b\x4e\xcb\xb6\x46\x63\x77\xfc\x6c\x44\xc3\x2e\x3d\x35\xc7\xb8\x3c\x3c\xc7\x7a\x83\x7c\x71\x89\xf5\x92\x29\x24\xaa\x5c\x2a\xad\xaf\x97\x4a\xd6\x59\x06\x22\x8c\xa1\xb7\x64\x95\x0d\xcb\x71\x26\xa6\x3b\x6a\x76\x81\x9b\x3b\x98\xf4\x21\x6c\x7f\x0f\xa2\x14\x94\x95\xe9\xb9\x31\xb2\x87\xe3\x61\x6b\xd8\x43\xfb\x3c\xcb\x96\x46\x7b\xd8\x6f\x5a\x03\x7c\x63\x75\xe7\x89\xca\x78\x47\xee\xc4\xa6\x21\x1f\xdc\x2b\xc7\x7f\xa4\x8e\x76\x77\x3f\xb8\xa7\x87\xe3\xcb\x07\xf7\x4e\xc7\xe3\x91\x3b\x1a\xda\xe3\x8f\xd4\xae\xc1\x5f\x9a\xed\x36\x50\x32\xd6\x1d\x10\x70\xb8\xb7\xb7\x07\x15\xda\xa1\xf2\x2e\x23\x29\x1c\xe7\x54\x4c\xa5\x97\xe5\xd8\xfc\xcd\x5c\xc6\x22\x4e\xa0\xc9\xb5\x17\x46\xd4\x6d\xb4\x2d\xa7\x79\xd2\x33\x5d\x1a\x76\x2c\xa6\x5e\xa4\xa4\x81\xe7\x52\xd8\xc1\x41\x45\x54\xab\x3d\xa0\xa3\x8e\x49\xfb\xe2\x0c\x16\x49\x20\x8d\x61\xa7\xd3\xb3\x06\x66\x09\xb8\x16\x52\x0a\xb6\x87\x93\xb1\x69\xbb\xbd\x61\x77\xdd\xf5\xa9\xe8\xca\x58\xa6\x5e\x06\x38\x33\xb9\x54\x47\x68\xf9\x03\xe1\x07\x80\x33\x9b\xef\x66\xc9\xee\x0c\x36\xb3\xeb\xe7\x2a\x4b\x16\xbb\x04\x99\xe2\x01\x0d\x6e\x17\xbe\x4c\x33\x51\xf7\xbd\xe3\x2c\xcd\xa5\xa8\x07\x39\x04\x85\x49\x7c\xfc\xe8\xe1\x83\xbd\xf9\xde\x62\x4f\x89\x3a\x61\x7a\xbc\x58\xd1\x47\x43\xbe\xf2\x16\xcb\x48\x36\xfc\x64\x61\x7c\x0a\x39\xc3\x54\x4c\xd3\x64\x21\x3c\xd1\x58\x4e\x5f\x89\x69\x08\xc5\xe4\xab\x65\x92\x66\x38\x56\xee\x81\xa9\x89\xb3\x30\x0e\xc8\xb8\x69\xb1\x70\x1a\xfa\x7a\xaf\x09\x30\xbc\x17\x24\x90\x42\x20\x4e\x93\x74\x26\x33\x91\x25\xc5\x7c\x9e\xb8\x4c\xc3\x6b\x1a\x7c\x25\x57\x1f\x69\xbd\x92\xa5\x8c\x95\x8a\xc4\xf2\xca\x57\xfb\x07\xa2\x0e\xf0\x48\x2a\xaf\x5e\x4f\xf2\xac\xf8\x26\x17\xa2\x1e\x27\x98\xa6\x7e\xd8\x2c\x8c\x2c\x27\x51\x87\xa2\x87\x40\x2a\xa3\x65\xda\x63\x97\xfc\x15\x70\x57\x21\xdc\x2d\x97\x31\x9e\x98\xcf\xee\x1c\x50\x48\xc4\xf2\x93\xe5\x12\xd6\x1f\xe1\xac\x23\xf2\x81\x4c\x02\x41\x52\xca\x8b\x03\xa0\x00\xb8\x7d\x8d\x1b\x9d\x17\x86\x57\xbc\x8f\x21\x40\x2b\x99\x1a\xc0\x22\xe7\xa7\x66\xf9\x4a\xfa\x39\x00\x36\x9c\x71\x73\x6c\xb5\x5c\xb6\xf7\x51\x73\x0c\x9b\xd3\x51\x25\x22\x88\x71\x8a\xc5\xa2\xdd\x2f\xad\x91\x50\xf9\x92\x60\x35\xcc\x01\x1b\x12\xb7\x6d\x4c\xa8\x87\xcd\x84\xf1\x4c\x47\x1d\x1c\x05\x8e\x24\xae\x47\xc9\x6c\x86\x63\xcc\xe1\x7a\xaa\x26\x7c\x2f\x16\x97\x52\xec\xcc\x93\x85\xd4\xe1\x02\x07\x15\xe1\x10\x77\x8c\x5e\x93\xc3\x1c\x79\x2d\xe1\x40\x23\xe0\xb1\x81\x97\x79\x88\x03\xf2\xbc\x12\x72\x16\x2b\xf5\x32\xe2\xa0\x03\x6b\x9a\xa5\x52\x69\x49\x68\x0c\x33\x79\x88\x8e\x30\xfb\x50\x51\x04\x4b\x85\x3f\x4f\x28\xb8\xb5\x4f\xca\x98\xc2\x73\x8d\xd3\xa1\x43\xae\xb4\x7f\xf0\xb0\xb1\x87\x7f\xfb\x47\x87\x87\x7b\x0f\x8c\x22\x3c\x92\x49\x1b\x45\xac\x4b\x93\x24\x33\x46\x4d\xc7\x39\x6b\x33\x2e\x1d\x5a\xa8\xb2\x6c\x1c\xad\x6a\x42\x96\xa1\x50\x3b\x25\xed\x2c\x95\x2f\xf3\x30\x2d\x54\x44\xc8\x09\xa7\xab\xfa\x34\x8f\xa2\x1d\x78\x72\x6f\x1d\x06\xf5\xf8\x52\x6c\xb9\x7f\x96\x6a\xe8\xa3\x10\xa4\x3f\x3b\x59\x23\xb8\x04\x1c\x5e\xb0\x08\xe3\x73\x8e\x64\x7e\x9e\x86\x19\x42\xa7\x35\xc0\x09\xf6\x7a\x70\xe7\xd6\x93\xca\x61\xbc\xf7\x9e\x4e\x24\x3a\xcf\x8c\x87\xe2\x89\x69\x8e\xc4\xb3\xe1\xc4\x16\xac\x5b\xbb\x39\x6e\x0a\xa7\xd9\x31\xdf\x7b\xcf\x70\xcc\x96\x6d\x8e\x5d\x58\x21\x04\xbc\xf7\xfe\xe3\x4e\xdb\x3c\xb3\xf1\xff\x0f\xff\xe8\x1e\xd9\x42\x9e\x25\x74\x8c\xb0\xf7\x54\x2e\x24\x87\xe1\xc0\x83\x53\x20\x80\x58\x03\xd7\x36\xfb\x66\xff\x04\xf1\xa4\xdd\x7c\xe6\x60\xfe\x43\xa3\x35\x1c\x3e\xb1\x4c\x4e\x17\x15\x48\x5d\xef\x46\x2a\x3a\xd4\xa2\x7b\x3d\xaf\x3a\x26\x8c\xfd\x54\x06\xa1\x46\xc5\xa6\x24\xa6\xc8\x81\x93\x57\x2b\xe1\xe5\x40\x39\xce\x4a\xab\x9c\x4b\x2f\xc0\x46\x38\xf5\xc1\x21\xc8\xbe\xf8\x8b\x61\x53\x92\x75\x10\xfd\xed\xe1\x17\xcf\xdc\xe6\x64\x7c\x6a\x0e\x60\xe0\x30\xf2\xe1\x3a\x85\x7d\x51\x3f\x33\x4f\xa8\xab\x4e\x0d\x45\x62\x80\xa1\x9c\x1b\Line truncated
func confAppIniBytes() ([]byte, error) {
return bindataRead(
@@ -127,7 +127,7 @@ func confAppIni() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "conf/app.ini", size: 9508, mode: os.FileMode(420), modTime: time.Unix(1439835459, 0)}
info := bindataFileInfo{name: "conf/app.ini", size: 9569, mode: os.FileMode(420), modTime: time.Unix(1440682245, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -772,7 +772,7 @@ func confLocaleLocale_deDeIni() (*asset, error) {
return a, nil
}
var _confLocaleLocale_enUsIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xc4\x7d\xfd\x72\xdb\x48\x92\xe7\xff\x78\x0a\xb4\x37\x7c\x76\x47\xc8\x74\x74\x4f\xdc\x47\x4c\xd8\xee\x93\xa5\xf6\xc7\xac\x65\x69\x2d\x79\xe6\xe6\x1c\x0e\x34\x48\x40\x24\x46\x24\xc0\x06\x40\xd1\x9a\x8d\x8d\xb8\xd7\xb8\xd7\xbb\x27\xb9\xcc\x5f\x66\xd6\x07\x00\xca\xf6\xec\xc6\xdd\x3f\x64\xa1\x2a\xeb\x2b\x2b\x2b\x2b\x2b\x2b\x2b\x2b\xdf\x6e\xb3\xa2\xec\x16\xe9\xf3\xf4\x38\xdd\xe6\x55\xbd\x2e\xbb\x2e\xed\xca\xf5\xf5\x93\x55\xd3\xf5\x65\x91\xbe\xae\x7a\xfa\x6e\x6f\xab\x45\x99\x24\xab\x66\x53\x12\xe8\x1b\xfa\x4b\x8a\xbc\x5b\xcd\x9b\xbc\x2d\x28\xe2\xd4\xc2\x49\xf9\x65\xbb\x6e\x5a\x06\xfa\x55\x42\xc9\xaa\x5c\x6f\x39\x0f\xfd\x25\x5d\xb5\xac\xb3\xaa\xa6\xcf\x4b\x0a\xa5\x6f\xeb\xa4\x6b\x16\x55\xbe\xce\x82\x04\x44\x58\xfa\x1f\xd3\x9f\xeb\x22\xbd\xec\xcb\x6d\xfa\xac\xdb\xe4\xeb\xf5\x8b\xbc\x43\x96\xbe\x4c\xf3\xc5\xa2\xd9\xd5\xfd\xb3\xa7\x92\x20\x85\x37\xbb\xde\x4a\x3f\xdf\xf5\x12\xb7\xdb\x5a\xd4\xc7\x6d\xd2\x96\xcb\x8a\x3a\xd6\x52\xd4\x07\x0d\x26\xfb\x72\xde\x55\x3d\x37\xfa\x2f\x12\x4a\x6e\xcb\xb6\xab\x1a\x6e\xcf\x9f\x25\x94\x6c\xf3\x25\x03\x5c\xd0\x5f\xd2\x97\x9b\xed\x3a\x47\x86\x2b\x0d\x26\xeb\xbc\x5e\xee\x04\xe6\x9d\x06\x93\x45\x5b\x52\x52\x56\x97\x7b\x8a\x3d\xc1\x47\x4a\x1f\xb3\xd9\x2c\xd9\x11\x4e\xb3\x6d\xdb\x5c\x57\xeb\x32\xcb\xeb\x22\xdb\x08\xd6\x3e\x52\x7c\xaa\xf1\x29\xc5\xa7\x1c\x8f\x6e\x94\x05\x21\x28\xcb\x3b\xed\x0b\x0d\x0d\xe1\x2b\xef\x12\x14\x55\xe7\x1b\xcb\xcd\xc1\xa4\xdc\xe4\xd5\x9a\x07\xe1\x09\x07\xa8\xf1\x5d\xb7\x6f\x30\x54\x17\x1a\x24\x44\x64\xfd\xdd\xb6\x04\x1e\x9e\x5c\x51\x28\x59\xe4\xdb\x7e\xb1\xca\xb9\xad\x12\x4a\x08\x68\xdb\x10\x42\x9a\xf6\x0e\x70\xf6\x91\x34\xed\x32\xaf\xab\xbf\xe7\xbd\x20\xe9\x3c\xf8\x4c\x36\x55\xdb\x36\x8c\xdf\x33\x04\x12\xea\x71\xc6\xe5\x50\xcc\x7b\xc2\x44\x50\x0a\xa7\x6c\xaa\x65\x2b\xa8\xe4\xc4\x33\x7c\x71\x29\x9c\x76\xdd\xb4\x37\x9a\xf0\x8a\x83\x83\xac\xd4\x08\x4d\x8d\xeb\xcf\x6b\x42\xbe\xa6\x9e\xe1\x23\x02\xe8\x92\xbc\xd8\x10\x2a\xb7\x79\x5d\x32\x8e\x8e\xf9\x8b\xf0\x42\x5f\x89\xd2\x54\xd6\x95\x7d\x5f\xd5\x4b\x46\xf6\xb1\x44\xa5\x97\x1a\x95\x04\x69\x2e\xee\xae\xd9\xb9\xe1\xa4\xf8\xbf\xd2\x67\x7a\x21\x9f\x92\x16\x64\x42\xa2\xcb\xc9\x3d\xe9\xb2\xeb\xb2\x2c\xa4\x2f\x5d\xfa\x8a\xc2\xc9\x76\xb7\x5e\x13\xd6\x7e\xdf\x95\x5d\xcf\x99\x2e\xe8\x9b\xfa\x2f\xdf\x49\xd5\x75\x14\xa0\xe8\xb7\x08\x24\x34\x74\xf5\x02\x9d\x39\x41\x20\x49\x3e\x75\x65\xde\x2e\x56\x9f\x13\xf9\x47\x5b\x39\xc0\xb4\x77\x68\x50\x99\x90\x94\x88\xa4\x06\xab\x20\x59\x34\x05\x7f\x9c\xd0\x1f\x15\x5d\xd5\x5d\x4f\x33\xee\x73\xa2\x01\x06\x93\x90\x0c\x40\x5f\xf5\xc0\x82\x46\x62\xfa\x76\x3c\x82\xe9\xab\xaa\xed\xfa\x27\x7d\x45\xc4\xfa\x61\x57\x27\xdc\x3f\x9a\x6d\x59\x31\x37\x26\xf4\xba\x21\x14\x21\xba\xa5\xfe\x9d\xdd\x5d\xfe\xcb\xbb\xa3\xf4\x82\x38\xd1\xb2\x2d\x29\x9c\x52\x19\xf4\x47\x79\xfe\x30\x4b\x28\x97\xd5\x74\x9a\xf7\xf9\x3c\xef\x4a\x8f\x56\x4e\x14\xea\x76\x69\xa0\x71\xe6\x6a\xe0\x60\x5d\x1f\xf5\x77\x6a\x86\x50\x19\x3a\xaf\x5c\x19\xef\x79\x72\x51\x3c\x33\x35\x64\xbe\x58\x97\x1c\x4f\x45\xa5\x6f\xdf\xbf\x3f\x3f\x7d\x99\x96\xf5\xb2\xaa\xcb\x74\x5f\xf5\xab\x74\xd7\x5f\xff\xb7\x6c\x59\xd6\x65\x4b\x3c\x6e\x51\xa5\x34\xa7\x5a\xa2\x84\x94\x08\x5b\x3a\x37\x4b\xba\x6e\x4d\x73\x1f\xe8\xbd\xbc\x7c\x97\x9e\x31\x8a\xb7\x79\xbf\x42\x43\xfa\x55\xd2\xfd\xbe\x66\x14\xb9\x0a\xaf\x56\x65\x0a\x2a\x03\x50\x73\x6d\xf8\x48\x0b\x6d\xe3\x2c\x29\xdb\x36\x23\xb6\xd4\xdf\x65\x9a\x59\xcb\x1b\x42\x4a\x11\x44\x3a\x75\xd3\xa7\xf3\x32\x45\x9e\x59\x92\x58\x83\x0d\xbb\xc7\xdb\xed\xba\x5a\xc8\x5c\x7f\x2d\x69\x1e\xd1\xbc\x82\x28\x96\x42\x38\x20\xca\xd2\x02\x74\x11\x7b\xe6\xf9\x90\x46\x0c\x04\xf9\x57\x25\x31\xc0\xd5\x6e\x29\x6c\x6f\xdd\xec\x8a\x1f\x40\xa9\xd6\x7a\x4f\xa8\xe9\x87\x86\x1a\x0c\xec\x38\x00\x5f\xc5\x31\x51\x1c\x2f\x5a\x6d\xb9\x69\x88\xaf\x38\x62\xaf\x88\xa0\xf6\x15\x25\x52\x4f\xbb\xfc\x96\xe6\x5b\xdf\xa4\xfd\xaa\xea\xd2\x82\x88\x6d\xc1\x05\xd3\xd4\xd8\xd1\x72\x21\x64\x41\x04\x2a\xa4\x61\x71\xf1\x18\x00\x6a\xb3\x23\x6a\x5a\x51\x61\xbc\x18\xf1\xca\x49\x45\x4e\xb5\x13\x5d\xa2\x72\x40\xdf\x44\xb9\x0d\x71\x65\xe6\x9b\xa7\x08\xe8\x77\x58\x3e\xb5\x2a\xbf\xbe\xa6\x56\x75\x44\x15\x6f\xd2\xc5\xba\x21\x92\xfa\xf8\xe1\x5d\xc7\x04\xb3\xca\xb6\x4d\x8b\x65\x8e\x92\x2e\x28\xe8\xe2\x02\x44\x33\x44\xbd\xdb\xcc\xe9\x6b\xbf\xaa\x88\x03\x00\xed\x9c\x83\x57\x73\x8a\xa5\x2a\x76\x1d\x0d\xe1\x51\x4a\x24\x4c\x3d\x20\x94\x81\x00\xb8\x0f\x45\xd5\xe5\x73\x1a\x7b\x06\xbf\xa6\x65\x6b\xd7\x12\x59\xad\xfa\x7e\x6b\x35\xbf\xb9\xba\xba\x90\xaa\x5d\xec\x7d\x75\xe7\x01\x65\x60\x0c\xd6\xbc\xf0\xd6\x69\x53\xcf\x40\x24\xbb\x76\x3d\xa0\x1f\xea\xab\xa5\x1c\xc0\x0b\x37\xe1\x29\xff\x5c\x7a\xf4\x00\xcf\x1d\x49\x27\x7b\x50\x13\xe1\xb8\xc4\x02\x48\x44\xdd\x6c\xb9\xdc\x80\xaa\xcf\x35\xc2\x93\x32\x16\x4d\x97\x2e\x4b\x27\xa5\x42\xf6\x09\xd8\xff\x86\x3a\xac\x6c\xe4\xf2\x8c\xd0\x00\x5e\x82\xd8\xeb\xb6\xd9\x50\xec\x2b\xfa\xf3\x11\xbe\xf9\x67\x5c\x1e\x60\xf2\xa2\x20\xfe\xd6\x1d\xa5\x1f\x5e\x9d\xa4\xff\xf9\x0f\x3f\xff\x3c\x4b\xdf\xf6\x3c\x13\x99\x38\xff\xc6\x44\x45\x41\x59\xc3\x1d\x28\xb1\x8c\x9e\xe8\xee\x01\xcf\xac\x07\xe9\x3Line truncated
var _confLocaleLocale_enUsIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xc4\x7d\xfd\x72\xdb\x48\x92\xe7\xff\x78\x0a\xb4\x37\x7c\x76\x47\xc8\x74\x74\x4f\xdc\x47\x4c\xd8\xee\x93\xa5\xf6\xc7\xac\x65\x69\x2d\x79\xe6\xe6\x1c\x0e\x34\x48\x40\x24\x46\x24\xc0\x06\x40\xd1\x9a\x8d\x8d\xb8\xd7\xb8\xd7\xbb\x27\xb9\xcc\x5f\x66\xd6\x07\x00\xca\xf6\xec\xc6\xdd\x3f\x64\xa1\x2a\xeb\x2b\x2b\x2b\x2b\x2b\x2b\x2b\x2b\xdf\x6e\xb3\xa2\xec\x16\xe9\xf3\xf4\x38\xdd\xe6\x55\xbd\x2e\xbb\x2e\xed\xca\xf5\xf5\x93\x55\xd3\xf5\x65\x91\xbe\xae\x7a\xfa\x6e\x6f\xab\x45\x99\x24\xab\x66\x53\x12\xe8\x1b\xfa\x4b\x8a\xbc\x5b\xcd\x9b\xbc\x2d\x28\xe2\xd4\xc2\x49\xf9\x65\xbb\x6e\x5a\x06\xfa\x55\x42\xc9\xaa\x5c\x6f\x39\x0f\xfd\x25\x5d\xb5\xac\xb3\xaa\xa6\xcf\x4b\x0a\xa5\x6f\xeb\xa4\x6b\x16\x55\xbe\xce\x82\x04\x44\x58\xfa\x1f\xd3\x9f\xeb\x22\xbd\xec\xcb\x6d\xfa\xac\xdb\xe4\xeb\xf5\x8b\xbc\x43\x96\xbe\x4c\xf3\xc5\xa2\xd9\xd5\xfd\xb3\xa7\x92\x20\x85\x37\xbb\xde\x4a\x3f\xdf\xf5\x12\xb7\xdb\x5a\xd4\xc7\x6d\xd2\x96\xcb\x8a\x3a\xd6\x52\xd4\x07\x0d\x26\xfb\x72\xde\x55\x3d\x37\xfa\x2f\x12\x4a\x6e\xcb\xb6\xab\x1a\x6e\xcf\x9f\x25\x94\x6c\xf3\x25\x03\x5c\xd0\x5f\xd2\x97\x9b\xed\x3a\x47\x86\x2b\x0d\x26\xeb\xbc\x5e\xee\x04\xe6\x9d\x06\x93\x45\x5b\x52\x52\x56\x97\x7b\x8a\x3d\xc1\x47\x4a\x1f\xb3\xd9\x2c\xd9\x11\x4e\xb3\x6d\xdb\x5c\x57\xeb\x32\xcb\xeb\x22\xdb\x08\xd6\x3e\x52\x7c\xaa\xf1\x29\xc5\xa7\x1c\x8f\x6e\x94\x05\x21\x28\xcb\x3b\xed\x0b\x0d\x0d\xe1\x2b\xef\x12\x14\x55\xe7\x1b\xcb\xcd\xc1\xa4\xdc\xe4\xd5\x9a\x07\xe1\x09\x07\xa8\xf1\x5d\xb7\x6f\x30\x54\x17\x1a\x24\x44\x64\xfd\xdd\xb6\x04\x1e\x9e\x5c\x51\x28\x59\xe4\xdb\x7e\xb1\xca\xb9\xad\x12\x4a\x08\x68\xdb\x10\x42\x9a\xf6\x0e\x70\xf6\x91\x34\xed\x32\xaf\xab\xbf\xe7\xbd\x20\xe9\x3c\xf8\x4c\x36\x55\xdb\x36\x8c\xdf\x33\x04\x12\xea\x71\xc6\xe5\x50\xcc\x7b\xc2\x44\x50\x0a\xa7\x6c\xaa\x65\x2b\xa8\xe4\xc4\x33\x7c\x71\x29\x9c\x76\xdd\xb4\x37\x9a\xf0\x8a\x83\x83\xac\xd4\x08\x4d\x8d\xeb\xcf\x6b\x42\xbe\xa6\x9e\xe1\x23\x02\xe8\x92\xbc\xd8\x10\x2a\xb7\x79\x5d\x32\x8e\x8e\xf9\x8b\xf0\x42\x5f\x89\xd2\x54\xd6\x95\x7d\x5f\xd5\x4b\x46\xf6\xb1\x44\xa5\x97\x1a\x95\x04\x69\x2e\xee\xae\xd9\xb9\xe1\xa4\xf8\xbf\xd2\x67\x7a\x21\x9f\x92\x16\x64\x42\xa2\xcb\xc9\x3d\xe9\xb2\xeb\xb2\x2c\xa4\x2f\x5d\xfa\x8a\xc2\xc9\x76\xb7\x5e\x13\xd6\x7e\xdf\x95\x5d\xcf\x99\x2e\xe8\x9b\xfa\x2f\xdf\x49\xd5\x75\x14\xa0\xe8\xb7\x08\x24\x34\x74\xf5\x02\x9d\x39\x41\x20\x49\x3e\x75\x65\xde\x2e\x56\x9f\x13\xf9\x47\x5b\x39\xc0\xb4\x77\x68\x50\x99\x90\x94\x88\xa4\x06\xab\x20\x59\x34\x05\x7f\x9c\xd0\x1f\x15\x5d\xd5\x5d\x4f\x33\xee\x73\xa2\x01\x06\x93\x90\x0c\x40\x5f\xf5\xc0\x82\x46\x62\xfa\x76\x3c\x82\xe9\xab\xaa\xed\xfa\x27\x7d\x45\xc4\xfa\x61\x57\x27\xdc\x3f\x9a\x6d\x59\x31\x37\x26\xf4\xba\x21\x14\x21\xba\xa5\xfe\x9d\xdd\x5d\xfe\xcb\xbb\xa3\xf4\x82\x38\xd1\xb2\x2d\x29\x9c\x52\x19\xf4\x47\x79\xfe\x30\x4b\x28\x97\xd5\x74\x9a\xf7\xf9\x3c\xef\x4a\x8f\x56\x4e\x14\xea\x76\x69\xa0\x71\xe6\x6a\xe0\x60\x5d\x1f\xf5\x77\x6a\x86\x50\x19\x3a\xaf\x5c\x19\xef\x79\x72\x51\x3c\x33\x35\x64\xbe\x58\x97\x1c\x4f\x45\xa5\x6f\xdf\xbf\x3f\x3f\x7d\x99\x96\xf5\xb2\xaa\xcb\x74\x5f\xf5\xab\x74\xd7\x5f\xff\xb7\x6c\x59\xd6\x65\x4b\x3c\x6e\x51\xa5\x34\xa7\x5a\xa2\x84\x94\x08\x5b\x3a\x37\x4b\xba\x6e\x4d\x73\x1f\xe8\xbd\xbc\x7c\x97\x9e\x31\x8a\xb7\x79\xbf\x42\x43\xfa\x55\xd2\xfd\xbe\x66\x14\xb9\x0a\xaf\x56\x65\x0a\x2a\x03\x50\x73\x6d\xf8\x48\x0b\x6d\xe3\x2c\x29\xdb\x36\x23\xb6\xd4\xdf\x65\x9a\x59\xcb\x1b\x42\x4a\x11\x44\x3a\x75\xd3\xa7\xf3\x32\x45\x9e\x59\x92\x58\x83\x0d\xbb\xc7\xdb\xed\xba\x5a\xc8\x5c\x7f\x2d\x69\x1e\xd1\xbc\x82\x28\x96\x42\x38\x20\xca\xd2\x02\x74\x11\x7b\xe6\xf9\x90\x46\x0c\x04\xf9\x57\x25\x31\xc0\xd5\x6e\x29\x6c\x6f\xdd\xec\x8a\x1f\x40\xa9\xd6\x7a\x4f\xa8\xe9\x87\x86\x1a\x0c\xec\x38\x00\x5f\xc5\x31\x51\x1c\x2f\x5a\x6d\xb9\x69\x88\xaf\x38\x62\xaf\x88\xa0\xf6\x15\x25\x52\x4f\xbb\xfc\x96\xe6\x5b\xdf\xa4\xfd\xaa\xea\xd2\x82\x88\x6d\xc1\x05\xd3\xd4\xd8\xd1\x72\x21\x64\x41\x04\x2a\xa4\x61\x71\xf1\x18\x00\x6a\xb3\x23\x6a\x5a\x51\x61\xbc\x18\xf1\xca\x49\x45\x4e\xb5\x13\x5d\xa2\x72\x40\xdf\x44\xb9\x0d\x71\x65\xe6\x9b\xa7\x08\xe8\x77\x58\x3e\xb5\x2a\xbf\xbe\xa6\x56\x75\x44\x15\x6f\xd2\xc5\xba\x21\x92\xfa\xf8\xe1\x5d\xc7\x04\xb3\xca\xb6\x4d\x8b\x65\x8e\x92\x2e\x28\xe8\xe2\x02\x44\x33\x44\xbd\xdb\xcc\xe9\x6b\xbf\xaa\x88\x03\x00\xed\x9c\x83\x57\x73\x8a\xa5\x2a\x76\x1d\x0d\xe1\x51\x4a\x24\x4c\x3d\x20\x94\x81\x00\xb8\x0f\x45\xd5\xe5\x73\x1a\x7b\x06\xbf\xa6\x65\x6b\xd7\x12\x59\xad\xfa\x7e\x6b\x35\xbf\xb9\xba\xba\x90\xaa\x5d\xec\x7d\x75\xe7\x01\x65\x60\x0c\xd6\xbc\xf0\xd6\x69\x53\xcf\x40\x24\xbb\x76\x3d\xa0\x1f\xea\xab\xa5\x1c\xc0\x0b\x37\xe1\x29\xff\x5c\x7a\xf4\x00\xcf\x1d\x49\x27\x7b\x50\x13\xe1\xb8\xc4\x02\x48\x44\xdd\x6c\xb9\xdc\x80\xaa\xcf\x35\xc2\x93\x32\x16\x4d\x97\x2e\x4b\x27\xa5\x42\xf6\x09\xd8\xff\x86\x3a\xac\x6c\xe4\xf2\x8c\xd0\x00\x5e\x82\xd8\xeb\xb6\xd9\x50\xec\x2b\xfa\xf3\x11\xbe\xf9\x67\x5c\x1e\x60\xf2\xa2\x20\xfe\xd6\x1d\xa5\x1f\x5e\x9d\xa4\xff\xf9\x0f\x3f\xff\x3c\x4b\xdf\xf6\x3c\x13\x99\x38\xff\xc6\x44\x45\x41\x59\xc3\x1d\x28\xb1\x8c\x9e\xe8\xee\x01\xcf\xac\x07\xe9\x3Line truncated
func confLocaleLocale_enUsIniBytes() ([]byte, error) {
return bindataRead(
@@ -787,7 +787,7 @@ func confLocaleLocale_enUsIni() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 39196, mode: os.FileMode(420), modTime: time.Unix(1440655385, 0)}
info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 39367, mode: os.FileMode(420), modTime: time.Unix(1440687482, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
+123 -122
View File
@@ -5,8 +5,6 @@
package httplib
// NOTE: last sync 57e62e5 on Oct 29, 2014.
import (
"bytes"
"crypto/tls"
@@ -27,7 +25,7 @@ import (
"time"
)
var defaultSetting = BeegoHttpSettings{false, "beegoServer", 60 * time.Second, 60 * time.Second, nil, nil, nil, false}
var defaultSetting = Settings{false, "GogsServer", 60 * time.Second, 60 * time.Second, nil, nil, nil, false}
var defaultCookieJar http.CookieJar
var settingMutex sync.Mutex
@@ -39,7 +37,7 @@ func createDefaultCookie() {
}
// Overwrite default settings
func SetDefaultSetting(setting BeegoHttpSettings) {
func SetDefaultSetting(setting Settings) {
settingMutex.Lock()
defer settingMutex.Unlock()
defaultSetting = setting
@@ -51,8 +49,8 @@ func SetDefaultSetting(setting BeegoHttpSettings) {
}
}
// return *BeegoHttpRequest with specific method
func newBeegoRequest(url, method string) *BeegoHttpRequest {
// return *Request with specific method
func newBeegoRequest(url, method string) *Request {
var resp http.Response
req := http.Request{
Method: method,
@@ -61,36 +59,35 @@ func newBeegoRequest(url, method string) *BeegoHttpRequest {
ProtoMajor: 1,
ProtoMinor: 1,
}
return &BeegoHttpRequest{url, &req, map[string]string{}, map[string]string{}, defaultSetting, &resp, nil}
return &Request{url, &req, map[string]string{}, map[string]string{}, defaultSetting, &resp, nil}
}
// Get returns *BeegoHttpRequest with GET method.
func Get(url string) *BeegoHttpRequest {
// Get returns *Request with GET method.
func Get(url string) *Request {
return newBeegoRequest(url, "GET")
}
// Post returns *BeegoHttpRequest with POST method.
func Post(url string) *BeegoHttpRequest {
// Post returns *Request with POST method.
func Post(url string) *Request {
return newBeegoRequest(url, "POST")
}
// Put returns *BeegoHttpRequest with PUT method.
func Put(url string) *BeegoHttpRequest {
// Put returns *Request with PUT method.
func Put(url string) *Request {
return newBeegoRequest(url, "PUT")
}
// Delete returns *BeegoHttpRequest DELETE method.
func Delete(url string) *BeegoHttpRequest {
// Delete returns *Request DELETE method.
func Delete(url string) *Request {
return newBeegoRequest(url, "DELETE")
}
// Head returns *BeegoHttpRequest with HEAD method.
func Head(url string) *BeegoHttpRequest {
// Head returns *Request with HEAD method.
func Head(url string) *Request {
return newBeegoRequest(url, "HEAD")
}
// BeegoHttpSettings
type BeegoHttpSettings struct {
type Settings struct {
ShowDebug bool
UserAgent string
ConnectTimeout time.Duration
@@ -101,93 +98,97 @@ type BeegoHttpSettings struct {
EnableCookie bool
}
// BeegoHttpRequest provides more useful methods for requesting one url than http.Request.
type BeegoHttpRequest struct {
// HttpRequest provides more useful methods for requesting one url than http.Request.
type Request struct {
url string
req *http.Request
params map[string]string
files map[string]string
setting BeegoHttpSettings
setting Settings
resp *http.Response
body []byte
}
// Change request settings
func (b *BeegoHttpRequest) Setting(setting BeegoHttpSettings) *BeegoHttpRequest {
b.setting = setting
return b
func (r *Request) Setting(setting Settings) *Request {
r.setting = setting
return r
}
// SetBasicAuth sets the request's Authorization header to use HTTP Basic Authentication with the provided username and password.
func (b *BeegoHttpRequest) SetBasicAuth(username, password string) *BeegoHttpRequest {
b.req.SetBasicAuth(username, password)
return b
func (r *Request) SetBasicAuth(username, password string) *Request {
r.req.SetBasicAuth(username, password)
return r
}
// SetEnableCookie sets enable/disable cookiejar
func (b *BeegoHttpRequest) SetEnableCookie(enable bool) *BeegoHttpRequest {
b.setting.EnableCookie = enable
return b
func (r *Request) SetEnableCookie(enable bool) *Request {
r.setting.EnableCookie = enable
return r
}
// SetUserAgent sets User-Agent header field
func (b *BeegoHttpRequest) SetUserAgent(useragent string) *BeegoHttpRequest {
b.setting.UserAgent = useragent
return b
func (r *Request) SetUserAgent(useragent string) *Request {
r.setting.UserAgent = useragent
return r
}
// Debug sets show debug or not when executing request.
func (b *BeegoHttpRequest) Debug(isdebug bool) *BeegoHttpRequest {
b.setting.ShowDebug = isdebug
return b
func (r *Request) Debug(isdebug bool) *Request {
r.setting.ShowDebug = isdebug
return r
}
// SetTimeout sets connect time out and read-write time out for BeegoRequest.
func (b *BeegoHttpRequest) SetTimeout(connectTimeout, readWriteTimeout time.Duration) *BeegoHttpRequest {
b.setting.ConnectTimeout = connectTimeout
b.setting.ReadWriteTimeout = readWriteTimeout
return b
func (r *Request) SetTimeout(connectTimeout, readWriteTimeout time.Duration) *Request {
r.setting.ConnectTimeout = connectTimeout
r.setting.ReadWriteTimeout = readWriteTimeout
return r
}
// SetTLSClientConfig sets tls connection configurations if visiting https url.
func (b *BeegoHttpRequest) SetTLSClientConfig(config *tls.Config) *BeegoHttpRequest {
b.setting.TlsClientConfig = config
return b
func (r *Request) SetTLSClientConfig(config *tls.Config) *Request {
r.setting.TlsClientConfig = config
return r
}
// Header add header item string in request.
func (b *BeegoHttpRequest) Header(key, value string) *BeegoHttpRequest {
b.req.Header.Set(key, value)
return b
func (r *Request) Header(key, value string) *Request {
r.req.Header.Set(key, value)
return r
}
func (r *Request) Headers() http.Header {
return r.req.Header
}
// Set the protocol version for incoming requests.
// Client requests always use HTTP/1.1.
func (b *BeegoHttpRequest) SetProtocolVersion(vers string) *BeegoHttpRequest {
func (r *Request) SetProtocolVersion(vers string) *Request {
if len(vers) == 0 {
vers = "HTTP/1.1"
}
major, minor, ok := http.ParseHTTPVersion(vers)
if ok {
b.req.Proto = vers
b.req.ProtoMajor = major
b.req.ProtoMinor = minor
r.req.Proto = vers
r.req.ProtoMajor = major
r.req.ProtoMinor = minor
}
return b
return r
}
// SetCookie add cookie into request.
func (b *BeegoHttpRequest) SetCookie(cookie *http.Cookie) *BeegoHttpRequest {
b.req.Header.Add("Cookie", cookie.String())
return b
func (r *Request) SetCookie(cookie *http.Cookie) *Request {
r.req.Header.Add("Cookie", cookie.String())
return r
}
// Set transport to
func (b *BeegoHttpRequest) SetTransport(transport http.RoundTripper) *BeegoHttpRequest {
b.setting.Transport = transport
return b
func (r *Request) SetTransport(transport http.RoundTripper) *Request {
r.setting.Transport = transport
return r
}
// Set http proxy
@@ -197,47 +198,47 @@ func (b *BeegoHttpRequest) SetTransport(transport http.RoundTripper) *BeegoHttpR
// u, _ := url.ParseRequestURI("http://127.0.0.1:8118")
// return u, nil
// }
func (b *BeegoHttpRequest) SetProxy(proxy func(*http.Request) (*url.URL, error)) *BeegoHttpRequest {
b.setting.Proxy = proxy
return b
func (r *Request) SetProxy(proxy func(*http.Request) (*url.URL, error)) *Request {
r.setting.Proxy = proxy
return r
}
// Param adds query param in to request.
// params build query string as ?key1=value1&key2=value2...
func (b *BeegoHttpRequest) Param(key, value string) *BeegoHttpRequest {
b.params[key] = value
return b
func (r *Request) Param(key, value string) *Request {
r.params[key] = value
return r
}
func (b *BeegoHttpRequest) PostFile(formname, filename string) *BeegoHttpRequest {
b.files[formname] = filename
return b
func (r *Request) PostFile(formname, filename string) *Request {
r.files[formname] = filename
return r
}
// Body adds request raw body.
// it supports string and []byte.
func (b *BeegoHttpRequest) Body(data interface{}) *BeegoHttpRequest {
func (r *Request) Body(data interface{}) *Request {
switch t := data.(type) {
case string:
bf := bytes.NewBufferString(t)
b.req.Body = ioutil.NopCloser(bf)
b.req.ContentLength = int64(len(t))
r.req.Body = ioutil.NopCloser(bf)
r.req.ContentLength = int64(len(t))
case []byte:
bf := bytes.NewBuffer(t)
b.req.Body = ioutil.NopCloser(bf)
b.req.ContentLength = int64(len(t))
r.req.Body = ioutil.NopCloser(bf)
r.req.ContentLength = int64(len(t))
}
return b
return r
}
func (b *BeegoHttpRequest) getResponse() (*http.Response, error) {
if b.resp.StatusCode != 0 {
return b.resp, nil
func (r *Request) getResponse() (*http.Response, error) {
if r.resp.StatusCode != 0 {
return r.resp, nil
}
var paramBody string
if len(b.params) > 0 {
if len(r.params) > 0 {
var buf bytes.Buffer
for k, v := range b.params {
for k, v := range r.params {
buf.WriteString(url.QueryEscape(k))
buf.WriteByte('=')
buf.WriteString(url.QueryEscape(v))
@@ -247,18 +248,18 @@ func (b *BeegoHttpRequest) getResponse() (*http.Response, error) {
paramBody = paramBody[0 : len(paramBody)-1]
}
if b.req.Method == "GET" && len(paramBody) > 0 {
if strings.Index(b.url, "?") != -1 {
b.url += "&" + paramBody
if r.req.Method == "GET" && len(paramBody) > 0 {
if strings.Index(r.url, "?") != -1 {
r.url += "&" + paramBody
} else {
b.url = b.url + "?" + paramBody
r.url = r.url + "?" + paramBody
}
} else if b.req.Method == "POST" && b.req.Body == nil {
if len(b.files) > 0 {
} else if r.req.Method == "POST" && r.req.Body == nil {
if len(r.files) > 0 {
pr, pw := io.Pipe()
bodyWriter := multipart.NewWriter(pw)
go func() {
for formname, filename := range b.files {
for formname, filename := range r.files {
fileWriter, err := bodyWriter.CreateFormFile(formname, filename)
if err != nil {
log.Fatal(err)
@@ -274,53 +275,53 @@ func (b *BeegoHttpRequest) getResponse() (*http.Response, error) {
log.Fatal(err)
}
}
for k, v := range b.params {
for k, v := range r.params {
bodyWriter.WriteField(k, v)
}
bodyWriter.Close()
pw.Close()
}()
b.Header("Content-Type", bodyWriter.FormDataContentType())
b.req.Body = ioutil.NopCloser(pr)
r.Header("Content-Type", bodyWriter.FormDataContentType())
r.req.Body = ioutil.NopCloser(pr)
} else if len(paramBody) > 0 {
b.Header("Content-Type", "application/x-www-form-urlencoded")
b.Body(paramBody)
r.Header("Content-Type", "application/x-www-form-urlencoded")
r.Body(paramBody)
}
}
url, err := url.Parse(b.url)
url, err := url.Parse(r.url)
if err != nil {
return nil, err
}
b.req.URL = url
r.req.URL = url
trans := b.setting.Transport
trans := r.setting.Transport
if trans == nil {
// create default transport
trans = &http.Transport{
TLSClientConfig: b.setting.TlsClientConfig,
Proxy: b.setting.Proxy,
Dial: TimeoutDialer(b.setting.ConnectTimeout, b.setting.ReadWriteTimeout),
TLSClientConfig: r.setting.TlsClientConfig,
Proxy: r.setting.Proxy,
Dial: TimeoutDialer(r.setting.ConnectTimeout, r.setting.ReadWriteTimeout),
}
} else {
// if b.transport is *http.Transport then set the settings.
// if r.transport is *http.Transport then set the settings.
if t, ok := trans.(*http.Transport); ok {
if t.TLSClientConfig == nil {
t.TLSClientConfig = b.setting.TlsClientConfig
t.TLSClientConfig = r.setting.TlsClientConfig
}
if t.Proxy == nil {
t.Proxy = b.setting.Proxy
t.Proxy = r.setting.Proxy
}
if t.Dial == nil {
t.Dial = TimeoutDialer(b.setting.ConnectTimeout, b.setting.ReadWriteTimeout)
t.Dial = TimeoutDialer(r.setting.ConnectTimeout, r.setting.ReadWriteTimeout)
}
}
}
var jar http.CookieJar
if b.setting.EnableCookie {
if r.setting.EnableCookie {
if defaultCookieJar == nil {
createDefaultCookie()
}
@@ -334,30 +335,30 @@ func (b *BeegoHttpRequest) getResponse() (*http.Response, error) {
Jar: jar,
}
if len(b.setting.UserAgent) > 0 && len(b.req.Header.Get("User-Agent")) == 0 {
b.req.Header.Set("User-Agent", b.setting.UserAgent)
if len(r.setting.UserAgent) > 0 && len(r.req.Header.Get("User-Agent")) == 0 {
r.req.Header.Set("User-Agent", r.setting.UserAgent)
}
if b.setting.ShowDebug {
dump, err := httputil.DumpRequest(b.req, true)
if r.setting.ShowDebug {
dump, err := httputil.DumpRequest(r.req, true)
if err != nil {
println(err.Error())
}
println(string(dump))
}
resp, err := client.Do(b.req)
resp, err := client.Do(r.req)
if err != nil {
return nil, err
}
b.resp = resp
r.resp = resp
return resp, nil
}
// String returns the body string in response.
// it calls Response inner.
func (b *BeegoHttpRequest) String() (string, error) {
data, err := b.Bytes()
func (r *Request) String() (string, error) {
data, err := r.Bytes()
if err != nil {
return "", err
}
@@ -367,11 +368,11 @@ func (b *BeegoHttpRequest) String() (string, error) {
// Bytes returns the body []byte in response.
// it calls Response inner.
func (b *BeegoHttpRequest) Bytes() ([]byte, error) {
if b.body != nil {
return b.body, nil
func (r *Request) Bytes() ([]byte, error) {
if r.body != nil {
return r.body, nil
}
resp, err := b.getResponse()
resp, err := r.getResponse()
if err != nil {
return nil, err
}
@@ -383,20 +384,20 @@ func (b *BeegoHttpRequest) Bytes() ([]byte, error) {
if err != nil {
return nil, err
}
b.body = data
r.body = data
return data, nil
}
// ToFile saves the body data in response to one file.
// it calls Response inner.
func (b *BeegoHttpRequest) ToFile(filename string) error {
func (r *Request) ToFile(filename string) error {
f, err := os.Create(filename)
if err != nil {
return err
}
defer f.Close()
resp, err := b.getResponse()
resp, err := r.getResponse()
if err != nil {
return err
}
@@ -410,8 +411,8 @@ func (b *BeegoHttpRequest) ToFile(filename string) error {
// ToJson returns the map that marshals from the body bytes as json in response .
// it calls Response inner.
func (b *BeegoHttpRequest) ToJson(v interface{}) error {
data, err := b.Bytes()
func (r *Request) ToJson(v interface{}) error {
data, err := r.Bytes()
if err != nil {
return err
}
@@ -421,8 +422,8 @@ func (b *BeegoHttpRequest) ToJson(v interface{}) error {
// ToXml returns the map that marshals from the body bytes as xml in response .
// it calls Response inner.
func (b *BeegoHttpRequest) ToXml(v interface{}) error {
data, err := b.Bytes()
func (r *Request) ToXml(v interface{}) error {
data, err := r.Bytes()
if err != nil {
return err
}
@@ -431,8 +432,8 @@ func (b *BeegoHttpRequest) ToXml(v interface{}) error {
}
// Response executes request client gets response mannually.
func (b *BeegoHttpRequest) Response() (*http.Response, error) {
return b.getResponse()
func (r *Request) Response() (*http.Response, error) {
return r.getResponse()
}
// TimeoutDialer returns functions of connection dialer with timeout settings for http.Transport Dial field.
+2
View File
@@ -82,6 +82,7 @@ var (
DeliverTimeout int
SkipTLSVerify bool
Types []string
PagingNum int
}
// Repository settings.
@@ -601,6 +602,7 @@ func newWebhookService() {
Webhook.DeliverTimeout = sec.Key("DELIVER_TIMEOUT").MustInt(5)
Webhook.SkipTLSVerify = sec.Key("SKIP_TLS_VERIFY").MustBool()
Webhook.Types = []string{"gogs", "slack"}
Webhook.PagingNum = sec.Key("PAGING_NUM").MustInt(10)
}
func NewServices() {
+1 -1
View File
@@ -1 +1 @@
@font-face{font-family:octicons;src:url(../fonts/octicons.eot?#iefix&v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d) format('embedded-opentype'),url(../fonts/octicons.woff?v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d) format('woff'),url(../fonts/octicons.ttf?v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d) format('truetype'),url(../fonts/octicons.svg?v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d#octicons) format('svg');font-weight:400;font-style:normal}.mega-octicon,.octicon{font:normal normal normal 16px/1 octicons;display:inline-block;text-decoration:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mega-octicon{font-size:32px}.octicon-alert:before{content:'\f02d'}.octicon-arrow-down:before{content:'\f03f'}.octicon-arrow-left:before{content:'\f040'}.octicon-arrow-right:before{content:'\f03e'}.octicon-arrow-small-down:before{content:'\f0a0'}.octicon-arrow-small-left:before{content:'\f0a1'}.octicon-arrow-small-right:before{content:'\f071'}.octicon-arrow-small-up:before{content:'\f09f'}.octicon-arrow-up:before{content:'\f03d'}.octicon-beaker:before,.octicon-microscope:before{content:'\f0dd'}.octicon-bell:before{content:'\f0de'}.octicon-book:before{content:'\f007'}.octicon-bookmark:before{content:'\f07b'}.octicon-briefcase:before{content:'\f0d3'}.octicon-broadcast:before{content:'\f048'}.octicon-browser:before{content:'\f0c5'}.octicon-bug:before{content:'\f091'}.octicon-calendar:before{content:'\f068'}.octicon-check:before{content:'\f03a'}.octicon-checklist:before{content:'\f076'}.octicon-chevron-down:before{content:'\f0a3'}.octicon-chevron-left:before{content:'\f0a4'}.octicon-chevron-right:before{content:'\f078'}.octicon-chevron-up:before{content:'\f0a2'}.octicon-circle-slash:before{content:'\f084'}.octicon-circuit-board:before{content:'\f0d6'}.octicon-clippy:before{content:'\f035'}.octicon-clock:before{content:'\f046'}.octicon-cloud-download:before{content:'\f00b'}.octicon-cloud-upload:before{content:'\f00c'}.octicon-code:before{content:'\f05f'}.octicon-color-mode:before{content:'\f065'}.octicon-comment-add:before,.octicon-comment:before{content:'\f02b'}.octicon-comment-discussion:before{content:'\f04f'}.octicon-credit-card:before{content:'\f045'}.octicon-dash:before{content:'\f0ca'}.octicon-dashboard:before{content:'\f07d'}.octicon-database:before{content:'\f096'}.octicon-clone:before,.octicon-desktop-download:before{content:'\f0dc'}.octicon-device-camera:before{content:'\f056'}.octicon-device-camera-video:before{content:'\f057'}.octicon-device-desktop:before{content:'\f27c'}.octicon-device-mobile:before{content:'\f038'}.octicon-diff:before{content:'\f04d'}.octicon-diff-added:before{content:'\f06b'}.octicon-diff-ignored:before{content:'\f099'}.octicon-diff-modified:before{content:'\f06d'}.octicon-diff-removed:before{content:'\f06c'}.octicon-diff-renamed:before{content:'\f06e'}.octicon-ellipsis:before{content:'\f09a'}.octicon-eye-unwatch:before,.octicon-eye-watch:before,.octicon-eye:before{content:'\f04e'}.octicon-file-binary:before{content:'\f094'}.octicon-file-code:before{content:'\f010'}.octicon-file-directory:before{content:'\f016'}.octicon-file-media:before{content:'\f012'}.octicon-file-pdf:before{content:'\f014'}.octicon-file-submodule:before{content:'\f017'}.octicon-file-symlink-directory:before{content:'\f0b1'}.octicon-file-symlink-file:before{content:'\f0b0'}.octicon-file-text:before{content:'\f011'}.octicon-file-zip:before{content:'\f013'}.octicon-flame:before{content:'\f0d2'}.octicon-fold:before{content:'\f0cc'}.octicon-gear:before{content:'\f02f'}.octicon-gift:before{content:'\f042'}.octicon-gist:before{content:'\f00e'}.octicon-gist-secret:before{content:'\f08c'}.octicon-git-branch-create:before,.octicon-git-branch-delete:before,.octicon-git-branch:before{content:'\f020'}.octicon-git-commit:before{content:'\f01f'}.octicon-git-compare:before{content:'\f0ac'}.octicon-git-merge:before{content:'\f023'}.octicon-git-pull-request-abandoned:before,.octicon-git-pull-request:before{content:'\f009'}.octicon-globe:before{content:'\f0b6'}.octicon-graph:before{content:'\f043'}.octicon-heart:before{content:'\2665'}.octicon-history:before{content:'\f07e'}.octicon-home:before{content:'\f08d'}.octicon-horizontal-rule:before{content:'\f070'}.octicon-hubot:before{content:'\f09d'}.octicon-inbox:before{content:'\f0cf'}.octicon-info:before{content:'\f059'}.octicon-issue-closed:before{content:'\f028'}.octicon-issue-opened:before{content:'\f026'}.octicon-issue-reopened:before{content:'\f027'}.octicon-jersey:before{content:'\f019'}.octicon-key:before{content:'\f049'}.octicon-keyboard:before{content:'\f00d'}.octicon-law:before{content:'\f0d8'}.octicon-light-bulb:before{content:'\f000'}.octicon-link:before{content:'\f05c'}.octicon-link-external:before{content:'\f07f'}.octicon-list-ordered:before{content:'\f062'}.octicon-list-unordered:before{content:'\f061'}.octicon-location:before{content:'\f060'}.octicon-gLine truncated
@font-face{font-family:octicons;src:url(../fonts/octicons.eot?#iefix&v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d) format('embedded-opentype'),url(../fonts/octicons.woff?v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d) format('woff'),url(../fonts/octicons.ttf?v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d) format('truetype'),url(../fonts/octicons.svg?v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d#octicons) format('svg');font-weight:400;font-style:normal}.mega-octicon,.octicon{font:normal normal normal 16px/1 octicons;display:inline-block;text-decoration:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mega-octicon{font-size:32px}.octicon-alert:before{content:'\f02d'}.octicon-arrow-down:before{content:'\f03f'}.octicon-arrow-left:before{content:'\f040'}.octicon-arrow-right:before{content:'\f03e'}.octicon-arrow-small-down:before{content:'\f0a0'}.octicon-arrow-small-left:before{content:'\f0a1'}.octicon-arrow-small-right:before{content:'\f071'}.octicon-arrow-small-up:before{content:'\f09f'}.octicon-arrow-up:before{content:'\f03d'}.octicon-beaker:before,.octicon-microscope:before{content:'\f0dd'}.octicon-bell:before{content:'\f0de'}.octicon-book:before{content:'\f007'}.octicon-bookmark:before{content:'\f07b'}.octicon-briefcase:before{content:'\f0d3'}.octicon-broadcast:before{content:'\f048'}.octicon-browser:before{content:'\f0c5'}.octicon-bug:before{content:'\f091'}.octicon-calendar:before{content:'\f068'}.octicon-check:before{content:'\f03a'}.octicon-checklist:before{content:'\f076'}.octicon-chevron-down:before{content:'\f0a3'}.octicon-chevron-left:before{content:'\f0a4'}.octicon-chevron-right:before{content:'\f078'}.octicon-chevron-up:before{content:'\f0a2'}.octicon-circle-slash:before{content:'\f084'}.octicon-circuit-board:before{content:'\f0d6'}.octicon-clippy:before{content:'\f035'}.octicon-clock:before{content:'\f046'}.octicon-cloud-download:before{content:'\f00b'}.octicon-cloud-upload:before{content:'\f00c'}.octicon-code:before{content:'\f05f'}.octicon-color-mode:before{content:'\f065'}.octicon-comment-add:before,.octicon-comment:before{content:'\f02b'}.octicon-comment-discussion:before{content:'\f04f'}.octicon-credit-card:before{content:'\f045'}.octicon-dash:before{content:'\f0ca'}.octicon-dashboard:before{content:'\f07d'}.octicon-database:before{content:'\f096'}.octicon-clone:before,.octicon-desktop-download:before{content:'\f0dc'}.octicon-device-camera:before{content:'\f056'}.octicon-device-camera-video:before{content:'\f057'}.octicon-device-desktop:before{content:'\f27c'}.octicon-device-mobile:before{content:'\f038'}.octicon-diff:before{content:'\f04d'}.octicon-diff-added:before{content:'\f06b'}.octicon-diff-ignored:before{content:'\f099'}.octicon-diff-modified:before{content:'\f06d'}.octicon-diff-removed:before{content:'\f06c'}.octicon-diff-renamed:before{content:'\f06e'}.octicon-ellipsis:before{content:'\f09a'}.octicon-eye-unwatch:before,.octicon-eye-watch:before,.octicon-eye:before{content:'\f04e'}.octicon-file-binary:before{content:'\f094'}.octicon-file-code:before{content:'\f010'}.octicon-file-directory:before{content:'\f016'}.octicon-file-media:before{content:'\f012'}.octicon-file-pdf:before{content:'\f014'}.octicon-file-submodule:before{content:'\f017'}.octicon-file-symlink-directory:before{content:'\f0b1'}.octicon-file-symlink-file:before{content:'\f0b0'}.octicon-file-text:before{content:'\f011'}.octicon-file-zip:before{content:'\f013'}.octicon-flame:before{content:'\f0d2'}.octicon-fold:before{content:'\f0cc'}.octicon-gear:before{content:'\f02f'}.octicon-gift:before{content:'\f042'}.octicon-gist:before{content:'\f00e'}.octicon-gist-secret:before{content:'\f08c'}.octicon-git-branch-create:before,.octicon-git-branch-delete:before,.octicon-git-branch:before{content:'\f020'}.octicon-git-commit:before{content:'\f01f'}.octicon-git-compare:before{content:'\f0ac'}.octicon-git-merge:before{content:'\f023'}.octicon-git-pull-request-abandoned:before,.octicon-git-pull-request:before{content:'\f009'}.octicon-globe:before{content:'\f0b6'}.octicon-graph:before{content:'\f043'}.octicon-heart:before{content:'\2665'}.octicon-history:before{content:'\f07e'}.octicon-home:before{content:'\f08d'}.octicon-horizontal-rule:before{content:'\f070'}.octicon-hubot:before{content:'\f09d'}.octicon-inbox:before{content:'\f0cf'}.octicon-info:before{content:'\f059'}.octicon-issue-closed:before{content:'\f028'}.octicon-issue-opened:before{content:'\f026'}.octicon-issue-reopened:before{content:'\f027'}.octicon-jersey:before{content:'\f019'}.octicon-key:before{content:'\f049'}.octicon-keyboard:before{content:'\f00d'}.octicon-law:before{content:'\f0d8'}.octicon-light-bulb:before{content:'\f000'}.octicon-link:before{content:'\f05c'}.octicon-link-external:before{content:'\f07f'}.octicon-list-ordered:before{content:'\f062'}.octicon-list-unordered:before{content:'\f061'}.octicon-location:before{content:'\f060'}.octicon-gLine truncated
+5 -4
View File
@@ -341,10 +341,6 @@ function initRepository() {
// Diff
if ($('.repository.diff').length > 0) {
$('.diff-detail-box .toggle.button').click(function () {
$($(this).data('target')).slideToggle(100);
})
var $counter = $('.diff-counter');
if ($counter.length < 1) {
return;
@@ -406,6 +402,11 @@ $(document).ready(function () {
}
}
});
$('.tabular.menu .item').tab();
$('.toggle.button').click(function () {
$($(this).data('target')).slideToggle(100);
});
// Dropzone
if ($('#dropzone').length > 0) {
+17
View File
@@ -7,6 +7,19 @@ body {
img {
border-radius: 3px;
}
pre {
font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
&.raw {
padding: 7px 12px;
margin: 10px 0;
background-color: #f8f8f8;
border: 1px solid #ddd;
border-radius: 3px;
font-size: 13px;
line-height: 1.5;
overflow: auto;
}
}
.full.height {
padding: 0;
margin: 0 0 -@footer-margin*2 0;
@@ -121,6 +134,10 @@ img {
&.thin {
font-weight: normal;
}
&.middle {
vertical-align: middle;
}
}
.message {
+35 -1
View File
@@ -624,7 +624,7 @@
}
}
.hook.list {
.item:not(:first-child) {
> .item:not(:first-child) {
border-top: 1px solid #eaeaea;
}
.item {
@@ -632,6 +632,40 @@
.octicon,
.fa {
width: 20px;
text-align: center;
}
}
}
.hook.history.list {
.item {
padding-left: 13px;
.meta {
.ui.right {
margin-top: 5px;
.time {
font-size: 12px;
}
}
}
.info {
margin-top: 10px;
.tabular.menu {
.item {
font-weight: 500;
}
}
.tab.segment {
border: none;
padding: 0;
padding-top: 10px;
box-shadow: none;
* {
color: #666;
}
pre {
word-wrap: break-word;
}
}
}
}
}
+1 -1
View File
@@ -121,7 +121,7 @@ func CreateRepoHook(ctx *middleware.Context, form api.CreateHookOption) {
// PATCH /repos/:username/:reponame/hooks/:id
// https://developer.github.com/v3/repos/hooks/#edit-a-hook
func EditRepoHook(ctx *middleware.Context, form api.EditHookOption) {
w, err := models.GetWebhookById(ctx.ParamsInt64(":id"))
w, err := models.GetWebhookByID(ctx.ParamsInt64(":id"))
if err != nil {
ctx.JSON(500, &base.ApiJsonErr{"GetWebhookById: " + err.Error(), base.DOC_URL})
return
+24 -31
View File
@@ -417,15 +417,22 @@ func SlackHooksNewPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
ctx.Redirect(orCtx.Link + "/settings/hooks")
}
func checkWebhook(ctx *middleware.Context) *models.Webhook {
w, err := models.GetWebhookById(ctx.ParamsInt64(":id"))
func checkWebhook(ctx *middleware.Context) (*OrgRepoCtx, *models.Webhook) {
orCtx, err := getOrgRepoCtx(ctx)
if err != nil {
if err == models.ErrWebhookNotExist {
ctx.Handle(404, "GetWebhookById", 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)
ctx.Handle(500, "GetWebhookByID", err)
}
return nil
return nil, nil
}
switch w.HookTaskType {
@@ -436,7 +443,12 @@ func checkWebhook(ctx *middleware.Context) *models.Webhook {
ctx.Data["HookType"] = "gogs"
}
w.GetEvent()
return w
ctx.Data["History"], err = w.History(1)
if err != nil {
ctx.Handle(500, "History", err)
}
return orCtx, w
}
func WebHooksEdit(ctx *middleware.Context) {
@@ -444,17 +456,11 @@ func WebHooksEdit(ctx *middleware.Context) {
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["PageIsSettingsHooksEdit"] = true
ctx.Data["Webhook"] = checkWebhook(ctx)
orCtx, w := checkWebhook(ctx)
if ctx.Written() {
return
}
orCtx, err := getOrgRepoCtx(ctx)
if err != nil {
ctx.Handle(500, "getOrgRepoCtx", err)
return
}
ctx.Data["BaseLink"] = orCtx.Link
ctx.Data["Webhook"] = w
ctx.HTML(200, orCtx.NewTemplate)
}
@@ -464,19 +470,12 @@ func WebHooksEditPost(ctx *middleware.Context, form auth.NewWebhookForm) {
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["PageIsSettingsHooksEdit"] = true
w := checkWebhook(ctx)
orCtx, w := checkWebhook(ctx)
if ctx.Written() {
return
}
ctx.Data["Webhook"] = w
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
@@ -511,19 +510,12 @@ func SlackHooksEditPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["PageIsSettingsHooksEdit"] = true
w := checkWebhook(ctx)
orCtx, w := checkWebhook(ctx)
if ctx.Written() {
return
}
ctx.Data["Webhook"] = w
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
@@ -588,6 +580,7 @@ func TriggerHook(ctx *middleware.Context) {
return
}
models.HookQueue.AddRepoID(repo.ID)
ctx.Status(200)
}
func GitHooks(ctx *middleware.Context) {
+61 -2
View File
@@ -2,7 +2,66 @@
<h4 class="ui top attached header">
{{.i18n.Tr "repo.settings.recent_deliveries"}}
</h4>
<div class="ui attached segment">
Coming soon!
<div class="ui attached table segment">
<div class="ui hook history list">
{{range .History}}
<div class="item">
<div class="meta">
{{if .IsSucceed}}
<span class="text green"><i class="octicon octicon-check"></i></span>
{{else}}
<span class="text red"><i class="octicon octicon-alert"></i></span>
{{end}}
<a class="ui blue sha label toggle button" data-target="#info-{{.ID}}">{{.UUID}}</a>
<div class="ui right">
<span class="text grey time">
{{.DeliveredString}}
</span>
</div>
</div>
<div class="info hide" id="info-{{.ID}}">
<div class="ui top attached tabular menu">
<a class="item active" data-tab="request-{{.ID}}">{{$.i18n.Tr "repo.settings.webhook.request"}}</a>
<a class="item" data-tab="response-{{.ID}}">
{{$.i18n.Tr "repo.settings.webhook.response"}}
{{if .ResponseInfo}}
{{if .IsSucceed}}
<span class="ui green label">{{.ResponseInfo.Status}}</span>
{{else}}
<span class="ui red label">500</span>
{{end}}
{{else}}
<span class="ui label">N/A</span>
{{end}}
</a>
</div>
<div class="ui bottom attached tab segment active" data-tab="request-{{.ID}}">
{{if .RequestInfo}}
<h5>{{$.i18n.Tr "repo.settings.webhook.headers"}}</h5>
<pre class="raw"><strong>Request URL:</strong> {{.URL}}
<strong>Request method:</strong> POST
{{ range $key, $val := .RequestInfo.Headers }}<strong>{{$key}}:</strong> {{$val}}
{{end}}</pre>
<h5>{{$.i18n.Tr "repo.settings.webhook.payload"}}</h5>
<pre class="raw">{{.PayloadContent}}</pre>
{{else}}
N/A
{{end}}
</div>
<div class="ui bottom attached tab segment" data-tab="response-{{.ID}}">
{{if .ResponseInfo}}
<h5>{{$.i18n.Tr "repo.settings.webhook.headers"}}</h5>
<pre class="raw">{{ range $key, $val := .ResponseInfo.Headers }}<strong>{{$key}}:</strong> {{$val}}
{{end}}</pre>
<h5>{{$.i18n.Tr "repo.settings.webhook.body"}}</h5>
<pre class="raw">{{.ResponseInfo.Body}}</pre>
{{else}}
N/A
{{end}}
</div>
</div>
</div>
{{end}}
</div>
</div>
{{end}}
+1 -1
View File
@@ -19,7 +19,7 @@
{{range .Tokens}}
<div class="item ui grid">
<div class="one wide column">
<i class="ssh-key-state-indicator fa fa-circle{{if .HasRecentActivity}} active invert poping up{{else}}-o{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.token_state_desc"}}" data-variation="inverted"{{end}}></i>
<i class="ssh-key-state-indicator fa fa-circle{{if .HasRecentActivity}} active invert poping up{{else}}-o{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.token_state_desc"}}" data-variation="inverted tiny"{{end}}></i>
</div>
<div class="one wide column">
<i class="fa fa-send fa-2x left"></i>
+1 -1
View File
@@ -19,7 +19,7 @@
{{range .Keys}}
<div class="item ui grid">
<div class="one wide column">
<i class="ssh-key-state-indicator fa fa-circle{{if .HasRecentActivity}} active invert poping up{{else}}-o{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.key_state_desc"}}" data-variation="inverted"{{end}}></i>
<i class="ssh-key-state-indicator fa fa-circle{{if .HasRecentActivity}} active invert poping up{{else}}-o{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.key_state_desc"}}" data-variation="inverted tiny"{{end}}></i>
</div>
<div class="one wide column">
<i class="mega-octicon octicon-key left"></i>