|
|
@ -529,7 +529,7 @@ func runWeb(ctx *cli.Context) error { |
|
|
|
m.Post("/delete", repo.DeleteRelease) |
|
|
|
m.Post("/delete", repo.DeleteRelease) |
|
|
|
m.Get("/edit/*", repo.EditRelease) |
|
|
|
m.Get("/edit/*", repo.EditRelease) |
|
|
|
m.Post("/edit/*", bindIgnErr(form.EditRelease{}), repo.EditReleasePost) |
|
|
|
m.Post("/edit/*", bindIgnErr(form.EditRelease{}), repo.EditReleasePost) |
|
|
|
}, reqRepoWriter, func(ctx *context.Context) { |
|
|
|
}, repo.MustBeNotBare, reqRepoWriter, func(ctx *context.Context) { |
|
|
|
ctx.Data["PageIsViewCode"] = true |
|
|
|
ctx.Data["PageIsViewCode"] = true |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -560,17 +560,17 @@ func runWeb(ctx *cli.Context) error { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, reqRepoWriter, context.RepoRef(), func(ctx *context.Context) { |
|
|
|
}, repo.MustBeNotBare, reqRepoWriter, context.RepoRef(), func(ctx *context.Context) { |
|
|
|
if !ctx.Repo.CanEnableEditor() { |
|
|
|
if !ctx.Repo.CanEnableEditor() { |
|
|
|
ctx.NotFound() |
|
|
|
ctx.NotFound() |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, reqSignIn, context.RepoAssignment(), repo.MustBeNotBare) |
|
|
|
}, reqSignIn, context.RepoAssignment()) |
|
|
|
|
|
|
|
|
|
|
|
m.Group("/:username/:reponame", func() { |
|
|
|
m.Group("/:username/:reponame", func() { |
|
|
|
m.Group("", func() { |
|
|
|
m.Group("", func() { |
|
|
|
m.Get("/releases", repo.Releases) |
|
|
|
m.Get("/releases", repo.MustBeNotBare, repo.Releases) |
|
|
|
m.Get("/^:type(issues|pulls)$", repo.RetrieveLabels, repo.Issues) |
|
|
|
m.Get("/^:type(issues|pulls)$", repo.RetrieveLabels, repo.Issues) |
|
|
|
m.Get("/^:type(issues|pulls)$/:index", repo.ViewIssue) |
|
|
|
m.Get("/^:type(issues|pulls)$/:index", repo.ViewIssue) |
|
|
|
m.Get("/labels/", repo.RetrieveLabels, repo.Labels) |
|
|
|
m.Get("/labels/", repo.RetrieveLabels, repo.Labels) |
|
|
@ -581,7 +581,7 @@ func runWeb(ctx *cli.Context) error { |
|
|
|
m.Get("", repo.Branches) |
|
|
|
m.Get("", repo.Branches) |
|
|
|
m.Get("/all", repo.AllBranches) |
|
|
|
m.Get("/all", repo.AllBranches) |
|
|
|
m.Post("/delete/*", reqSignIn, reqRepoWriter, repo.DeleteBranchPost) |
|
|
|
m.Post("/delete/*", reqSignIn, reqRepoWriter, repo.DeleteBranchPost) |
|
|
|
}, func(ctx *context.Context) { |
|
|
|
}, repo.MustBeNotBare, func(ctx *context.Context) { |
|
|
|
ctx.Data["PageIsViewCode"] = true |
|
|
|
ctx.Data["PageIsViewCode"] = true |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -598,7 +598,7 @@ func runWeb(ctx *cli.Context) error { |
|
|
|
}, reqSignIn, reqRepoWriter) |
|
|
|
}, reqSignIn, reqRepoWriter) |
|
|
|
}, repo.MustEnableWiki, context.RepoRef()) |
|
|
|
}, repo.MustEnableWiki, context.RepoRef()) |
|
|
|
|
|
|
|
|
|
|
|
m.Get("/archive/*", repo.Download) |
|
|
|
m.Get("/archive/*", repo.MustBeNotBare, repo.Download) |
|
|
|
|
|
|
|
|
|
|
|
m.Group("/pulls/:index", func() { |
|
|
|
m.Group("/pulls/:index", func() { |
|
|
|
m.Get("/commits", context.RepoRef(), repo.ViewPullCommits) |
|
|
|
m.Get("/commits", context.RepoRef(), repo.ViewPullCommits) |
|
|
@ -612,18 +612,18 @@ func runWeb(ctx *cli.Context) error { |
|
|
|
m.Get("/commits/*", repo.RefCommits) |
|
|
|
m.Get("/commits/*", repo.RefCommits) |
|
|
|
m.Get("/commit/:sha([a-f0-9]{7,40})$", repo.Diff) |
|
|
|
m.Get("/commit/:sha([a-f0-9]{7,40})$", repo.Diff) |
|
|
|
m.Get("/forks", repo.Forks) |
|
|
|
m.Get("/forks", repo.Forks) |
|
|
|
}, context.RepoRef()) |
|
|
|
}, repo.MustBeNotBare, context.RepoRef()) |
|
|
|
m.Get("/commit/:sha([a-f0-9]{7,40})\\.:ext(patch|diff)", repo.RawDiff) |
|
|
|
m.Get("/commit/:sha([a-f0-9]{7,40})\\.:ext(patch|diff)", repo.MustBeNotBare, repo.RawDiff) |
|
|
|
|
|
|
|
|
|
|
|
m.Get("/compare/:before([a-z0-9]{40})\\.\\.\\.:after([a-z0-9]{40})", context.RepoRef(), repo.CompareDiff) |
|
|
|
m.Get("/compare/:before([a-z0-9]{40})\\.\\.\\.:after([a-z0-9]{40})", repo.MustBeNotBare, context.RepoRef(), repo.CompareDiff) |
|
|
|
}, ignSignIn, context.RepoAssignment(), repo.MustBeNotBare) |
|
|
|
}, ignSignIn, context.RepoAssignment()) |
|
|
|
m.Group("/:username/:reponame", func() { |
|
|
|
m.Group("/:username/:reponame", func() { |
|
|
|
m.Get("/stars", repo.Stars) |
|
|
|
m.Get("/stars", repo.Stars) |
|
|
|
m.Get("/watchers", repo.Watchers) |
|
|
|
m.Get("/watchers", repo.Watchers) |
|
|
|
}, ignSignIn, context.RepoAssignment(), context.RepoRef()) |
|
|
|
}, ignSignIn, context.RepoAssignment(), context.RepoRef()) |
|
|
|
|
|
|
|
|
|
|
|
m.Group("/:username", func() { |
|
|
|
m.Group("/:username", func() { |
|
|
|
m.Get("/:reponame", ignSignIn, context.RepoAssignment(true), context.RepoRef(), repo.Home) |
|
|
|
m.Get("/:reponame", ignSignIn, context.RepoAssignment(), context.RepoRef(), repo.Home) |
|
|
|
|
|
|
|
|
|
|
|
m.Group("/:reponame", func() { |
|
|
|
m.Group("/:reponame", func() { |
|
|
|
m.Head("/tasks/trigger", repo.TriggerTask) |
|
|
|
m.Head("/tasks/trigger", repo.TriggerTask) |
|
|
@ -632,7 +632,7 @@ func runWeb(ctx *cli.Context) error { |
|
|
|
// Duplicated routes to enable different ways of accessing same set of URLs,
|
|
|
|
// Duplicated routes to enable different ways of accessing same set of URLs,
|
|
|
|
// e.g. with or without ".git" suffix.
|
|
|
|
// e.g. with or without ".git" suffix.
|
|
|
|
m.Group("/:reponame([\\d\\w-_\\.]+\\.git$)", func() { |
|
|
|
m.Group("/:reponame([\\d\\w-_\\.]+\\.git$)", func() { |
|
|
|
m.Get("", ignSignIn, context.RepoAssignment(true), context.RepoRef(), repo.Home) |
|
|
|
m.Get("", ignSignIn, context.RepoAssignment(), context.RepoRef(), repo.Home) |
|
|
|
m.Route("/*", "GET,POST", ignSignInAndCsrf, repo.HTTPContexter(), repo.HTTP) |
|
|
|
m.Route("/*", "GET,POST", ignSignInAndCsrf, repo.HTTPContexter(), repo.HTTP) |
|
|
|
}) |
|
|
|
}) |
|
|
|
m.Route("/:reponame/*", "GET,POST", ignSignInAndCsrf, repo.HTTPContexter(), repo.HTTP) |
|
|
|
m.Route("/:reponame/*", "GET,POST", ignSignInAndCsrf, repo.HTTPContexter(), repo.HTTP) |
|
|
|