aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-12-03 00:24:37 -0500
committerUnknwon <u@gogs.io>2015-12-03 00:24:37 -0500
commitcc8f5add6e811cc340e676f0d969a4b1dd551d89 (patch)
tree413d718eecf77c8910ca3d610942e4ceff23678e /cmd
parentec2423ad7c64bbef67ccee4324f2df3efe6792aa (diff)
downloadgitea-cc8f5add6e811cc340e676f0d969a4b1dd551d89.tar.gz
gitea-cc8f5add6e811cc340e676f0d969a4b1dd551d89.zip
fix #976
Diffstat (limited to 'cmd')
-rw-r--r--cmd/web.go25
1 files changed, 20 insertions, 5 deletions
diff --git a/cmd/web.go b/cmd/web.go
index 33fe8fa75d..899b733297 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -197,14 +197,14 @@ func runWeb(ctx *cli.Context) {
m.Get("/^:type(issues|pulls)$", reqSignIn, user.Issues)
// ***** START: API *****
- // FIXME: custom form error response.
+ // FIXME: custom form error response
m.Group("/api", func() {
m.Group("/v1", func() {
- // Miscellaneous.
+ // Miscellaneous
m.Post("/markdown", bindIgnErr(apiv1.MarkdownForm{}), v1.Markdown)
m.Post("/markdown/raw", v1.MarkdownRaw)
- // Users.
+ // Users
m.Group("/users", func() {
m.Get("/search", v1.SearchUsers)
@@ -218,7 +218,22 @@ func runWeb(ctx *cli.Context) {
})
})
- // Repositories.
+ m.Group("/users", func() {
+ m.Group("/:username", func() {
+ m.Get("/keys", v1.ListUserPublicKeys)
+ })
+ }, middleware.ApiReqToken())
+
+ m.Group("/user", func() {
+ m.Group("/keys", func() {
+ m.Combo("").Get(v1.ListMyPublicKeys).
+ Post(bind(api.CreateKeyOption{}), v1.CreateUserPublicKey)
+ m.Combo("/:id").Get(v1.GetUserPublicKey).
+ Delete(v1.DeleteUserPublicKey)
+ })
+ }, middleware.ApiReqToken())
+
+ // Repositories
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)
@@ -241,7 +256,7 @@ func runWeb(ctx *cli.Context) {
m.Group("/keys", func() {
m.Combo("").Get(v1.ListRepoDeployKeys).
- Post(bind(api.CreateDeployKeyOption{}), v1.CreateRepoDeployKey)
+ Post(bind(api.CreateKeyOption{}), v1.CreateRepoDeployKey)
m.Combo("/:id").Get(v1.GetRepoDeployKey).
Delete(v1.DeleteRepoDeploykey)
})