aboutsummaryrefslogtreecommitdiff
path: root/web.go
diff options
context:
space:
mode:
Diffstat (limited to 'web.go')
-rw-r--r--web.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/web.go b/web.go
index 9d90851c..9717c938 100644
--- a/web.go
+++ b/web.go
@@ -17,6 +17,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"
@@ -30,9 +31,10 @@ import (
var CmdWeb = cli.Command{
Name: "web",
- Usage: "just run",
+ Usage: "Gogs web server",
Description: `
-gogs web`,
+gogs web server is the only thing you need to run,
+and it takes care of all the other things for you`,
Action: runWeb,
Flags: []cli.Flag{},
}
@@ -87,12 +89,15 @@ func runWeb(*cli.Context) {
reqSignOut := middleware.Toggle(&middleware.ToggleOptions{SignOutRequire: true})
// Routers.
- m.Get("/", ignSignIn, routers.Home)
+ m.Get("/", reqSignIn, routers.Home)
m.Get("/issues", reqSignIn, user.Issues)
m.Get("/pulls", reqSignIn, user.Pulls)
m.Get("/stars", reqSignIn, user.Stars)
m.Get("/help", routers.Help)
+ avatarCache := avatar.HttpHandler("public/img/avatar/", "public/img/avatar_default.jpg")
+ m.Get("/avatar/:hash", avatarCache.ServeHTTP)
+
m.Group("/user", func(r martini.Router) {
r.Any("/login", binding.BindIgnErr(auth.LogInForm{}), user.SignIn)
r.Any("/sign_up", binding.BindIgnErr(auth.RegisterForm{}), user.SignUp)
@@ -141,7 +146,8 @@ func runWeb(*cli.Context) {
r.Get("/commits/:branchname", repo.Commits)
r.Get("/issues", repo.Issues)
r.Any("/issues/new", binding.BindIgnErr(auth.CreateIssueForm{}), repo.CreateIssue)
- r.Get("/issues/:issueid", repo.ViewIssue)
+ r.Get("/issues/:index", repo.ViewIssue)
+ r.Post("/issues/:index", binding.BindIgnErr(auth.CreateIssueForm{}), repo.UpdateIssue)
r.Get("/pulls", repo.Pulls)
r.Get("/branches", repo.Branches)
r.Get("/src/:branchname", repo.Single)
@@ -151,8 +157,8 @@ func runWeb(*cli.Context) {
}, ignSignIn, middleware.RepoAssignment(true))
// TODO: implement single commit page
- // 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/commit/:commitid/**", ignSignIn, middleware.RepoAssignment(true), repo.Diff)
+ m.Get("/:username/:reponame/commit/:commitid", ignSignIn, middleware.RepoAssignment(true), repo.Diff)
m.Group("/:username", func(r martini.Router) {
r.Get("/:reponame", middleware.RepoAssignment(true), repo.Single)