Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
* upstream/main:
  Add cynkra bronze sponsor (go-gitea#21325)
  Run `make fmt` (go-gitea#21437)
  Remove useless `appVer` from JS `window.config` (go-gitea#21445)
  Add support for Chocolatey/NuGet v2 API (go-gitea#21393)
  Fix go-gitea#21406: Hide repo information from file view/blame mode (go-gitea#21420)
  • Loading branch information
zjjhot committed Oct 14, 2022
2 parents 9b3674e + 4de48d5 commit 1bdcdad
Show file tree
Hide file tree
Showing 17 changed files with 941 additions and 145 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
<a href="https://opencollective.com/gitea/sponsor/7/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/gitea/sponsor/8/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/gitea/sponsor/9/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/9/avatar.svg"></a>
<a href="https://cynkra.com/" target="_blank"><img src="https://images.opencollective.com/cynkra/logo/square/64/192.png"></a>

## FAQ

Expand Down
2 changes: 1 addition & 1 deletion docs/content/doc/packages/nuget.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ menu:

# NuGet Packages Repository

Publish [NuGet](https://www.nuget.org/) packages for your user or organization. The package registry supports [NuGet Symbol Packages](https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg) too.
Publish [NuGet](https://www.nuget.org/) packages for your user or organization. The package registry supports the V2 and V3 API protocol and you can work with [NuGet Symbol Packages](https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg) too.

**Table of Contents**

Expand Down
26 changes: 14 additions & 12 deletions modules/packages/nuget/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ type Package struct {

// Metadata represents the metadata of a Nuget package
type Metadata struct {
Description string `json:"description,omitempty"`
ReleaseNotes string `json:"release_notes,omitempty"`
Authors string `json:"authors,omitempty"`
ProjectURL string `json:"project_url,omitempty"`
RepositoryURL string `json:"repository_url,omitempty"`
Dependencies map[string][]Dependency `json:"dependencies,omitempty"`
Description string `json:"description,omitempty"`
ReleaseNotes string `json:"release_notes,omitempty"`
Authors string `json:"authors,omitempty"`
ProjectURL string `json:"project_url,omitempty"`
RepositoryURL string `json:"repository_url,omitempty"`
RequireLicenseAcceptance bool `json:"require_license_acceptance"`
Dependencies map[string][]Dependency `json:"dependencies,omitempty"`
}

// Dependency represents a dependency of a Nuget package
Expand Down Expand Up @@ -155,12 +156,13 @@ func ParseNuspecMetaData(r io.Reader) (*Package, error) {
}

m := &Metadata{
Description: p.Metadata.Description,
ReleaseNotes: p.Metadata.ReleaseNotes,
Authors: p.Metadata.Authors,
ProjectURL: p.Metadata.ProjectURL,
RepositoryURL: p.Metadata.Repository.URL,
Dependencies: make(map[string][]Dependency),
Description: p.Metadata.Description,
ReleaseNotes: p.Metadata.ReleaseNotes,
Authors: p.Metadata.Authors,
ProjectURL: p.Metadata.ProjectURL,
RepositoryURL: p.Metadata.Repository.URL,
RequireLicenseAcceptance: p.Metadata.RequireLicenseAcceptance,
Dependencies: make(map[string][]Dependency),
}

for _, group := range p.Metadata.Dependencies.Group {
Expand Down
16 changes: 12 additions & 4 deletions routers/api/packages/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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() {
Expand Down
Loading

0 comments on commit 1bdcdad

Please sign in to comment.