append route to web

This commit is contained in:
Gogs 2014-03-23 18:13:23 +08:00
parent 79604f553f
commit 964e537479
7 changed files with 118 additions and 77 deletions

5
web.go
View file

@ -18,6 +18,7 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/avatar"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/mailer"
@ -114,6 +115,9 @@ func runWeb(*cli.Context) {
m.Get("/help", routers.Help)
avatarHandler := avatar.HttpHandler("public/img/avatar", "public/img/avatar/default.jpg")
m.Get("/avatar/:hash", avatarHandler.ServeHTTP)
adminReq := middleware.AdminRequire()
m.Get("/admin", reqSignIn, adminReq, admin.Dashboard)
m.Get("/admin/users", reqSignIn, adminReq, admin.Users)
@ -136,7 +140,6 @@ func runWeb(*cli.Context) {
ignSignIn, middleware.RepoAssignment(true), repo.Single)
m.Get("/:username/:reponame/commit/:commitid/**", ignSignIn, middleware.RepoAssignment(true), repo.Single)
m.Get("/:username/:reponame/commit/:commitid", ignSignIn, middleware.RepoAssignment(true), repo.Single)
m.Get("/:username/:reponame", ignSignIn, middleware.RepoAssignment(true), repo.Single)
m.Any("/:username/:reponame/**", ignSignIn, repo.Http)