diff options
author | evolvedlight <steve@evolvedlight.co.uk> | 2014-10-13 20:30:31 +0100 |
---|---|---|
committer | evolvedlight <steve@evolvedlight.co.uk> | 2014-10-13 20:30:31 +0100 |
commit | 8d2a6fc484b540819e211d52b8d54e97269f0918 (patch) | |
tree | e5bfe7d3937bb2d18ba2fb50ea72514bd5bb4e13 /cmd | |
parent | 29ac3980ffdb5faa525d77fddc109c9023ebe257 (diff) | |
parent | 89bd994c836ecc9b6ceb80849f470521e1b15917 (diff) |
Merge remote-tracking branch 'upstream/dev'
Conflicts:
models/repo.go
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/cert.go | 2 | ||||
-rw-r--r-- | cmd/cert_stub.go | 34 | ||||
-rw-r--r-- | cmd/dump.go | 1 | ||||
-rw-r--r-- | cmd/web.go | 35 |
4 files changed, 65 insertions, 7 deletions
diff --git a/cmd/cert.go b/cmd/cert.go index b693b7d9..631c4c68 100644 --- a/cmd/cert.go +++ b/cmd/cert.go @@ -1,3 +1,5 @@ +// +build cert + // Copyright 2009 The Go Authors. All rights reserved. // Copyright 2014 The Gogs Authors. All rights reserved. // Use of this source code is governed by a MIT-style diff --git a/cmd/cert_stub.go b/cmd/cert_stub.go new file mode 100644 index 00000000..2029f4cb --- /dev/null +++ b/cmd/cert_stub.go @@ -0,0 +1,34 @@ +// +build !cert + +// Copyright 2009 The Go Authors. All rights reserved. +// Copyright 2014 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 cmd + +import ( + "fmt" + "time" + + "github.com/codegangsta/cli" +) + +var CmdCert = cli.Command{ + Name: "cert", + Usage: "Generate self-signed certificate", + Description: `Generate a self-signed X.509 certificate for a TLS server. +Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`, + Action: runCert, + Flags: []cli.Flag{ + cli.StringFlag{"host", "", "Comma-separated hostnames and IPs to generate a certificate for", ""}, + cli.StringFlag{"ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521", ""}, + cli.IntFlag{"rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set", ""}, + cli.StringFlag{"start-date", "", "Creation date formatted as Jan 1 15:04:05 2011", ""}, + cli.DurationFlag{"duration", 365 * 24 * time.Hour, "Duration that certificate is valid for", ""}, + cli.BoolFlag{"ca", "whether this cert should be its own Certificate Authority", ""}, + }, +} + +func runCert(ctx *cli.Context) { + fmt.Println("Command cert not available, please use build tags 'cert' to rebuild.") +} diff --git a/cmd/dump.go b/cmd/dump.go index 41491224..fe3763f0 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -60,6 +60,7 @@ func runDump(ctx *cli.Context) { z.AddFile("gogs-db.sql", path.Join(workDir, "gogs-db.sql")) z.AddFile("custom/conf/app.ini", path.Join(workDir, "custom/conf/app.ini")) z.AddDir("log", path.Join(workDir, "log")) + // FIXME: SSH key file. if err = z.Close(); err != nil { os.Remove(fileName) log.Fatalf("Fail to save %s: %v", fileName, err) @@ -61,10 +61,18 @@ func checkVersion() { log.Fatal(4, "Binary and template file version does not match, did you forget to recompile?") } - // Macaron. + // Check dependency version. macaronVer := git.MustParseVersion(strings.Join(strings.Split(macaron.Version(), ".")[:3], ".")) - if macaronVer.LessThan(git.MustParseVersion("0.1.8")) { - log.Fatal(4, "Macaron version does not match, did you forget to update?(github.com/Unknwon/macaron)") + if macaronVer.LessThan(git.MustParseVersion("0.2.0")) { + log.Fatal(4, "Package macaron version is too old, did you forget to update?(github.com/Unknwon/macaron)") + } + i18nVer := git.MustParseVersion(i18n.Version()) + if i18nVer.LessThan(git.MustParseVersion("0.0.2")) { + log.Fatal(4, "Package i18n version is too old, did you forget to update?(github.com/macaron-contrib/i18n)") + } + sessionVer := git.MustParseVersion(session.Version()) + if sessionVer.LessThan(git.MustParseVersion("0.0.1")) { + log.Fatal(4, "Package session version is too old, did you forget to update?(github.com/macaron-contrib/session)") } } @@ -88,10 +96,12 @@ func newMacaron() *macaron.Macaron { IndentJSON: macaron.Env != macaron.PROD, })) m.Use(i18n.I18n(i18n.Options{ - SubURL: setting.AppSubUrl, - Langs: setting.Langs, - Names: setting.Names, - Redirect: true, + SubURL: setting.AppSubUrl, + Directory: path.Join(setting.ConfRootPath, "locale"), + CustomDirectory: path.Join(setting.CustomPath, "conf/locale"), + Langs: setting.Langs, + Names: setting.Names, + Redirect: true, })) m.Use(cache.Cacher(cache.Options{ Adapter: setting.CacheAdapter, @@ -239,6 +249,11 @@ func runWeb(*cli.Context) { r.Post("/:authid", bindIgnErr(auth.AuthenticationForm{}), admin.EditAuthSourcePost) r.Post("/:authid/delete", admin.DeleteAuthSource) }) + + m.Group("/notices", func(r *macaron.Router) { + r.Get("", admin.Notices) + r.Get("/:id:int/delete", admin.DeleteNotice) + }) }, adminReq) m.Get("/:username", ignSignIn, user.Profile) @@ -313,6 +328,12 @@ func runWeb(*cli.Context) { r.Get("/hooks/:id", repo.WebHooksEdit) r.Post("/hooks/gogs/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost) r.Post("/hooks/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost) + + m.Group("/hooks/git", func(r *macaron.Router) { + r.Get("", repo.GitHooks) + r.Get("/:name", repo.GitHooksEdit) + r.Post("/:name", repo.GitHooksEditPost) + }, middleware.GitHookService()) }) }, reqSignIn, middleware.RepoAssignment(true), reqTrueOwner) |