|
|
@ -796,7 +796,7 @@ func Routes() *web.Route { |
|
|
|
m.Combo("").Get(repo.GetHook). |
|
|
|
m.Combo("").Get(repo.GetHook). |
|
|
|
Patch(bind(api.EditHookOption{}), repo.EditHook). |
|
|
|
Patch(bind(api.EditHookOption{}), repo.EditHook). |
|
|
|
Delete(repo.DeleteHook) |
|
|
|
Delete(repo.DeleteHook) |
|
|
|
m.Post("/tests", context.RepoRefForAPI, repo.TestHook) |
|
|
|
m.Post("/tests", context.ReferencesGitRepo(), context.RepoRefForAPI, repo.TestHook) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, reqToken(), reqAdmin(), reqWebhooksEnabled()) |
|
|
|
}, reqToken(), reqAdmin(), reqWebhooksEnabled()) |
|
|
|
m.Group("/collaborators", func() { |
|
|
|
m.Group("/collaborators", func() { |
|
|
@ -813,16 +813,16 @@ func Routes() *web.Route { |
|
|
|
Put(reqAdmin(), repo.AddTeam). |
|
|
|
Put(reqAdmin(), repo.AddTeam). |
|
|
|
Delete(reqAdmin(), repo.DeleteTeam) |
|
|
|
Delete(reqAdmin(), repo.DeleteTeam) |
|
|
|
}, reqToken()) |
|
|
|
}, reqToken()) |
|
|
|
m.Get("/raw/*", context.RepoRefForAPI, reqRepoReader(unit.TypeCode), repo.GetRawFile) |
|
|
|
m.Get("/raw/*", context.ReferencesGitRepo(), context.RepoRefForAPI, reqRepoReader(unit.TypeCode), repo.GetRawFile) |
|
|
|
m.Get("/archive/*", reqRepoReader(unit.TypeCode), repo.GetArchive) |
|
|
|
m.Get("/archive/*", reqRepoReader(unit.TypeCode), repo.GetArchive) |
|
|
|
m.Combo("/forks").Get(repo.ListForks). |
|
|
|
m.Combo("/forks").Get(repo.ListForks). |
|
|
|
Post(reqToken(), reqRepoReader(unit.TypeCode), bind(api.CreateForkOption{}), repo.CreateFork) |
|
|
|
Post(reqToken(), reqRepoReader(unit.TypeCode), bind(api.CreateForkOption{}), repo.CreateFork) |
|
|
|
m.Group("/branches", func() { |
|
|
|
m.Group("/branches", func() { |
|
|
|
m.Get("", context.ReferencesGitRepo(false), repo.ListBranches) |
|
|
|
m.Get("", repo.ListBranches) |
|
|
|
m.Get("/*", context.ReferencesGitRepo(false), repo.GetBranch) |
|
|
|
m.Get("/*", repo.GetBranch) |
|
|
|
m.Delete("/*", reqRepoWriter(unit.TypeCode), context.ReferencesGitRepo(false), repo.DeleteBranch) |
|
|
|
m.Delete("/*", reqRepoWriter(unit.TypeCode), repo.DeleteBranch) |
|
|
|
m.Post("", reqRepoWriter(unit.TypeCode), context.ReferencesGitRepo(false), bind(api.CreateBranchRepoOption{}), repo.CreateBranch) |
|
|
|
m.Post("", reqRepoWriter(unit.TypeCode), bind(api.CreateBranchRepoOption{}), repo.CreateBranch) |
|
|
|
}, reqRepoReader(unit.TypeCode)) |
|
|
|
}, context.ReferencesGitRepo(), reqRepoReader(unit.TypeCode)) |
|
|
|
m.Group("/branch_protections", func() { |
|
|
|
m.Group("/branch_protections", func() { |
|
|
|
m.Get("", repo.ListBranchProtections) |
|
|
|
m.Get("", repo.ListBranchProtections) |
|
|
|
m.Post("", bind(api.CreateBranchProtectionOption{}), repo.CreateBranchProtection) |
|
|
|
m.Post("", bind(api.CreateBranchProtectionOption{}), repo.CreateBranchProtection) |
|
|
@ -941,10 +941,10 @@ func Routes() *web.Route { |
|
|
|
}) |
|
|
|
}) |
|
|
|
m.Group("/releases", func() { |
|
|
|
m.Group("/releases", func() { |
|
|
|
m.Combo("").Get(repo.ListReleases). |
|
|
|
m.Combo("").Get(repo.ListReleases). |
|
|
|
Post(reqToken(), reqRepoWriter(unit.TypeReleases), context.ReferencesGitRepo(false), bind(api.CreateReleaseOption{}), repo.CreateRelease) |
|
|
|
Post(reqToken(), reqRepoWriter(unit.TypeReleases), context.ReferencesGitRepo(), bind(api.CreateReleaseOption{}), repo.CreateRelease) |
|
|
|
m.Group("/{id}", func() { |
|
|
|
m.Group("/{id}", func() { |
|
|
|
m.Combo("").Get(repo.GetRelease). |
|
|
|
m.Combo("").Get(repo.GetRelease). |
|
|
|
Patch(reqToken(), reqRepoWriter(unit.TypeReleases), context.ReferencesGitRepo(false), bind(api.EditReleaseOption{}), repo.EditRelease). |
|
|
|
Patch(reqToken(), reqRepoWriter(unit.TypeReleases), context.ReferencesGitRepo(), bind(api.EditReleaseOption{}), repo.EditRelease). |
|
|
|
Delete(reqToken(), reqRepoWriter(unit.TypeReleases), repo.DeleteRelease) |
|
|
|
Delete(reqToken(), reqRepoWriter(unit.TypeReleases), repo.DeleteRelease) |
|
|
|
m.Group("/assets", func() { |
|
|
|
m.Group("/assets", func() { |
|
|
|
m.Combo("").Get(repo.ListReleaseAttachments). |
|
|
|
m.Combo("").Get(repo.ListReleaseAttachments). |
|
|
@ -961,7 +961,7 @@ func Routes() *web.Route { |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, reqRepoReader(unit.TypeReleases)) |
|
|
|
}, reqRepoReader(unit.TypeReleases)) |
|
|
|
m.Post("/mirror-sync", reqToken(), reqRepoWriter(unit.TypeCode), repo.MirrorSync) |
|
|
|
m.Post("/mirror-sync", reqToken(), reqRepoWriter(unit.TypeCode), repo.MirrorSync) |
|
|
|
m.Get("/editorconfig/{filename}", context.RepoRefForAPI, reqRepoReader(unit.TypeCode), repo.GetEditorconfig) |
|
|
|
m.Get("/editorconfig/{filename}", context.ReferencesGitRepo(), context.RepoRefForAPI, reqRepoReader(unit.TypeCode), repo.GetEditorconfig) |
|
|
|
m.Group("/pulls", func() { |
|
|
|
m.Group("/pulls", func() { |
|
|
|
m.Combo("").Get(repo.ListPullRequests). |
|
|
|
m.Combo("").Get(repo.ListPullRequests). |
|
|
|
Post(reqToken(), mustNotBeArchived, bind(api.CreatePullRequestOption{}), repo.CreatePullRequest) |
|
|
|
Post(reqToken(), mustNotBeArchived, bind(api.CreatePullRequestOption{}), repo.CreatePullRequest) |
|
|
@ -992,13 +992,13 @@ func Routes() *web.Route { |
|
|
|
Delete(reqToken(), bind(api.PullReviewRequestOptions{}), repo.DeleteReviewRequests). |
|
|
|
Delete(reqToken(), bind(api.PullReviewRequestOptions{}), repo.DeleteReviewRequests). |
|
|
|
Post(reqToken(), bind(api.PullReviewRequestOptions{}), repo.CreateReviewRequests) |
|
|
|
Post(reqToken(), bind(api.PullReviewRequestOptions{}), repo.CreateReviewRequests) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, mustAllowPulls, reqRepoReader(unit.TypeCode), context.ReferencesGitRepo(false)) |
|
|
|
}, mustAllowPulls, reqRepoReader(unit.TypeCode), context.ReferencesGitRepo()) |
|
|
|
m.Group("/statuses", func() { |
|
|
|
m.Group("/statuses", func() { |
|
|
|
m.Combo("/{sha}").Get(repo.GetCommitStatuses). |
|
|
|
m.Combo("/{sha}").Get(repo.GetCommitStatuses). |
|
|
|
Post(reqToken(), bind(api.CreateStatusOption{}), repo.NewCommitStatus) |
|
|
|
Post(reqToken(), bind(api.CreateStatusOption{}), repo.NewCommitStatus) |
|
|
|
}, reqRepoReader(unit.TypeCode)) |
|
|
|
}, reqRepoReader(unit.TypeCode)) |
|
|
|
m.Group("/commits", func() { |
|
|
|
m.Group("/commits", func() { |
|
|
|
m.Get("", context.ReferencesGitRepo(false), repo.GetAllCommits) |
|
|
|
m.Get("", context.ReferencesGitRepo(), repo.GetAllCommits) |
|
|
|
m.Group("/{ref}", func() { |
|
|
|
m.Group("/{ref}", func() { |
|
|
|
m.Get("/status", repo.GetCombinedCommitStatusByRef) |
|
|
|
m.Get("/status", repo.GetCombinedCommitStatusByRef) |
|
|
|
m.Get("/statuses", repo.GetCommitStatusesByRef) |
|
|
|
m.Get("/statuses", repo.GetCommitStatusesByRef) |
|
|
@ -1006,16 +1006,16 @@ func Routes() *web.Route { |
|
|
|
}, reqRepoReader(unit.TypeCode)) |
|
|
|
}, reqRepoReader(unit.TypeCode)) |
|
|
|
m.Group("/git", func() { |
|
|
|
m.Group("/git", func() { |
|
|
|
m.Group("/commits", func() { |
|
|
|
m.Group("/commits", func() { |
|
|
|
m.Get("/{sha}", context.ReferencesGitRepo(false), repo.GetSingleCommit) |
|
|
|
m.Get("/{sha}", repo.GetSingleCommit) |
|
|
|
m.Get("/{sha}.{diffType:diff|patch}", repo.DownloadCommitDiffOrPatch) |
|
|
|
m.Get("/{sha}.{diffType:diff|patch}", repo.DownloadCommitDiffOrPatch) |
|
|
|
}) |
|
|
|
}) |
|
|
|
m.Get("/refs", repo.GetGitAllRefs) |
|
|
|
m.Get("/refs", repo.GetGitAllRefs) |
|
|
|
m.Get("/refs/*", repo.GetGitRefs) |
|
|
|
m.Get("/refs/*", repo.GetGitRefs) |
|
|
|
m.Get("/trees/{sha}", context.RepoRefForAPI, repo.GetTree) |
|
|
|
m.Get("/trees/{sha}", repo.GetTree) |
|
|
|
m.Get("/blobs/{sha}", context.RepoRefForAPI, repo.GetBlob) |
|
|
|
m.Get("/blobs/{sha}", repo.GetBlob) |
|
|
|
m.Get("/tags/{sha}", context.RepoRefForAPI, repo.GetAnnotatedTag) |
|
|
|
m.Get("/tags/{sha}", repo.GetAnnotatedTag) |
|
|
|
m.Get("/notes/{sha}", repo.GetNote) |
|
|
|
m.Get("/notes/{sha}", repo.GetNote) |
|
|
|
}, reqRepoReader(unit.TypeCode)) |
|
|
|
}, context.ReferencesGitRepo(), reqRepoReader(unit.TypeCode)) |
|
|
|
m.Post("/diffpatch", reqRepoWriter(unit.TypeCode), reqToken(), bind(api.ApplyDiffPatchFileOptions{}), repo.ApplyDiffPatch) |
|
|
|
m.Post("/diffpatch", reqRepoWriter(unit.TypeCode), reqToken(), bind(api.ApplyDiffPatchFileOptions{}), repo.ApplyDiffPatch) |
|
|
|
m.Group("/contents", func() { |
|
|
|
m.Group("/contents", func() { |
|
|
|
m.Get("", repo.GetContentsList) |
|
|
|
m.Get("", repo.GetContentsList) |
|
|
@ -1035,7 +1035,7 @@ func Routes() *web.Route { |
|
|
|
Delete(reqToken(), repo.DeleteTopic) |
|
|
|
Delete(reqToken(), repo.DeleteTopic) |
|
|
|
}, reqAdmin()) |
|
|
|
}, reqAdmin()) |
|
|
|
}, reqAnyRepoReader()) |
|
|
|
}, reqAnyRepoReader()) |
|
|
|
m.Get("/issue_templates", context.ReferencesGitRepo(false), repo.GetIssueTemplates) |
|
|
|
m.Get("/issue_templates", context.ReferencesGitRepo(), repo.GetIssueTemplates) |
|
|
|
m.Get("/languages", reqRepoReader(unit.TypeCode), repo.GetLanguages) |
|
|
|
m.Get("/languages", reqRepoReader(unit.TypeCode), repo.GetLanguages) |
|
|
|
}, repoAssignment()) |
|
|
|
}, repoAssignment()) |
|
|
|
}) |
|
|
|
}) |
|
|
|