summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/api.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-03-11 11:56:52 -0500
committerUnknwon <u@gogs.io>2016-03-11 11:56:52 -0500
commit514382e2ebfe6869268aeb919c1fa4d224687e13 (patch)
tree1aa8c4b3b1e771a5dc6f0bdd74567961570efcaa /routers/api/v1/api.go
parentcb1eadc2768ea5ffb2967eb4262e96730c3f9ba5 (diff)
downloadgitea-514382e2ebfe6869268aeb919c1fa4d224687e13.tar.gz
gitea-514382e2ebfe6869268aeb919c1fa4d224687e13.zip
Rename module: middleware -> context
Diffstat (limited to 'routers/api/v1/api.go')
-rw-r--r--routers/api/v1/api.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index 04b392fc9b..c314d7a036 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -14,7 +14,7 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
- "github.com/gogits/gogs/modules/middleware"
+ "github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/routers/api/v1/admin"
"github.com/gogits/gogs/routers/api/v1/misc"
"github.com/gogits/gogs/routers/api/v1/org"
@@ -23,7 +23,7 @@ import (
)
func RepoAssignment() macaron.Handler {
- return func(ctx *middleware.Context) {
+ return func(ctx *context.Context) {
userName := ctx.Params(":username")
repoName := ctx.Params(":reponame")
@@ -82,7 +82,7 @@ func RepoAssignment() macaron.Handler {
// Contexter middleware already checks token for user sign in process.
func ReqToken() macaron.Handler {
- return func(ctx *middleware.Context) {
+ return func(ctx *context.Context) {
if !ctx.IsSigned {
ctx.Error(401)
return
@@ -91,7 +91,7 @@ func ReqToken() macaron.Handler {
}
func ReqBasicAuth() macaron.Handler {
- return func(ctx *middleware.Context) {
+ return func(ctx *context.Context) {
if !ctx.IsBasicAuth {
ctx.Error(401)
return
@@ -100,7 +100,7 @@ func ReqBasicAuth() macaron.Handler {
}
func ReqAdmin() macaron.Handler {
- return func(ctx *middleware.Context) {
+ return func(ctx *context.Context) {
if !ctx.User.IsAdmin {
ctx.Error(403)
return
@@ -181,11 +181,11 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Combo("/hooks").Get(repo.ListHooks).
Post(bind(api.CreateHookOption{}), repo.CreateHook)
m.Patch("/hooks/:id:int", bind(api.EditHookOption{}), repo.EditHook)
- m.Get("/raw/*", middleware.RepoRef(), repo.GetRawFile)
+ m.Get("/raw/*", context.RepoRef(), repo.GetRawFile)
m.Get("/archive/*", repo.GetArchive)
m.Group("/branches", func() {
- m.Get("",repo.ListBranches)
- m.Get("/:branchname",repo.GetBranch)
+ m.Get("", repo.ListBranches)
+ m.Get("/:branchname", repo.GetBranch)
})
m.Group("/keys", func() {
m.Combo("").Get(repo.ListDeployKeys).
@@ -201,7 +201,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/users/:username/orgs", org.ListUserOrgs)
m.Combo("/orgs/:orgname").Get(org.Get).Patch(bind(api.EditOrgOption{}), org.Edit)
- m.Any("/*", func(ctx *middleware.Context) {
+ m.Any("/*", func(ctx *context.Context) {
ctx.Error(404)
})