Require token for GET subscription endpoint (#28765) (#28768)

Backport #28765 by @jackHay22

Fixes  #28756

## Changes
- Require and check API token for `GET
/repos/{owner}/{repo}/subscription` in order to populate `ctx.Doer`.

Co-authored-by: Jack Hay <jack@allspice.io>
(cherry picked from commit cb33623bb6b0cf60417c4a1d84b8f42ef1714ea3)
This commit is contained in:
Giteabot 2024-01-12 14:51:27 +08:00 committed by Earl Warren
parent 765aa1479d
commit 6a66e8c748
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -1140,9 +1140,9 @@ func Routes() *web.Route {
m.Get("/subscribers", repo.ListSubscribers) m.Get("/subscribers", repo.ListSubscribers)
m.Group("/subscription", func() { m.Group("/subscription", func() {
m.Get("", user.IsWatching) m.Get("", user.IsWatching)
m.Put("", reqToken(), user.Watch) m.Put("", user.Watch)
m.Delete("", reqToken(), user.Unwatch) m.Delete("", user.Unwatch)
}) }, reqToken())
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(), bind(api.CreateReleaseOption{}), repo.CreateRelease) Post(reqToken(), reqRepoWriter(unit.TypeReleases), context.ReferencesGitRepo(), bind(api.CreateReleaseOption{}), repo.CreateRelease)