aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/packages/api.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-10-13 12:19:39 +0200
committerGitHub <noreply@github.com>2022-10-13 18:19:39 +0800
commit0e58201d1a8247561809d832eb8f576e05e5d26d (patch)
treed179aa644701a97f5a0a4ae7bcf5e78d52768387 /routers/api/packages/api.go
parentc35531dd118ad8fe8ff0c7aa27bb925fb46f09af (diff)
downloadgitea-0e58201d1a8247561809d832eb8f576e05e5d26d.tar.gz
gitea-0e58201d1a8247561809d832eb8f576e05e5d26d.zip
Add support for Chocolatey/NuGet v2 API (#21393)
Fixes #21294 This PR adds support for NuGet v2 API. Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'routers/api/packages/api.go')
-rw-r--r--routers/api/packages/api.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/routers/api/packages/api.go b/routers/api/packages/api.go
index a54add0621..f6ab961f5e 100644
--- a/routers/api/packages/api.go
+++ b/routers/api/packages/api.go
@@ -180,15 +180,19 @@ func Routes(ctx gocontext.Context) *web.Route {
r.Get("/*", maven.DownloadPackageFile)
}, reqPackageAccess(perm.AccessModeRead))
r.Group("/nuget", func() {
- r.Get("/index.json", nuget.ServiceIndex) // Needs to be unauthenticated for the NuGet client.
+ r.Group("", func() { // Needs to be unauthenticated for the NuGet client.
+ r.Get("/", nuget.ServiceIndexV2)
+ r.Get("/index.json", nuget.ServiceIndexV3)
+ r.Get("/$metadata", nuget.FeedCapabilityResource)
+ })
r.Group("", func() {
- r.Get("/query", nuget.SearchService)
+ r.Get("/query", nuget.SearchServiceV3)
r.Group("/registration/{id}", func() {
r.Get("/index.json", nuget.RegistrationIndex)
- r.Get("/{version}", nuget.RegistrationLeaf)
+ r.Get("/{version}", nuget.RegistrationLeafV3)
})
r.Group("/package/{id}", func() {
- r.Get("/index.json", nuget.EnumeratePackageVersions)
+ r.Get("/index.json", nuget.EnumeratePackageVersionsV3)
r.Get("/{version}/{filename}", nuget.DownloadPackageFile)
})
r.Group("", func() {
@@ -197,6 +201,10 @@ func Routes(ctx gocontext.Context) *web.Route {
r.Delete("/{id}/{version}", nuget.DeletePackage)
}, reqPackageAccess(perm.AccessModeWrite))
r.Get("/symbols/{filename}/{guid:[0-9a-fA-F]{32}[fF]{8}}/{filename2}", nuget.DownloadSymbolFile)
+ r.Get("/Packages(Id='{id:[^']+}',Version='{version:[^']+}')", nuget.RegistrationLeafV2)
+ r.Get("/Packages()", nuget.SearchServiceV2)
+ r.Get("/FindPackagesById()", nuget.EnumeratePackageVersionsV2)
+ r.Get("/Search()", nuget.SearchServiceV2)
}, reqPackageAccess(perm.AccessModeRead))
})
r.Group("/npm", func() {