Fix fork repo and macaron API broken
This commit is contained in:
parent
baae94b9cf
commit
f1d8746264
8 changed files with 171 additions and 178 deletions
11
.gitignore
vendored
11
.gitignore
vendored
|
@ -8,28 +8,19 @@ data/
|
||||||
*.iml
|
*.iml
|
||||||
public/img/avatar/
|
public/img/avatar/
|
||||||
files/
|
files/
|
||||||
|
|
||||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
|
||||||
*.o
|
*.o
|
||||||
*.a
|
*.a
|
||||||
*.so
|
*.so
|
||||||
|
|
||||||
# Folders
|
|
||||||
_obj
|
_obj
|
||||||
_test
|
_test
|
||||||
|
|
||||||
# Architecture specific extensions/prefixes
|
|
||||||
*.[568vq]
|
*.[568vq]
|
||||||
[568vq].out
|
[568vq].out
|
||||||
|
|
||||||
*.cgo1.go
|
*.cgo1.go
|
||||||
*.cgo2.c
|
*.cgo2.c
|
||||||
_cgo_defun.c
|
_cgo_defun.c
|
||||||
_cgo_gotypes.go
|
_cgo_gotypes.go
|
||||||
_cgo_export.*
|
_cgo_export.*
|
||||||
|
|
||||||
_testmain.go
|
_testmain.go
|
||||||
|
|
||||||
*.exe
|
*.exe
|
||||||
*.exe~
|
*.exe~
|
||||||
/gogs
|
/gogs
|
||||||
|
@ -42,3 +33,5 @@ config.codekit
|
||||||
docker/fig.yml
|
docker/fig.yml
|
||||||
docker/docker/Dockerfile
|
docker/docker/Dockerfile
|
||||||
docker/docker/init_gogs.sh
|
docker/docker/init_gogs.sh
|
||||||
|
gogs.sublime-project
|
||||||
|
gogs.sublime-workspace
|
318
cmd/web.go
318
cmd/web.go
|
@ -151,62 +151,62 @@ func runWeb(*cli.Context) {
|
||||||
m.Get("/explore", ignSignIn, routers.Explore)
|
m.Get("/explore", ignSignIn, routers.Explore)
|
||||||
m.Get("/install", bindIgnErr(auth.InstallForm{}), routers.Install)
|
m.Get("/install", bindIgnErr(auth.InstallForm{}), routers.Install)
|
||||||
m.Post("/install", bindIgnErr(auth.InstallForm{}), routers.InstallPost)
|
m.Post("/install", bindIgnErr(auth.InstallForm{}), routers.InstallPost)
|
||||||
m.Group("", func(r *macaron.Router) {
|
m.Group("", func() {
|
||||||
r.Get("/pulls", user.Pulls)
|
m.Get("/pulls", user.Pulls)
|
||||||
r.Get("/issues", user.Issues)
|
m.Get("/issues", user.Issues)
|
||||||
}, reqSignIn)
|
}, reqSignIn)
|
||||||
|
|
||||||
// API routers.
|
// API routers.
|
||||||
m.Group("/api", func(_ *macaron.Router) {
|
m.Group("/api", func() {
|
||||||
m.Group("/v1", func(r *macaron.Router) {
|
m.Group("/v1", func() {
|
||||||
// Miscellaneous.
|
// Miscellaneous.
|
||||||
r.Post("/markdown", bindIgnErr(apiv1.MarkdownForm{}), v1.Markdown)
|
m.Post("/markdown", bindIgnErr(apiv1.MarkdownForm{}), v1.Markdown)
|
||||||
r.Post("/markdown/raw", v1.MarkdownRaw)
|
m.Post("/markdown/raw", v1.MarkdownRaw)
|
||||||
|
|
||||||
// Users.
|
// Users.
|
||||||
m.Group("/users", func(r *macaron.Router) {
|
m.Group("/users", func() {
|
||||||
r.Get("/search", v1.SearchUsers)
|
m.Get("/search", v1.SearchUsers)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Repositories.
|
// Repositories.
|
||||||
m.Group("/repos", func(r *macaron.Router) {
|
m.Group("/repos", func() {
|
||||||
r.Get("/search", v1.SearchRepos)
|
m.Get("/search", v1.SearchRepos)
|
||||||
r.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), v1.Migrate)
|
m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), v1.Migrate)
|
||||||
})
|
})
|
||||||
|
|
||||||
r.Any("/*", func(ctx *middleware.Context) {
|
m.Any("/*", func(ctx *middleware.Context) {
|
||||||
ctx.JSON(404, &base.ApiJsonErr{"Not Found", v1.DOC_URL})
|
ctx.JSON(404, &base.ApiJsonErr{"Not Found", v1.DOC_URL})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// User routers.
|
// User routers.
|
||||||
m.Group("/user", func(r *macaron.Router) {
|
m.Group("/user", func() {
|
||||||
r.Get("/login", user.SignIn)
|
m.Get("/login", user.SignIn)
|
||||||
r.Post("/login", bindIgnErr(auth.SignInForm{}), user.SignInPost)
|
m.Post("/login", bindIgnErr(auth.SignInForm{}), user.SignInPost)
|
||||||
r.Get("/login/:name", user.SocialSignIn)
|
m.Get("/login/:name", user.SocialSignIn)
|
||||||
r.Get("/sign_up", user.SignUp)
|
m.Get("/sign_up", user.SignUp)
|
||||||
r.Post("/sign_up", bindIgnErr(auth.RegisterForm{}), user.SignUpPost)
|
m.Post("/sign_up", bindIgnErr(auth.RegisterForm{}), user.SignUpPost)
|
||||||
r.Get("/reset_password", user.ResetPasswd)
|
m.Get("/reset_password", user.ResetPasswd)
|
||||||
r.Post("/reset_password", user.ResetPasswdPost)
|
m.Post("/reset_password", user.ResetPasswdPost)
|
||||||
}, reqSignOut)
|
}, reqSignOut)
|
||||||
m.Group("/user/settings", func(r *macaron.Router) {
|
m.Group("/user/settings", func() {
|
||||||
r.Get("", user.Settings)
|
m.Get("", user.Settings)
|
||||||
r.Post("", bindIgnErr(auth.UpdateProfileForm{}), user.SettingsPost)
|
m.Post("", bindIgnErr(auth.UpdateProfileForm{}), user.SettingsPost)
|
||||||
r.Get("/password", user.SettingsPassword)
|
m.Get("/password", user.SettingsPassword)
|
||||||
r.Post("/password", bindIgnErr(auth.ChangePasswordForm{}), user.SettingsPasswordPost)
|
m.Post("/password", bindIgnErr(auth.ChangePasswordForm{}), user.SettingsPasswordPost)
|
||||||
r.Get("/ssh", user.SettingsSSHKeys)
|
m.Get("/ssh", user.SettingsSSHKeys)
|
||||||
r.Post("/ssh", bindIgnErr(auth.AddSSHKeyForm{}), user.SettingsSSHKeysPost)
|
m.Post("/ssh", bindIgnErr(auth.AddSSHKeyForm{}), user.SettingsSSHKeysPost)
|
||||||
r.Get("/social", user.SettingsSocial)
|
m.Get("/social", user.SettingsSocial)
|
||||||
r.Route("/delete", "GET,POST", user.SettingsDelete)
|
m.Route("/delete", "GET,POST", user.SettingsDelete)
|
||||||
}, reqSignIn)
|
}, reqSignIn)
|
||||||
m.Group("/user", func(r *macaron.Router) {
|
m.Group("/user", func() {
|
||||||
// r.Get("/feeds", binding.Bind(auth.FeedsForm{}), user.Feeds)
|
// r.Get("/feeds", binding.Bind(auth.FeedsForm{}), user.Feeds)
|
||||||
r.Any("/activate", user.Activate)
|
m.Any("/activate", user.Activate)
|
||||||
r.Get("/email2user", user.Email2User)
|
m.Get("/email2user", user.Email2User)
|
||||||
r.Get("/forget_password", user.ForgotPasswd)
|
m.Get("/forget_password", user.ForgotPasswd)
|
||||||
r.Post("/forget_password", user.ForgotPasswdPost)
|
m.Post("/forget_password", user.ForgotPasswdPost)
|
||||||
r.Get("/logout", user.SignOut)
|
m.Get("/logout", user.SignOut)
|
||||||
})
|
})
|
||||||
|
|
||||||
// FIXME: Legacy
|
// FIXME: Legacy
|
||||||
|
@ -219,40 +219,40 @@ func runWeb(*cli.Context) {
|
||||||
|
|
||||||
adminReq := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true, AdminRequire: true})
|
adminReq := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true, AdminRequire: true})
|
||||||
|
|
||||||
m.Group("/admin", func(r *macaron.Router) {
|
m.Group("/admin", func() {
|
||||||
m.Get("", adminReq, admin.Dashboard)
|
m.Get("", adminReq, admin.Dashboard)
|
||||||
r.Get("/config", admin.Config)
|
m.Get("/config", admin.Config)
|
||||||
r.Get("/monitor", admin.Monitor)
|
m.Get("/monitor", admin.Monitor)
|
||||||
|
|
||||||
m.Group("/users", func(r *macaron.Router) {
|
m.Group("/users", func() {
|
||||||
r.Get("", admin.Users)
|
m.Get("", admin.Users)
|
||||||
r.Get("/new", admin.NewUser)
|
m.Get("/new", admin.NewUser)
|
||||||
r.Post("/new", bindIgnErr(auth.RegisterForm{}), admin.NewUserPost)
|
m.Post("/new", bindIgnErr(auth.RegisterForm{}), admin.NewUserPost)
|
||||||
r.Get("/:userid", admin.EditUser)
|
m.Get("/:userid", admin.EditUser)
|
||||||
r.Post("/:userid", bindIgnErr(auth.AdminEditUserForm{}), admin.EditUserPost)
|
m.Post("/:userid", bindIgnErr(auth.AdminEditUserForm{}), admin.EditUserPost)
|
||||||
r.Post("/:userid/delete", admin.DeleteUser)
|
m.Post("/:userid/delete", admin.DeleteUser)
|
||||||
})
|
})
|
||||||
|
|
||||||
m.Group("/orgs", func(r *macaron.Router) {
|
m.Group("/orgs", func() {
|
||||||
r.Get("", admin.Organizations)
|
m.Get("", admin.Organizations)
|
||||||
})
|
})
|
||||||
|
|
||||||
m.Group("/repos", func(r *macaron.Router) {
|
m.Group("/repos", func() {
|
||||||
r.Get("", admin.Repositories)
|
m.Get("", admin.Repositories)
|
||||||
})
|
})
|
||||||
|
|
||||||
m.Group("/auths", func(r *macaron.Router) {
|
m.Group("/auths", func() {
|
||||||
r.Get("", admin.Authentications)
|
m.Get("", admin.Authentications)
|
||||||
r.Get("/new", admin.NewAuthSource)
|
m.Get("/new", admin.NewAuthSource)
|
||||||
r.Post("/new", bindIgnErr(auth.AuthenticationForm{}), admin.NewAuthSourcePost)
|
m.Post("/new", bindIgnErr(auth.AuthenticationForm{}), admin.NewAuthSourcePost)
|
||||||
r.Get("/:authid", admin.EditAuthSource)
|
m.Get("/:authid", admin.EditAuthSource)
|
||||||
r.Post("/:authid", bindIgnErr(auth.AuthenticationForm{}), admin.EditAuthSourcePost)
|
m.Post("/:authid", bindIgnErr(auth.AuthenticationForm{}), admin.EditAuthSourcePost)
|
||||||
r.Post("/:authid/delete", admin.DeleteAuthSource)
|
m.Post("/:authid/delete", admin.DeleteAuthSource)
|
||||||
})
|
})
|
||||||
|
|
||||||
m.Group("/notices", func(r *macaron.Router) {
|
m.Group("/notices", func() {
|
||||||
r.Get("", admin.Notices)
|
m.Get("", admin.Notices)
|
||||||
r.Get("/:id:int/delete", admin.DeleteNotice)
|
m.Get("/:id:int/delete", admin.DeleteNotice)
|
||||||
})
|
})
|
||||||
}, adminReq)
|
}, adminReq)
|
||||||
|
|
||||||
|
@ -265,135 +265,135 @@ func runWeb(*cli.Context) {
|
||||||
reqTrueOwner := middleware.RequireTrueOwner()
|
reqTrueOwner := middleware.RequireTrueOwner()
|
||||||
|
|
||||||
// Organization routers.
|
// Organization routers.
|
||||||
m.Group("/org", func(r *macaron.Router) {
|
m.Group("/org", func() {
|
||||||
r.Get("/create", org.Create)
|
m.Get("/create", org.Create)
|
||||||
r.Post("/create", bindIgnErr(auth.CreateOrgForm{}), org.CreatePost)
|
m.Post("/create", bindIgnErr(auth.CreateOrgForm{}), org.CreatePost)
|
||||||
|
|
||||||
m.Group("/:org", func(r *macaron.Router) {
|
m.Group("/:org", func() {
|
||||||
r.Get("/dashboard", user.Dashboard)
|
m.Get("/dashboard", user.Dashboard)
|
||||||
r.Get("/members", org.Members)
|
m.Get("/members", org.Members)
|
||||||
r.Get("/members/action/:action", org.MembersAction)
|
m.Get("/members/action/:action", org.MembersAction)
|
||||||
|
|
||||||
r.Get("/teams", org.Teams)
|
m.Get("/teams", org.Teams)
|
||||||
r.Get("/teams/:team", org.TeamMembers)
|
m.Get("/teams/:team", org.TeamMembers)
|
||||||
r.Get("/teams/:team/repositories", org.TeamRepositories)
|
m.Get("/teams/:team/repositories", org.TeamRepositories)
|
||||||
r.Get("/teams/:team/action/:action", org.TeamsAction)
|
m.Get("/teams/:team/action/:action", org.TeamsAction)
|
||||||
r.Get("/teams/:team/action/repo/:action", org.TeamsRepoAction)
|
m.Get("/teams/:team/action/repo/:action", org.TeamsRepoAction)
|
||||||
}, middleware.OrgAssignment(true, true))
|
}, middleware.OrgAssignment(true, true))
|
||||||
|
|
||||||
m.Group("/:org", func(r *macaron.Router) {
|
m.Group("/:org", func() {
|
||||||
r.Get("/teams/new", org.NewTeam)
|
m.Get("/teams/new", org.NewTeam)
|
||||||
r.Post("/teams/new", bindIgnErr(auth.CreateTeamForm{}), org.NewTeamPost)
|
m.Post("/teams/new", bindIgnErr(auth.CreateTeamForm{}), org.NewTeamPost)
|
||||||
r.Get("/teams/:team/edit", org.EditTeam)
|
m.Get("/teams/:team/edit", org.EditTeam)
|
||||||
r.Post("/teams/:team/edit", bindIgnErr(auth.CreateTeamForm{}), org.EditTeamPost)
|
m.Post("/teams/:team/edit", bindIgnErr(auth.CreateTeamForm{}), org.EditTeamPost)
|
||||||
r.Post("/teams/:team/delete", org.DeleteTeam)
|
m.Post("/teams/:team/delete", org.DeleteTeam)
|
||||||
|
|
||||||
m.Group("/settings", func(r *macaron.Router) {
|
m.Group("/settings", func() {
|
||||||
r.Get("", org.Settings)
|
m.Get("", org.Settings)
|
||||||
r.Post("", bindIgnErr(auth.UpdateOrgSettingForm{}), org.SettingsPost)
|
m.Post("", bindIgnErr(auth.UpdateOrgSettingForm{}), org.SettingsPost)
|
||||||
r.Get("/hooks", org.SettingsHooks)
|
m.Get("/hooks", org.SettingsHooks)
|
||||||
r.Get("/hooks/new", repo.WebHooksNew)
|
m.Get("/hooks/new", repo.WebHooksNew)
|
||||||
r.Post("/hooks/gogs/new", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksNewPost)
|
m.Post("/hooks/gogs/new", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksNewPost)
|
||||||
r.Post("/hooks/slack/new", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksNewPost)
|
m.Post("/hooks/slack/new", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksNewPost)
|
||||||
r.Get("/hooks/:id", repo.WebHooksEdit)
|
m.Get("/hooks/:id", repo.WebHooksEdit)
|
||||||
r.Post("/hooks/gogs/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
|
m.Post("/hooks/gogs/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
|
||||||
r.Post("/hooks/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost)
|
m.Post("/hooks/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost)
|
||||||
r.Route("/delete", "GET,POST", org.SettingsDelete)
|
m.Route("/delete", "GET,POST", org.SettingsDelete)
|
||||||
})
|
})
|
||||||
|
|
||||||
r.Route("/invitations/new", "GET,POST", org.Invitation)
|
m.Route("/invitations/new", "GET,POST", org.Invitation)
|
||||||
}, middleware.OrgAssignment(true, true, true))
|
}, middleware.OrgAssignment(true, true, true))
|
||||||
}, reqSignIn)
|
}, reqSignIn)
|
||||||
m.Group("/org", func(r *macaron.Router) {
|
m.Group("/org", func() {
|
||||||
r.Get("/:org", org.Home)
|
m.Get("/:org", org.Home)
|
||||||
}, middleware.OrgAssignment(true))
|
}, middleware.OrgAssignment(true))
|
||||||
|
|
||||||
// Repository routers.
|
// Repository routers.
|
||||||
m.Group("/repo", func(r *macaron.Router) {
|
m.Group("/repo", func() {
|
||||||
r.Get("/create", repo.Create)
|
m.Get("/create", repo.Create)
|
||||||
r.Post("/create", bindIgnErr(auth.CreateRepoForm{}), repo.CreatePost)
|
m.Post("/create", bindIgnErr(auth.CreateRepoForm{}), repo.CreatePost)
|
||||||
r.Get("/migrate", repo.Migrate)
|
m.Get("/migrate", repo.Migrate)
|
||||||
r.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), repo.MigratePost)
|
m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), repo.MigratePost)
|
||||||
}, reqSignIn)
|
}, reqSignIn)
|
||||||
|
|
||||||
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func() {
|
||||||
r.Get("/settings", repo.Settings)
|
m.Get("/settings", repo.Settings)
|
||||||
r.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingsPost)
|
m.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingsPost)
|
||||||
m.Group("/settings", func(r *macaron.Router) {
|
m.Group("/settings", func() {
|
||||||
r.Route("/collaboration", "GET,POST", repo.SettingsCollaboration)
|
m.Route("/collaboration", "GET,POST", repo.SettingsCollaboration)
|
||||||
r.Get("/hooks", repo.Webhooks)
|
m.Get("/hooks", repo.Webhooks)
|
||||||
r.Get("/hooks/new", repo.WebHooksNew)
|
m.Get("/hooks/new", repo.WebHooksNew)
|
||||||
r.Post("/hooks/gogs/new", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksNewPost)
|
m.Post("/hooks/gogs/new", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksNewPost)
|
||||||
r.Post("/hooks/slack/new", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksNewPost)
|
m.Post("/hooks/slack/new", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksNewPost)
|
||||||
r.Get("/hooks/:id", repo.WebHooksEdit)
|
m.Get("/hooks/:id", repo.WebHooksEdit)
|
||||||
r.Post("/hooks/gogs/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
|
m.Post("/hooks/gogs/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
|
||||||
r.Post("/hooks/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost)
|
m.Post("/hooks/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost)
|
||||||
|
|
||||||
m.Group("/hooks/git", func(r *macaron.Router) {
|
m.Group("/hooks/git", func() {
|
||||||
r.Get("", repo.GitHooks)
|
m.Get("", repo.GitHooks)
|
||||||
r.Get("/:name", repo.GitHooksEdit)
|
m.Get("/:name", repo.GitHooksEdit)
|
||||||
r.Post("/:name", repo.GitHooksEditPost)
|
m.Post("/:name", repo.GitHooksEditPost)
|
||||||
}, middleware.GitHookService())
|
}, middleware.GitHookService())
|
||||||
})
|
})
|
||||||
}, reqSignIn, middleware.RepoAssignment(true), reqTrueOwner)
|
}, reqSignIn, middleware.RepoAssignment(true), reqTrueOwner)
|
||||||
|
|
||||||
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func() {
|
||||||
r.Get("/action/:action", repo.Action)
|
m.Get("/action/:action", repo.Action)
|
||||||
|
|
||||||
m.Group("/issues", func(r *macaron.Router) {
|
m.Group("/issues", func() {
|
||||||
r.Get("/new", repo.CreateIssue)
|
m.Get("/new", repo.CreateIssue)
|
||||||
r.Post("/new", bindIgnErr(auth.CreateIssueForm{}), repo.CreateIssuePost)
|
m.Post("/new", bindIgnErr(auth.CreateIssueForm{}), repo.CreateIssuePost)
|
||||||
r.Post("/:index", bindIgnErr(auth.CreateIssueForm{}), repo.UpdateIssue)
|
m.Post("/:index", bindIgnErr(auth.CreateIssueForm{}), repo.UpdateIssue)
|
||||||
r.Post("/:index/label", repo.UpdateIssueLabel)
|
m.Post("/:index/label", repo.UpdateIssueLabel)
|
||||||
r.Post("/:index/milestone", repo.UpdateIssueMilestone)
|
m.Post("/:index/milestone", repo.UpdateIssueMilestone)
|
||||||
r.Post("/:index/assignee", repo.UpdateAssignee)
|
m.Post("/:index/assignee", repo.UpdateAssignee)
|
||||||
r.Get("/:index/attachment/:id", repo.IssueGetAttachment)
|
m.Get("/:index/attachment/:id", repo.IssueGetAttachment)
|
||||||
r.Post("/labels/new", bindIgnErr(auth.CreateLabelForm{}), repo.NewLabel)
|
m.Post("/labels/new", bindIgnErr(auth.CreateLabelForm{}), repo.NewLabel)
|
||||||
r.Post("/labels/edit", bindIgnErr(auth.CreateLabelForm{}), repo.UpdateLabel)
|
m.Post("/labels/edit", bindIgnErr(auth.CreateLabelForm{}), repo.UpdateLabel)
|
||||||
r.Post("/labels/delete", repo.DeleteLabel)
|
m.Post("/labels/delete", repo.DeleteLabel)
|
||||||
r.Get("/milestones", repo.Milestones)
|
m.Get("/milestones", repo.Milestones)
|
||||||
r.Get("/milestones/new", repo.NewMilestone)
|
m.Get("/milestones/new", repo.NewMilestone)
|
||||||
r.Post("/milestones/new", bindIgnErr(auth.CreateMilestoneForm{}), repo.NewMilestonePost)
|
m.Post("/milestones/new", bindIgnErr(auth.CreateMilestoneForm{}), repo.NewMilestonePost)
|
||||||
r.Get("/milestones/:index/edit", repo.UpdateMilestone)
|
m.Get("/milestones/:index/edit", repo.UpdateMilestone)
|
||||||
r.Post("/milestones/:index/edit", bindIgnErr(auth.CreateMilestoneForm{}), repo.UpdateMilestonePost)
|
m.Post("/milestones/:index/edit", bindIgnErr(auth.CreateMilestoneForm{}), repo.UpdateMilestonePost)
|
||||||
r.Get("/milestones/:index/:action", repo.UpdateMilestone)
|
m.Get("/milestones/:index/:action", repo.UpdateMilestone)
|
||||||
})
|
})
|
||||||
|
|
||||||
r.Post("/comment/:action", repo.Comment)
|
m.Post("/comment/:action", repo.Comment)
|
||||||
r.Get("/releases/new", repo.NewRelease)
|
m.Get("/releases/new", repo.NewRelease)
|
||||||
r.Get("/releases/edit/:tagname", repo.EditRelease)
|
m.Get("/releases/edit/:tagname", repo.EditRelease)
|
||||||
}, reqSignIn, middleware.RepoAssignment(true))
|
}, reqSignIn, middleware.RepoAssignment(true))
|
||||||
|
|
||||||
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func() {
|
||||||
r.Post("/releases/new", bindIgnErr(auth.NewReleaseForm{}), repo.NewReleasePost)
|
m.Post("/releases/new", bindIgnErr(auth.NewReleaseForm{}), repo.NewReleasePost)
|
||||||
r.Post("/releases/edit/:tagname", bindIgnErr(auth.EditReleaseForm{}), repo.EditReleasePost)
|
m.Post("/releases/edit/:tagname", bindIgnErr(auth.EditReleaseForm{}), repo.EditReleasePost)
|
||||||
}, reqSignIn, middleware.RepoAssignment(true, true))
|
}, reqSignIn, middleware.RepoAssignment(true, true))
|
||||||
|
|
||||||
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func() {
|
||||||
r.Get("/issues", repo.Issues)
|
m.Get("/issues", repo.Issues)
|
||||||
r.Get("/issues/:index", repo.ViewIssue)
|
m.Get("/issues/:index", repo.ViewIssue)
|
||||||
r.Get("/pulls", repo.Pulls)
|
m.Get("/pulls", repo.Pulls)
|
||||||
r.Get("/branches", repo.Branches)
|
m.Get("/branches", repo.Branches)
|
||||||
r.Get("/archive/*", repo.Download)
|
m.Get("/archive/*", repo.Download)
|
||||||
r.Get("/issues2/", repo.Issues2)
|
m.Get("/issues2/", repo.Issues2)
|
||||||
}, ignSignIn, middleware.RepoAssignment(true))
|
}, ignSignIn, middleware.RepoAssignment(true))
|
||||||
|
|
||||||
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func() {
|
||||||
r.Get("/src/:branchname", repo.Home)
|
m.Get("/src/:branchname", repo.Home)
|
||||||
r.Get("/src/:branchname/*", repo.Home)
|
m.Get("/src/:branchname/*", repo.Home)
|
||||||
r.Get("/raw/:branchname/*", repo.SingleDownload)
|
m.Get("/raw/:branchname/*", repo.SingleDownload)
|
||||||
r.Get("/commits/:branchname", repo.Commits)
|
m.Get("/commits/:branchname", repo.Commits)
|
||||||
r.Get("/commits/:branchname/search", repo.SearchCommits)
|
m.Get("/commits/:branchname/search", repo.SearchCommits)
|
||||||
r.Get("/commits/:branchname/*", repo.FileHistory)
|
m.Get("/commits/:branchname/*", repo.FileHistory)
|
||||||
r.Get("/commit/:branchname", repo.Diff)
|
m.Get("/commit/:branchname", repo.Diff)
|
||||||
r.Get("/commit/:branchname/*", repo.Diff)
|
m.Get("/commit/:branchname/*", repo.Diff)
|
||||||
r.Get("/releases", repo.Releases)
|
m.Get("/releases", repo.Releases)
|
||||||
r.Get("/compare/:before([a-z0-9]+)...:after([a-z0-9]+)", repo.CompareDiff)
|
m.Get("/compare/:before([a-z0-9]+)...:after([a-z0-9]+)", repo.CompareDiff)
|
||||||
}, ignSignIn, middleware.RepoAssignment(true, true))
|
}, ignSignIn, middleware.RepoAssignment(true, true))
|
||||||
|
|
||||||
m.Group("/:username", func(r *macaron.Router) {
|
m.Group("/:username", func() {
|
||||||
r.Get("/:reponame", ignSignIn, middleware.RepoAssignment(true, true, true), repo.Home)
|
m.Get("/:reponame", ignSignIn, middleware.RepoAssignment(true, true, true), repo.Home)
|
||||||
r.Any("/:reponame/*", ignSignInAndCsrf, repo.Http)
|
m.Any("/:reponame/*", ignSignInAndCsrf, repo.Http)
|
||||||
})
|
})
|
||||||
|
|
||||||
// robots.txt
|
// robots.txt
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.5.6.1019 Beta"
|
const APP_VER = "0.5.6.1024 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -149,7 +149,7 @@ func DelLoginSource(source *LoginSource) error {
|
||||||
|
|
||||||
// UserSignIn validates user name and password.
|
// UserSignIn validates user name and password.
|
||||||
func UserSignIn(uname, passwd string) (*User, error) {
|
func UserSignIn(uname, passwd string) (*User, error) {
|
||||||
var u *User
|
u := new(User)
|
||||||
if strings.Contains(uname, "@") {
|
if strings.Contains(uname, "@") {
|
||||||
u = &User{Email: uname}
|
u = &User{Email: uname}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1424,7 +1424,7 @@ func ForkRepository(u *User, oldRepo *Repository) (*Repository, error) {
|
||||||
repoPath := RepoPath(u.Name, repo.Name)
|
repoPath := RepoPath(u.Name, repo.Name)
|
||||||
_, stderr, err := process.ExecTimeout(10*time.Minute,
|
_, stderr, err := process.ExecTimeout(10*time.Minute,
|
||||||
fmt.Sprintf("ForkRepository(git clone): %s/%s", u.Name, repo.Name),
|
fmt.Sprintf("ForkRepository(git clone): %s/%s", u.Name, repo.Name),
|
||||||
"git", "clone", oldRepoPath, repoPath)
|
"git", "clone", "--bare", oldRepoPath, repoPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.New("ForkRepository(git clone): " + stderr)
|
return nil, errors.New("ForkRepository(git clone): " + stderr)
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,7 +193,7 @@ func IsEmailUsed(email string) (bool, error) {
|
||||||
return x.Get(&User{Email: email})
|
return x.Get(&User{Email: email})
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserSalt returns a user salt token
|
// GetUserSalt returns a ramdom user salt token.
|
||||||
func GetUserSalt() string {
|
func GetUserSalt() string {
|
||||||
return base.GetRandomString(10)
|
return base.GetRandomString(10)
|
||||||
}
|
}
|
||||||
|
@ -473,19 +473,19 @@ func GetUserById(id int64) (*User, error) {
|
||||||
return u, nil
|
return u, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserByName returns the user object by given name if exists.
|
// GetUserByName returns user by given name.
|
||||||
func GetUserByName(name string) (*User, error) {
|
func GetUserByName(name string) (*User, error) {
|
||||||
if len(name) == 0 {
|
if len(name) == 0 {
|
||||||
return nil, ErrUserNotExist
|
return nil, ErrUserNotExist
|
||||||
}
|
}
|
||||||
user := &User{LowerName: strings.ToLower(name)}
|
u := &User{LowerName: strings.ToLower(name)}
|
||||||
has, err := x.Get(user)
|
has, err := x.Get(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
return nil, ErrUserNotExist
|
return nil, ErrUserNotExist
|
||||||
}
|
}
|
||||||
return user, nil
|
return u, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserEmailsByNames returns a list of e-mails corresponds to names.
|
// GetUserEmailsByNames returns a list of e-mails corresponds to names.
|
||||||
|
|
|
@ -24,7 +24,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Encode string to md5 hex value
|
// Encode string to md5 hex value.
|
||||||
func EncodeMd5(str string) string {
|
func EncodeMd5(str string) string {
|
||||||
m := md5.New()
|
m := md5.New()
|
||||||
m.Write([]byte(str))
|
m.Write([]byte(str))
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.5.6.1019 Beta
|
0.5.6.1024 Beta
|
Loading…
Reference in a new issue