From 052ab30409ad519cd15dfb5b109b86ca15b5c549 Mon Sep 17 00:00:00 2001 From: fanningert Date: Sat, 20 Sep 2014 11:01:05 +0200 Subject: [PATCH 1/5] Update locale_de-DE.ini --- conf/locale/locale_de-DE.ini | 66 +++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/conf/locale/locale_de-DE.ini b/conf/locale/locale_de-DE.ini index 20f27e1838..c49453c330 100644 --- a/conf/locale/locale_de-DE.ini +++ b/conf/locale/locale_de-DE.ini @@ -38,6 +38,50 @@ issues = Issues cancel = Abbrechen +[install] +install = Installation +title = Installation für erstmaligen Start +requite_db_desc = Gogs erfordert MySQL, PostgreSQL oder SQLite 3, aber SQLite3 ist in der offiziellen binären Version akiviert. +db_type = Datenbanktyp +host = Host +user = Benutzer +password = Passwort +db_name = Datenbankname +db_helper = Bitte verwenden InnoDB-Engine mit utf8_general_ci Zeichensatz für MySQL. +ssl_mode = SSL-Modus +path = Pfad +sqlite_helper = Der Dateipfad des SQLite3 Datenbank. +general_title = Allgemeine Einstellungen von Gogs +repo_path = Repository Root-Verzeichnispfad +repo_path_helper = Alle Git-Repositorys werden in diesem Verzeichnis gespeichert. +run_user = Ausführender Benutzer +run_user_helper = Der Benutzer muss die Zugriffsberechtigung für das Repository Root-Verzeichnis haben und der ausführende Benutzer von Gogs sein. +domain = Domain +domain_helper = Dies hat Auswirkung auf die SSH clone URLs. +app_url = Anwendungs-URL +app_url_helper = Dies hat Auswirkung auf die HTTP/HTTPS clone URLs und für die E-Mails. +email_title = E-Mail-Service-Einstellungen(Optional) +smtp_host = SMTP Host +mailer_user = Sender E-mail +mailer_password = Sender Passwort +notify_title = Benachrichtigungseinstellungen(Optional) +register_confirm = Registrierungsbestätigung aktvieren +mail_notify = E-Mail-Benachrichtgung aktivieren +admin_title = Konto-Einstellungen für den Administrator +admin_name = Benutzername +admin_password = Passwort +confirm_password = Passwort bestätigen +admin_email = E-Mail +install_gogs = Gogs installieren +test_git_failed = Fehler beim Test des 'git' Kommandos: %v +sqlite3_not_available = Deine Version unterstüzt nicht SQLite3, bitte downloade dir die offiziele binäre Version von http://gogs.io/docs/installation/install_from_binary.html, NICHT die gobuild Version. +invalid_db_setting = Datenbank-Einstellungen sind nicht korrekt: %v +invalid_repo_path = Repository Root-Verzeichnis ist ungültig: %v +run_user_not_match = Der ausführende Benutzer ist nicht der aktuelle Benutzer: %s -> %s +save_config_failed = Versuche die Konfiguration zu speichern ist fehlgeschlagen: %v +invalid_admin_setting = Admin-Konto Einstellungen sind ungültig: %v +install_success = Herzlich Willkommen! Wir sind froh, dass du dich für Gogs entschieden hast. Hab viel Vergnügen damit. + [home] uname_holder = Benutzername oder E-Mail password_holder = Passwort @@ -47,6 +91,9 @@ collaborative_repos = Gemeinschaftliche Repositorys my_orgs = Meine Organisationen my_mirrors = Meine Spiegel +[explore] +repos = Repositories + [auth] create_new_account = Neues Konto erstellen register_hepler_msg = Du hast schon ein Konto? Jetzt anmelden! @@ -81,6 +128,7 @@ HttpsUrl = HTTPS-URL PayloadUrl = Payload-URL TeamName = Teamname AuthName = Authentifizierungsname +AdminEmail = Admin E-mail require_error = ` darf nicht leer sein.` alpha_dash_error = ` kann ausschließlich alphanumerische Zeichen und "-_" enthalten.` @@ -125,6 +173,7 @@ ssh_keys = SSH-Schlüssel social = Soziale Konten orgs = Organisationen delete = Konto löschen +uid = Uid public_profile = Öffentliches Profil profile_desc = Deine E-Mail-Adresse ist öffentlich und dient dazu, dir Benachrichtigungen bezüglich deines Kontos und deiner Repositorys zu schicken. @@ -178,7 +227,6 @@ create_repo = Repository erstellen default_branch = Standard-Branch mirror_interval = Spiegel-Intervall (in Stunden) goget_meta = Go-Get Meta -goget_meta_helper = This repository will be Go-Getable goget_meta_helper = Dieses Repository wird man mit go get klonen können. need_auth = Authorisierung benötigt @@ -210,11 +258,13 @@ settings.site = Offizielle Webseite settings.update_settings = Aktualisierungseinstellungen settings.transfer = Besitz übertragen settings.transfer_desc = Übertrage dieses Repository einem anderen Benutzer oder einer Organisation. +settings.new_owner_has_same_repo = Neuer Eigentümer hat bereits ein Repository mit dem gleichen Namen. settings.delete = Repository löschen settings.delete_desc = Wenn dieses Repository gelöschet ist, gibt es keinen Weg zurück. Sei dir sicher! settings.update_settings_success = Repository-Optionen aktualisiert settings.transfer_owner = Neuer Besitzer settings.make_transfer = übertragen +settings.transfer_succeed = Repository-Eigentum wurde erfolgreich übertragen. settings.confirm_delete = Löschen settings.add_collaborator = Mitarbeiter hinzufügen settings.add_collaborator_success = Mitarbeiter hinzugefügt @@ -271,6 +321,7 @@ settings.delete = Organisation löschen settings.delete_account = Diese Organisation löschen settings.delete_prompt = Die Organisation wird dauerhaft gelöscht. Dies kann NICHT rückgängig gemacht werden! settings.confirm_delete_account = Löschen +settings.hooks_desc = Add webhooks that will be triggered for all repositories under this organization. members.public = Öffentlich members.public_helper = Privat machen @@ -515,3 +566,16 @@ months = %d Monate %s years = %d Jahre %s raw_seconds = Sekunden raw_minutes = Minuten + + + + + + + + + + + + + From 976f1486e01548bfb420a7c809ede6fc273e4a26 Mon Sep 17 00:00:00 2001 From: Martin van Beurden Date: Sun, 21 Sep 2014 14:07:00 +0200 Subject: [PATCH 2/5] Set cookiepath to AppSubUrl --- cmd/web.go | 7 ++++--- modules/middleware/auth.go | 2 +- modules/middleware/repo.go | 2 +- modules/setting/setting.go | 1 + routers/repo/issue.go | 2 +- routers/user/auth.go | 16 ++++++++-------- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/cmd/web.go b/cmd/web.go index 45f35a35af..83dfca4e67 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -97,9 +97,10 @@ func newMacaron() *macaron.Macaron { Config: *setting.SessionConfig, })) m.Use(csrf.Generate(csrf.Options{ - Secret: setting.SecretKey, - SetCookie: true, - Header: "X-Csrf-Token", + Secret: setting.SecretKey, + SetCookie: true, + Header: "X-Csrf-Token", + CookiePath: setting.AppSubUrl, })) m.Use(toolbox.Toolboxer(m, toolbox.Options{ HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{ diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go index 8fae5d1ece..2bc05697a9 100644 --- a/modules/middleware/auth.go +++ b/modules/middleware/auth.go @@ -48,7 +48,7 @@ func Toggle(options *ToggleOptions) macaron.Handler { if strings.HasSuffix(ctx.Req.RequestURI, "watch") { return } - ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI)) + ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl) ctx.Redirect(setting.AppSubUrl + "/user/login") return } else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm { diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go index 79b01133bd..f17018ddf3 100644 --- a/modules/middleware/repo.go +++ b/modules/middleware/repo.go @@ -298,7 +298,7 @@ func RequireTrueOwner() macaron.Handler { return func(ctx *Context) { if !ctx.Repo.IsTrueOwner && !ctx.Repo.IsAdmin { if !ctx.IsSigned { - ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI)) + ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl) ctx.Redirect(setting.AppSubUrl + "/user/login") return } diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 321282df25..a1ab43d022 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -380,6 +380,7 @@ func newSessionService() { SessionConfig = new(session.Config) SessionConfig.ProviderConfig = strings.Trim(Cfg.MustValue("session", "PROVIDER_CONFIG"), "\" ") SessionConfig.CookieName = Cfg.MustValue("session", "COOKIE_NAME", "i_like_gogits") + SessionConfig.CookiePath = AppSubUrl SessionConfig.Secure = Cfg.MustBool("session", "COOKIE_SECURE") SessionConfig.EnableSetCookie = Cfg.MustBool("session", "ENABLE_SET_COOKIE", true) SessionConfig.Gclifetime = Cfg.MustInt64("session", "GC_INTERVAL_TIME", 86400) diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 3a028e58ff..f854a22bbc 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -54,7 +54,7 @@ func Issues(ctx *middleware.Context) { isShowClosed := ctx.Query("state") == "closed" if viewType != "all" && !ctx.IsSigned { - ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI)) + ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl) ctx.Redirect(setting.AppSubUrl + "/user/login") return } diff --git a/routers/user/auth.go b/routers/user/auth.go index 71622e5543..c695f929a7 100644 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -52,8 +52,8 @@ func SignIn(ctx *middleware.Context) { defer func() { if !isSucceed { log.Trace("auto-login cookie cleared: %s", uname) - ctx.SetCookie(setting.CookieUserName, "", -1) - ctx.SetCookie(setting.CookieRememberName, "", -1) + ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl) + ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl) return } }() @@ -77,7 +77,7 @@ func SignIn(ctx *middleware.Context) { ctx.Session.Set("uid", u.Id) ctx.Session.Set("uname", u.Name) if redirectTo, _ := url.QueryUnescape(ctx.GetCookie("redirect_to")); len(redirectTo) > 0 { - ctx.SetCookie("redirect_to", "", -1) + ctx.SetCookie("redirect_to", "", -1, setting.AppSubUrl) ctx.Redirect(redirectTo) return } @@ -113,9 +113,9 @@ func SignInPost(ctx *middleware.Context, form auth.SignInForm) { if form.Remember { days := 86400 * setting.LogInRememberDays - ctx.SetCookie(setting.CookieUserName, u.Name, days) + ctx.SetCookie(setting.CookieUserName, u.Name, days, setting.AppSubUrl) ctx.SetSuperSecureCookie(base.EncodeMd5(u.Rands+u.Passwd), - setting.CookieRememberName, u.Name, days) + setting.CookieRememberName, u.Name, days, setting.AppSubUrl) } // Bind with social account. @@ -135,7 +135,7 @@ func SignInPost(ctx *middleware.Context, form auth.SignInForm) { ctx.Session.Set("uid", u.Id) ctx.Session.Set("uname", u.Name) if redirectTo, _ := url.QueryUnescape(ctx.GetCookie("redirect_to")); len(redirectTo) > 0 { - ctx.SetCookie("redirect_to", "", -1) + ctx.SetCookie("redirect_to", "", -1, setting.AppSubUrl) ctx.Redirect(redirectTo) return } @@ -149,8 +149,8 @@ func SignOut(ctx *middleware.Context) { ctx.Session.Delete("socialId") ctx.Session.Delete("socialName") ctx.Session.Delete("socialEmail") - ctx.SetCookie(setting.CookieUserName, "", -1) - ctx.SetCookie(setting.CookieRememberName, "", -1) + ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl) + ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl) ctx.Redirect(setting.AppSubUrl + "/") } From 4a01bb8fa40e770433b6858a97e336393cb8e9b2 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sun, 21 Sep 2014 12:19:50 -0400 Subject: [PATCH 3/5] Mirror bug fix --- .travis.yml | 3 +-- README.md | 2 +- README_ZH.md | 2 +- cmd/web.go | 7 +++---- gogs.go | 2 +- modules/setting/setting.go | 1 - templates/.VERSION | 2 +- 7 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2600693b63..eb5732ff60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,4 @@ language: go go: - 1.2 - - 1.3 - - tip \ No newline at end of file + - 1.3 \ No newline at end of file diff --git a/README.md b/README.md index 08eed1348f..232aa92a84 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Gogs(Go Git Service) is a painless self-hosted Git Service written in Go. ![Demo](https://gowalker.org/public/gogs_demo.gif) -##### Current version: 0.5.2 Beta +##### Current version: 0.5.3 Beta ### NOTICES diff --git a/README_ZH.md b/README_ZH.md index 4f59e00187..fcc8b49694 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -5,7 +5,7 @@ Gogs(Go Git Service) 是一个基于 Go 语言的自助 Git 服务。 ![Demo](https://gowalker.org/public/gogs_demo.gif) -##### 当前版本:0.5.2 Beta +##### 当前版本:0.5.3 Beta ## 开发目的 diff --git a/cmd/web.go b/cmd/web.go index 83dfca4e67..45f35a35af 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -97,10 +97,9 @@ func newMacaron() *macaron.Macaron { Config: *setting.SessionConfig, })) m.Use(csrf.Generate(csrf.Options{ - Secret: setting.SecretKey, - SetCookie: true, - Header: "X-Csrf-Token", - CookiePath: setting.AppSubUrl, + Secret: setting.SecretKey, + SetCookie: true, + Header: "X-Csrf-Token", })) m.Use(toolbox.Toolboxer(m, toolbox.Options{ HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{ diff --git a/gogs.go b/gogs.go index 8f9bc767d9..645e4e3398 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.5.3.0919 Beta" +const APP_VER = "0.5.3.0921 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index a1ab43d022..321282df25 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -380,7 +380,6 @@ func newSessionService() { SessionConfig = new(session.Config) SessionConfig.ProviderConfig = strings.Trim(Cfg.MustValue("session", "PROVIDER_CONFIG"), "\" ") SessionConfig.CookieName = Cfg.MustValue("session", "COOKIE_NAME", "i_like_gogits") - SessionConfig.CookiePath = AppSubUrl SessionConfig.Secure = Cfg.MustBool("session", "COOKIE_SECURE") SessionConfig.EnableSetCookie = Cfg.MustBool("session", "ENABLE_SET_COOKIE", true) SessionConfig.Gclifetime = Cfg.MustInt64("session", "GC_INTERVAL_TIME", 86400) diff --git a/templates/.VERSION b/templates/.VERSION index 9df945b783..4e0c5d6102 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.5.3.0919 Beta \ No newline at end of file +0.5.3.0921 Beta \ No newline at end of file From b72d7c201ab34bd4de9582be891c3d4b76c3fd70 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sun, 21 Sep 2014 12:22:50 -0400 Subject: [PATCH 4/5] Mirror bug fix --- cmd/web.go | 7 ++++--- modules/setting/setting.go | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/web.go b/cmd/web.go index 45f35a35af..83dfca4e67 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -97,9 +97,10 @@ func newMacaron() *macaron.Macaron { Config: *setting.SessionConfig, })) m.Use(csrf.Generate(csrf.Options{ - Secret: setting.SecretKey, - SetCookie: true, - Header: "X-Csrf-Token", + Secret: setting.SecretKey, + SetCookie: true, + Header: "X-Csrf-Token", + CookiePath: setting.AppSubUrl, })) m.Use(toolbox.Toolboxer(m, toolbox.Options{ HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{ diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 321282df25..a1ab43d022 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -380,6 +380,7 @@ func newSessionService() { SessionConfig = new(session.Config) SessionConfig.ProviderConfig = strings.Trim(Cfg.MustValue("session", "PROVIDER_CONFIG"), "\" ") SessionConfig.CookieName = Cfg.MustValue("session", "COOKIE_NAME", "i_like_gogits") + SessionConfig.CookiePath = AppSubUrl SessionConfig.Secure = Cfg.MustBool("session", "COOKIE_SECURE") SessionConfig.EnableSetCookie = Cfg.MustBool("session", "ENABLE_SET_COOKIE", true) SessionConfig.Gclifetime = Cfg.MustInt64("session", "GC_INTERVAL_TIME", 86400) From 1273b3d3a985e0aeb88c632e27d0e8dbc8dd2e19 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sun, 21 Sep 2014 19:39:10 -0400 Subject: [PATCH 5/5] Support custom robots.txt --- cmd/web.go | 9 +++++++++ modules/setting/setting.go | 3 +++ 2 files changed, 12 insertions(+) diff --git a/cmd/web.go b/cmd/web.go index 83dfca4e67..a5ebf259ea 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -364,6 +364,15 @@ func runWeb(*cli.Context) { r.Any("/:reponame/*", ignSignInAndCsrf, repo.Http) }) + // robots.txt + m.Get("/robots.txt", func(ctx *middleware.Context) { + if setting.HasRobotsTxt { + ctx.ServeFile(path.Join(setting.CustomPath, "robots.txt")) + } else { + ctx.Error(404) + } + }) + // Not found handler. m.NotFound(routers.NotFound) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index a1ab43d022..67e48108d9 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -108,6 +108,7 @@ var ( ProdMode bool RunUser string IsWindows bool + HasRobotsTxt bool ) func init() { @@ -260,6 +261,8 @@ func NewConfigContext() { Langs = Cfg.MustValueArray("i18n", "LANGS", ",") Names = Cfg.MustValueArray("i18n", "NAMES", ",") + + HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt")) } var Service struct {