Add github compatible tarball download API endpoints (#32572)

Fix #29654 
Fix #32481
This commit is contained in:
Lunny Xiao 2024-11-25 11:35:49 -08:00 committed by GitHub
parent 44909f6e2c
commit 703be6bf30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 152 additions and 31 deletions

View file

@ -1377,6 +1377,8 @@ func Routes() *web.Router {
m.Post("", bind(api.UpdateRepoAvatarOption{}), repo.UpdateAvatar)
m.Delete("", repo.DeleteAvatar)
}, reqAdmin(), reqToken())
m.Get("/{ball_type:tarball|zipball|bundle}/*", reqRepoReader(unit.TypeCode), repo.DownloadArchive)
}, repoAssignment(), checkTokenPublicOnly())
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryRepository))