Test and get the nuget via the NuGet v3 protocol
This commit is contained in:
parent
ac0a195b5f
commit
4e4d7f0fd7
3 changed files with 84 additions and 6 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Isn.Abstract;
|
||||
using isnd.Entities;
|
||||
|
|
@ -10,13 +11,28 @@ namespace isnd.Controllers
|
|||
|
||||
public partial class PackagesController
|
||||
{
|
||||
// Web get the paquet
|
||||
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.GetPackage + "/{id}/{lower}/{idf}-{lowerf}."
|
||||
// NuGet v3 flat-container versions index.
|
||||
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.GetPackage + "/{id}/" + ApiConfig.IndexDotJson)]
|
||||
public IActionResult GetPackageVersionsById(
|
||||
[FromRoute][SafeName][Required] string id)
|
||||
{
|
||||
var versions = dbContext.PackageVersions
|
||||
.Where(v => v.PackageId.ToLower() == id.ToLower())
|
||||
.Select(v => v.FullString)
|
||||
.Distinct()
|
||||
.OrderBy(v => v)
|
||||
.ToArray();
|
||||
|
||||
return Ok(new { versions });
|
||||
}
|
||||
|
||||
// NuGet v3 flat-container package download by filename, e.g. id.version.nupkg.
|
||||
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.GetPackage + "/{id}/{lower}/{filename}."
|
||||
+ Constants.PaquetFileEstension)]
|
||||
public IActionResult GetPackage(
|
||||
[FromRoute][SafeName][Required] string id,
|
||||
public IActionResult GetPackageByFilename(
|
||||
[FromRoute][SafeName][Required] string id,
|
||||
[FromRoute][SafeName][Required] string lower,
|
||||
[FromRoute] string idf, [FromRoute] string lowerf)
|
||||
[FromRoute][SafeName][Required] string filename)
|
||||
{
|
||||
var pkgpath = Path.Combine(isndSettings.PackagesRootDir,
|
||||
id, lower, $"{id}-{lower}." + Constants.PaquetFileEstension
|
||||
|
|
@ -32,6 +48,8 @@ namespace isnd.Controllers
|
|||
}
|
||||
|
||||
// Web get spec
|
||||
[HttpGet("~/" + Constants.APIPrefix + Constants.SpecFileEstension + "/{id}/{lower}/{idf}.{lowerf}."
|
||||
+ Constants.SpecFileEstension)]
|
||||
[HttpGet("~/" + Constants.APIPrefix + Constants.SpecFileEstension + "/{id}/{lower}/{idf}-{lowerf}."
|
||||
+ Constants.SpecFileEstension)]
|
||||
public IActionResult GetNuspec(
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ namespace isnd.Services
|
|||
},
|
||||
// under dev, only leash in release mode
|
||||
|
||||
new Resource(extUrl + ApiConfig.GetPackage, "PackageBaseAddress/3.0.0")
|
||||
// NuGet clients expect a trailing slash on PackageBaseAddress to resolve relative paths.
|
||||
new Resource(extUrl + ApiConfig.GetPackage + "/", "PackageBaseAddress/3.0.0")
|
||||
{
|
||||
Comment = @"Package Base Address service - Base URL of where NuGet packages are stored, in the format https://<host>/nupkg/{id-lower}/{version-lower}/{id-lower}.{version-lower}.nupkg"
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue