From 7d3932b9cd1c66f9da577aa666f593d15e4ced99 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Mon, 9 Feb 2015 11:04:17 -0500 Subject: templates/ng/base: change year to 2015, fix #928 - conf/locale: update Japanese locale --- conf/locale/locale_ja-JP.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'conf') diff --git a/conf/locale/locale_ja-JP.ini b/conf/locale/locale_ja-JP.ini index c8b70aa1cf..29ea94e4da 100755 --- a/conf/locale/locale_ja-JP.ini +++ b/conf/locale/locale_ja-JP.ini @@ -516,8 +516,8 @@ dashboard.git_gc_repos=リポジトリでのガベージコレクションを実 dashboard.git_gc_repos_success=すべてのリポジトリは正常にガベージ コレクションを行いました。 dashboard.resync_all_sshkeys='.ssh/ autorized_key' ファイルを再生成します。(警告:Gogsキー以外は失われます) dashboard.resync_all_sshkeys_success=すべての公開鍵が正常に書き換えられました。 -dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed) -dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully. +dashboard.resync_all_update_hooks=リポジトリの update フックをすべて再更新する(カスタムの設定パスが変更されたときに必要) +dashboard.resync_all_update_hooks_success=リポジトリの update フックがすべて正常に再更新されました。 dashboard.server_uptime=サーバーの稼働時間 dashboard.current_goroutine=現在のGoroutine -- cgit v1.2.3 From 6a23252edc36a3d99b35af69a310fd31f687f3cb Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 10 Feb 2015 21:06:59 -0500 Subject: able to allow insecure certification of webhook for #891 --- conf/app.ini | 2 ++ conf/locale/locale_en-US.ini | 1 + gogs.go | 2 +- models/webhook.go | 14 ++++++++------ modules/cron/manager.go | 2 +- modules/setting/setting.go | 13 +++++++++---- routers/admin/admin.go | 5 +---- templates/.VERSION | 2 +- templates/admin/config.tmpl | 6 ++++-- 9 files changed, 28 insertions(+), 19 deletions(-) (limited to 'conf') diff --git a/conf/app.ini b/conf/app.ini index 782dc51c89..e80d77a9ca 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -89,6 +89,8 @@ ENABLE_REVERSE_PROXY_AUTO_REGISTERATION = false TASK_INTERVAL = 1 ; Deliver timeout in seconds DELIVER_TIMEOUT = 5 +; Allow insecure certification +ALLOW_INSECURE_CERTIFICATION = false [mailer] ENABLED = false diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini index 8ea383f26b..9e691171a4 100644 --- a/conf/locale/locale_en-US.ini +++ b/conf/locale/locale_en-US.ini @@ -647,6 +647,7 @@ config.reset_password_code_lives = Reset Password Code Lives config.webhook_config = Webhook Configuration config.task_interval = Task Interval config.deliver_timeout = Deliver Timeout +config.allow_insecure_certification = Allow Insecure Certification config.mailer_config = Mailer Configuration config.mailer_enabled = Enabled config.mailer_name = Name diff --git a/gogs.go b/gogs.go index 0990391714..b2f45b333f 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.5.13.0209 Beta" +const APP_VER = "0.5.13.0210 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/webhook.go b/models/webhook.go index 8e112ac572..34349bb598 100644 --- a/models/webhook.go +++ b/models/webhook.go @@ -5,6 +5,7 @@ package models import ( + "crypto/tls" "encoding/json" "errors" "io/ioutil" @@ -307,13 +308,14 @@ func DeliverHooks() { defer func() { isShooting = false }() tasks := make([]*HookTask, 0, 10) - timeout := time.Duration(setting.WebhookDeliverTimeout) * time.Second + timeout := time.Duration(setting.Webhook.DeliverTimeout) * time.Second x.Where("is_delivered=?", false).Iterate(new(HookTask), func(idx int, bean interface{}) error { t := bean.(*HookTask) req := httplib.Post(t.Url).SetTimeout(timeout, timeout). Header("X-Gogs-Delivery", t.Uuid). - Header("X-Gogs-Event", string(t.EventType)) + Header("X-Gogs-Event", string(t.EventType)). + SetTLSClientConfig(&tls.Config{InsecureSkipVerify: setting.Webhook.AllowInsecureCertification}) switch t.ContentType { case JSON: @@ -329,7 +331,7 @@ func DeliverHooks() { case GOGS: { if _, err := req.Response(); err != nil { - log.Error(4, "Delivery: %v", err) + log.Error(5, "Delivery: %v", err) } else { t.IsSucceed = true } @@ -337,15 +339,15 @@ func DeliverHooks() { case SLACK: { if res, err := req.Response(); err != nil { - log.Error(4, "Delivery: %v", err) + log.Error(5, "Delivery: %v", err) } else { defer res.Body.Close() contents, err := ioutil.ReadAll(res.Body) if err != nil { - log.Error(4, "%s", err) + log.Error(5, "%s", err) } else { if string(contents) != "ok" { - log.Error(4, "slack failed with: %s", string(contents)) + log.Error(5, "slack failed with: %s", string(contents)) } else { t.IsSucceed = true } diff --git a/modules/cron/manager.go b/modules/cron/manager.go index 135fec4faa..2990ab0604 100644 --- a/modules/cron/manager.go +++ b/modules/cron/manager.go @@ -15,7 +15,7 @@ var c = New() func NewCronContext() { c.AddFunc("Update mirrors", "@every 1h", models.MirrorUpdate) - c.AddFunc("Deliver hooks", fmt.Sprintf("@every %dm", setting.WebhookTaskInterval), models.DeliverHooks) + c.AddFunc("Deliver hooks", fmt.Sprintf("@every %dm", setting.Webhook.TaskInterval), models.DeliverHooks) if setting.Git.Fsck.Enable { c.AddFunc("Repository health check", fmt.Sprintf("@every %dh", setting.Git.Fsck.Interval), models.GitFsck) } diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 55e0a79ab8..d71a8cda55 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -68,8 +68,11 @@ var ( ReverseProxyAuthUser string // Webhook settings. - WebhookTaskInterval int - WebhookDeliverTimeout int + Webhook struct { + TaskInterval int + DeliverTimeout int + AllowInsecureCertification bool + } // Repository settings. RepoRootPath string @@ -508,8 +511,10 @@ func newNotifyMailService() { } func newWebhookService() { - WebhookTaskInterval = Cfg.Section("webhook").Key("TASK_INTERVAL").MustInt(1) - WebhookDeliverTimeout = Cfg.Section("webhook").Key("DELIVER_TIMEOUT").MustInt(5) + sec := Cfg.Section("webhook") + Webhook.TaskInterval = sec.Key("TASK_INTERVAL").MustInt(1) + Webhook.DeliverTimeout = sec.Key("DELIVER_TIMEOUT").MustInt(5) + Webhook.AllowInsecureCertification = sec.Key("ALLOW_INSECURE_CERTIFICATION").MustBool() } func NewServices() { diff --git a/routers/admin/admin.go b/routers/admin/admin.go index d54bb629fd..316f1d4257 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -188,11 +188,8 @@ func Config(ctx *middleware.Context) { ctx.Data["ReverseProxyAuthUser"] = setting.ReverseProxyAuthUser ctx.Data["Service"] = setting.Service - ctx.Data["DbCfg"] = models.DbCfg - - ctx.Data["WebhookTaskInterval"] = setting.WebhookTaskInterval - ctx.Data["WebhookDeliverTimeout"] = setting.WebhookDeliverTimeout + ctx.Data["Webhook"] = setting.Webhook ctx.Data["MailerEnabled"] = false if setting.MailService != nil { diff --git a/templates/.VERSION b/templates/.VERSION index 1f077fbfcc..8f04f6d0da 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.5.13.0209 Beta \ No newline at end of file +0.5.13.0210 Beta \ No newline at end of file diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index f8b4be0b83..5cf84beb99 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -102,9 +102,11 @@
{{.i18n.Tr "admin.config.task_interval"}}
-
{{.WebhookTaskInterval}} {{.i18n.Tr "tool.raw_minutes"}}
+
{{.Webhook.TaskInterval}} {{.i18n.Tr "tool.raw_minutes"}}
{{.i18n.Tr "admin.config.deliver_timeout"}}
-
{{.WebhookDeliverTimeout}} {{.i18n.Tr "tool.raw_seconds"}}
+
{{.Webhook.DeliverTimeout}} {{.i18n.Tr "tool.raw_seconds"}}
+
{{.i18n.Tr "admin.config.allow_insecure_certification"}}
+
-- cgit v1.2.3 From d02e45f985ce371eb33fcca86bf80ca078be1d88 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 11 Feb 2015 12:04:01 -0500 Subject: better naming on #891 --- conf/app.ini | 2 +- conf/locale/locale_en-US.ini | 2 +- gogs.go | 2 +- models/webhook.go | 2 +- modules/setting/setting.go | 8 ++++---- templates/.VERSION | 2 +- templates/admin/config.tmpl | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) (limited to 'conf') diff --git a/conf/app.ini b/conf/app.ini index e80d77a9ca..2019557bd4 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -90,7 +90,7 @@ TASK_INTERVAL = 1 ; Deliver timeout in seconds DELIVER_TIMEOUT = 5 ; Allow insecure certification -ALLOW_INSECURE_CERTIFICATION = false +SKIP_TLS_VERIFY = false [mailer] ENABLED = false diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini index 9e691171a4..6b59be7391 100644 --- a/conf/locale/locale_en-US.ini +++ b/conf/locale/locale_en-US.ini @@ -647,7 +647,7 @@ config.reset_password_code_lives = Reset Password Code Lives config.webhook_config = Webhook Configuration config.task_interval = Task Interval config.deliver_timeout = Deliver Timeout -config.allow_insecure_certification = Allow Insecure Certification +config.skip_tls_verify = Skip TLS Verify config.mailer_config = Mailer Configuration config.mailer_enabled = Enabled config.mailer_name = Name diff --git a/gogs.go b/gogs.go index b2f45b333f..eac5936218 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.5.13.0210 Beta" +const APP_VER = "0.5.13.0211 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/webhook.go b/models/webhook.go index 34349bb598..96af0b6967 100644 --- a/models/webhook.go +++ b/models/webhook.go @@ -315,7 +315,7 @@ func DeliverHooks() { 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.AllowInsecureCertification}) + SetTLSClientConfig(&tls.Config{InsecureSkipVerify: setting.Webhook.SkipTLSVerify}) switch t.ContentType { case JSON: diff --git a/modules/setting/setting.go b/modules/setting/setting.go index d71a8cda55..6664c41907 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -69,9 +69,9 @@ var ( // Webhook settings. Webhook struct { - TaskInterval int - DeliverTimeout int - AllowInsecureCertification bool + TaskInterval int + DeliverTimeout int + SkipTLSVerify bool } // Repository settings. @@ -514,7 +514,7 @@ func newWebhookService() { sec := Cfg.Section("webhook") Webhook.TaskInterval = sec.Key("TASK_INTERVAL").MustInt(1) Webhook.DeliverTimeout = sec.Key("DELIVER_TIMEOUT").MustInt(5) - Webhook.AllowInsecureCertification = sec.Key("ALLOW_INSECURE_CERTIFICATION").MustBool() + Webhook.SkipTLSVerify = sec.Key("SKIP_TLS_VERIFY").MustBool() } func NewServices() { diff --git a/templates/.VERSION b/templates/.VERSION index 8f04f6d0da..2aad3653cb 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.5.13.0210 Beta \ No newline at end of file +0.5.13.0211 Beta \ No newline at end of file diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index 5cf84beb99..6c328353bc 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -105,8 +105,8 @@
{{.Webhook.TaskInterval}} {{.i18n.Tr "tool.raw_minutes"}}
{{.i18n.Tr "admin.config.deliver_timeout"}}
{{.Webhook.DeliverTimeout}} {{.i18n.Tr "tool.raw_seconds"}}
-
{{.i18n.Tr "admin.config.allow_insecure_certification"}}
-
+
{{.i18n.Tr "admin.config.skip_tls_verify"}}
+
-- cgit v1.2.3