summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-12-12 20:30:32 -0500
committerUnknwon <joe2010xtmf@163.com>2014-12-12 20:30:32 -0500
commitac4a10456ea4515091c3c90a83a82c1e59cdf428 (patch)
treedb68f1f7a8f290322bd4da9892487cca5a1a5843 /cmd
parent2f3a7e53cb58e922055baf3cf14138100a1f05ac (diff)
downloadgitea-ac4a10456ea4515091c3c90a83a82c1e59cdf428.tar.gz
gitea-ac4a10456ea4515091c3c90a83a82c1e59cdf428.zip
api: able to create repo and fix #726
- POST /user/repos - POST /org/:org/repos
Diffstat (limited to 'cmd')
-rw-r--r--cmd/web.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/cmd/web.go b/cmd/web.go
index 6f1319a4e5..df9a380c11 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -26,6 +26,8 @@ import (
"github.com/macaron-contrib/session"
"github.com/macaron-contrib/toolbox"
+ api "github.com/gogits/go-gogs-client"
+
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/auth/apiv1"
@@ -66,7 +68,7 @@ func checkVersion() {
// Check dependency version.
macaronVer := git.MustParseVersion(strings.Join(strings.Split(macaron.Version(), ".")[:3], "."))
- if macaronVer.LessThan(git.MustParseVersion("0.4.2")) {
+ if macaronVer.LessThan(git.MustParseVersion("0.4.7")) {
log.Fatal(4, "Package macaron version is too old, did you forget to update?(github.com/Unknwon/macaron)")
}
i18nVer := git.MustParseVersion(i18n.Version())
@@ -200,14 +202,15 @@ func runWeb(*cli.Context) {
})
// Repositories.
- m.Get("/user/repos", middleware.ApiReqToken(), v1.ListMyRepos)
+ m.Combo("/user/repos", middleware.ApiReqToken()).Get(v1.ListMyRepos).Post(bind(api.CreateRepoOption{}), v1.CreateRepo)
+ m.Post("/org/:org/repos", middleware.ApiReqToken(), bind(api.CreateRepoOption{}), v1.CreateOrgRepo)
m.Group("/repos", func() {
m.Get("/search", v1.SearchRepos)
- m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), v1.Migrate)
+ m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), v1.MigrateRepo)
m.Group("/:username/:reponame", func() {
- m.Combo("/hooks").Get(v1.ListRepoHooks).Post(bind(v1.CreateRepoHookForm{}), v1.CreateRepoHook)
- m.Patch("/hooks/:id:int", bind(v1.EditRepoHookForm{}), v1.EditRepoHook)
+ m.Combo("/hooks").Get(v1.ListRepoHooks).Post(bind(api.CreateHookOption{}), v1.CreateRepoHook)
+ m.Patch("/hooks/:id:int", bind(api.EditHookOption{}), v1.EditRepoHook)
m.Get("/raw/*", middleware.RepoRef(), v1.GetRepoRawFile)
}, middleware.ApiRepoAssignment(), middleware.ApiReqToken())
})