catalog impl
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@ -17,5 +17,6 @@ appsettings.Development.json
|
|||||||
/src/isn.abst/bin
|
/src/isn.abst/bin
|
||||||
/src/isn.abst/obj
|
/src/isn.abst/obj
|
||||||
/src/isnd/packages/
|
/src/isnd/packages/
|
||||||
test/data/test-isn/bin/
|
/test/data/test-isn/bin/
|
||||||
test/data/test-isn/obj
|
/test/data/test-isn/obj
|
||||||
|
.fake
|
||||||
|
8
contrib/testinstnuget/NuGet.Config
Normal file
8
contrib/testinstnuget/NuGet.Config
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<apikeys>
|
||||||
|
</apikeys>
|
||||||
|
<packageSources>
|
||||||
|
<add key="myIsnDev" value="http://localhost:5000/index.json" protocolVersion="3" />
|
||||||
|
</packageSources>
|
||||||
|
</configuration>
|
2
contrib/testinstnuget/call.lines
Normal file
2
contrib/testinstnuget/call.lines
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
nuget install -Verbosity detailed -Source http://localhost:5000/index.json -Prerelease Yavsc.Abstract
|
||||||
|
nuget locals all -clear
|
4
contrib/testinstnuget/urls.adoc
Normal file
4
contrib/testinstnuget/urls.adoc
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
= URL's
|
||||||
|
|
||||||
|
<http://localhost:5000/v3.4.0/registration/yavsc.abstract/index.json>
|
||||||
|
|
@ -1,11 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# compiler tout
|
# compiler tout
|
||||||
dotnet publish -c Release
|
dotnet build -c Release
|
||||||
|
dotnet publish -c Release -f netcoreapp2.1 src/isnd
|
||||||
# MAJ du serveur
|
# MAJ du serveur
|
||||||
sudo systemctl stop isnd
|
sudo systemctl stop isnd
|
||||||
sudo cp -a src/isnd/bin/Release/netcoreapp2.1/publish/* /srv/www/isnd
|
sudo cp -a src/isnd/bin/Release/netcoreapp2.1/publish/* /srv/www/isnd
|
||||||
sudo systemctl start isnd
|
sudo systemctl start isnd
|
||||||
# MAJ du client
|
# MAJ du client
|
||||||
sudo cp -a src/isn/bin/Release/net472/* /usr/local/lib/isn
|
sudo cp -a src/isn/bin/Release/netcoreapp2.1/* /usr/local/lib/isn
|
||||||
sudo chmod +x /usr/local/lib/isn/isn.exe
|
sudo chown -R root.root /usr/local/lib/isn
|
||||||
|
@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using isnd.Data;
|
using isnd.Data;
|
||||||
|
using isnd.Data.Catalog;
|
||||||
using isnd.Helpers;
|
using isnd.Helpers;
|
||||||
using isnd.ViewModels;
|
using isnd.ViewModels;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
@ -14,15 +15,17 @@ namespace isnd.Controllers
|
|||||||
public partial class PackagesController
|
public partial class PackagesController
|
||||||
{
|
{
|
||||||
// Web search
|
// Web search
|
||||||
public async Task<IActionResult> Index(PackageIndexViewModel model)
|
public async Task<IActionResult> Index(PackageRegistrationIndexViewModel model)
|
||||||
{
|
{
|
||||||
var applicationDbContext = dbContext.Packages.Include(p => p.Versions).Where(
|
var applicationDbContext = dbContext.Packages.Include(p => p.Versions)
|
||||||
p => ( model.Prerelease || p.Versions.Any(v => !v.IsPrerelease))
|
.Include(p => p.Owner)
|
||||||
|
.Where(
|
||||||
|
p => (model.Prerelease || p.Versions.Any(v => !v.IsPrerelease))
|
||||||
&& ((model.Query == null) || p.Id.StartsWith(model.Query)));
|
&& ((model.Query == null) || p.Id.StartsWith(model.Query)));
|
||||||
model.Data = await applicationDbContext.ToArrayAsync();
|
model.Data = await applicationDbContext.Select(p => p.ToLeave()).ToArrayAsync();
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> Details(string pkgid)
|
public async Task<IActionResult> Details(string pkgid)
|
||||||
{
|
{
|
||||||
if (pkgid == null)
|
if (pkgid == null)
|
||||||
|
11
src/isnd/Data/Catalog/AlternatePackage.cs
Normal file
11
src/isnd/Data/Catalog/AlternatePackage.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using NuGet.Versioning;
|
||||||
|
|
||||||
|
namespace isnd.Data.Catalog
|
||||||
|
{
|
||||||
|
public class AlternatePackage
|
||||||
|
{
|
||||||
|
public string id { get ; set; }
|
||||||
|
public VersionRange range { get ; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
82
src/isnd/Data/Catalog/CatalogEntry.cs
Normal file
82
src/isnd/Data/Catalog/CatalogEntry.cs
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace isnd.Data.Catalog
|
||||||
|
{
|
||||||
|
public class CatalogEntry
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The URL to the document used to produce this object
|
||||||
|
/// </summary>
|
||||||
|
/// <value></value>
|
||||||
|
[Key][Required]
|
||||||
|
[StringLength(1024)]
|
||||||
|
[JsonProperty("@id")]
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Authors
|
||||||
|
/// </summary>
|
||||||
|
/// <value>string or array of strings</value>
|
||||||
|
public string authors { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The dependencies of the package, grouped by target framework
|
||||||
|
/// </summary>
|
||||||
|
/// <value>array of objects</value>
|
||||||
|
public DependencyGroup[] dependencyGroups { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The deprecation associated with the package
|
||||||
|
/// </summary>
|
||||||
|
/// <value></value>
|
||||||
|
public Deprecation deprecation { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("description")]
|
||||||
|
public string Description { get; set; }
|
||||||
|
public string iconUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The ID of the package
|
||||||
|
/// </summary>
|
||||||
|
/// <value></value>
|
||||||
|
public string idp { get; set; }
|
||||||
|
public string licenseUrl { get; set; }
|
||||||
|
public string licenseExpression { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Should be considered as listed if absent
|
||||||
|
/// </summary>
|
||||||
|
/// <value></value>
|
||||||
|
public bool listed { get; set; }
|
||||||
|
public string minClientVersion { get; set; }
|
||||||
|
public string projectUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string containing a ISO 8601 timestamp of when the package was published
|
||||||
|
/// </summary>
|
||||||
|
/// <value></value>
|
||||||
|
public string published { get; set; }
|
||||||
|
public bool requireLicenseAcceptance { get; set; }
|
||||||
|
public string summary { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The tags
|
||||||
|
/// </summary>
|
||||||
|
/// <value></value>
|
||||||
|
public string tags { get; set; }
|
||||||
|
public string title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The full version string after normalization
|
||||||
|
/// </summary>
|
||||||
|
/// <value></value>
|
||||||
|
[Required]
|
||||||
|
public string version { get; set; } // string yes
|
||||||
|
/// <summary>
|
||||||
|
/// The security vulnerabilities of the package
|
||||||
|
/// </summary>
|
||||||
|
/// <value></value>
|
||||||
|
public Vulnerabilitie[] vulnerabilities { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
6
src/isnd/Data/Catalog/DependencyGroup.cs
Normal file
6
src/isnd/Data/Catalog/DependencyGroup.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace isnd.Data.Catalog
|
||||||
|
{
|
||||||
|
public class DependencyGroup
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
14
src/isnd/Data/Catalog/Deprecation.cs
Normal file
14
src/isnd/Data/Catalog/Deprecation.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
namespace isnd.Data.Catalog
|
||||||
|
{
|
||||||
|
public class Deprecation
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Legacy The package is no longer maintained
|
||||||
|
CriticalBugs The package has bugs which make it unsuitable for usage
|
||||||
|
Other The package is deprecated due to a reason not on this list
|
||||||
|
*/
|
||||||
|
public string[] reasons { get; set; } // array of strings yes The reasons why the package was deprecated
|
||||||
|
public string message { get; set; } // The additional details about this deprecation
|
||||||
|
public AlternatePackage alternatePackage { get; set; } // object no The alternate package that should be used instead
|
||||||
|
}
|
||||||
|
}
|
@ -1,16 +1,14 @@
|
|||||||
using isnd.Data;
|
|
||||||
using isnd.Data.Packages;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace isnd.ViewModels
|
namespace isnd.Data.Catalog
|
||||||
{
|
{
|
||||||
public class PackageIndexViewModel
|
public class PackageRegistrationIndexViewModel
|
||||||
{
|
{
|
||||||
[JsonProperty("prerelease")]
|
[JsonProperty("prerelease")]
|
||||||
public bool Prerelease { get; set; }
|
public bool Prerelease { get; set; }
|
||||||
|
|
||||||
[JsonProperty("data")]
|
[JsonProperty("data")]
|
||||||
public Package[] Data {get; set;}
|
public RegistrationLeaf[] Data {get; set;}
|
||||||
|
|
||||||
[JsonProperty("query")]
|
[JsonProperty("query")]
|
||||||
public string Query { get; set; }
|
public string Query { get; set; }
|
@ -2,7 +2,7 @@ using System;
|
|||||||
using isnd.Interfaces;
|
using isnd.Interfaces;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace isnd.Data.Packages.Catalog
|
namespace isnd.Data.Catalog
|
||||||
{
|
{
|
||||||
public class PageRef : IObject
|
public class PageRef : IObject
|
||||||
{
|
{
|
||||||
@ -19,7 +19,11 @@ namespace isnd.Data.Packages.Catalog
|
|||||||
/// <value></value>
|
/// <value></value>
|
||||||
[JsonProperty("count")]
|
[JsonProperty("count")]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("commitId")]
|
||||||
public string CommitId { get; set; }
|
public string CommitId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("commitTimeStamp")]
|
||||||
public DateTime CommitTimeStamp { get; set; }
|
public DateTime CommitTimeStamp { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
36
src/isnd/Data/Catalog/RegistratioinLeave.cs
Normal file
36
src/isnd/Data/Catalog/RegistratioinLeave.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace isnd.Data.Catalog
|
||||||
|
{
|
||||||
|
public class RegistrationLeaf
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
@id string yes
|
||||||
|
catalogEntry object yes
|
||||||
|
packageContent string yes
|
||||||
|
*/
|
||||||
|
[JsonProperty("@id")]
|
||||||
|
[Key][Required]
|
||||||
|
[StringLength(1024)]
|
||||||
|
/// <summary>
|
||||||
|
/// The URL to the registration leaf
|
||||||
|
/// </summary>
|
||||||
|
/// <value></value>
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The catalog entry containing the package metadata
|
||||||
|
/// </summary>
|
||||||
|
/// <value></value>
|
||||||
|
[JsonProperty("catalogEntry")]
|
||||||
|
public CatalogEntry Entry { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The URL to the package content (.nupkg)
|
||||||
|
/// </summary>
|
||||||
|
/// <value></value>
|
||||||
|
[JsonProperty("packageContent")]
|
||||||
|
public string PackageContent { get; set; }
|
||||||
|
}
|
||||||
|
}
|
34
src/isnd/Data/Catalog/RegistrationPages.cs
Normal file
34
src/isnd/Data/Catalog/RegistrationPages.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace isnd.Data.Catalog
|
||||||
|
{
|
||||||
|
public class RegistrationPage
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
@id string yes The URL to the registration page
|
||||||
|
count integer yes The number of registration leaves in the page
|
||||||
|
items array of objects no The array of registration leaves and their associate metadata
|
||||||
|
lower string yes The lowest SemVer 2.0.0 version in the page (inclusive)
|
||||||
|
parent string no The URL to the registration index
|
||||||
|
upper string yes The highest SemVer 2.0.0 version in the page (inclusive) */
|
||||||
|
[JsonProperty("@id")]
|
||||||
|
public string Id { get; set; }
|
||||||
|
[JsonProperty("count")]
|
||||||
|
public int Count { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("items")]
|
||||||
|
|
||||||
|
public RegistrationLeaf[] Items { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("upper")]
|
||||||
|
public Version Upper { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("lower")]
|
||||||
|
public Version Lower { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("parent")]
|
||||||
|
public string Parent { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
9
src/isnd/Data/Catalog/Vulnerabilitie.cs
Normal file
9
src/isnd/Data/Catalog/Vulnerabilitie.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace isnd.Data.Catalog
|
||||||
|
{
|
||||||
|
public class Vulnerabilitie
|
||||||
|
{
|
||||||
|
public string advisoryUrl { get; set; } // string yes Location of security advisory for the package
|
||||||
|
public string severity { get; set; } // string yes Severity of advisory: "0" = Low, "1" = Moderate, "2" = High, "3" = Critical
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using isnd.Interfaces;
|
using isnd.Interfaces;
|
||||||
|
using isnd.Data.Catalog;
|
||||||
|
|
||||||
namespace isnd.Data.Packages.Catalog
|
namespace isnd.Data.Packages.Catalog
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Linq;
|
||||||
|
using isnd.Data.Catalog;
|
||||||
using isnd.Interfaces;
|
using isnd.Interfaces;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
@ -44,5 +46,23 @@ namespace isnd.Data.Packages
|
|||||||
|
|
||||||
public virtual Commit LatestVersion{ get; set; }
|
public virtual Commit LatestVersion{ get; set; }
|
||||||
public DateTime CommitTimeStamp { get; set; }
|
public DateTime CommitTimeStamp { get; set; }
|
||||||
|
|
||||||
|
internal RegistrationLeaf ToLeave()
|
||||||
|
{
|
||||||
|
if (!(Versions != null &&
|
||||||
|
Versions.Count > 0)) throw new Exception("NO VERSION");
|
||||||
|
var v = Versions.First();
|
||||||
|
RegistrationLeaf leave = new RegistrationLeaf
|
||||||
|
{
|
||||||
|
PackageContent = v.NugetLink,
|
||||||
|
Entry = new CatalogEntry
|
||||||
|
{
|
||||||
|
idp = Id,
|
||||||
|
version = v.FullString,
|
||||||
|
authors = $"{Owner.FullName} <${Owner.Email}>"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return leave;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,6 +12,7 @@ namespace isnd.Data
|
|||||||
[Required]
|
[Required]
|
||||||
[ForeignKey("Package")]
|
[ForeignKey("Package")]
|
||||||
[StringLength(1024)]
|
[StringLength(1024)]
|
||||||
|
[JsonProperty("id")]
|
||||||
public string PackageId { get; set; }
|
public string PackageId { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
|
@ -3,6 +3,7 @@ using System.Threading.Tasks;
|
|||||||
using isn.Abstract;
|
using isn.Abstract;
|
||||||
using isnd.Controllers;
|
using isnd.Controllers;
|
||||||
using isnd.Data;
|
using isnd.Data;
|
||||||
|
using isnd.Data.Catalog;
|
||||||
using isnd.Data.Packages;
|
using isnd.Data.Packages;
|
||||||
using isnd.Data.Packages.Catalog;
|
using isnd.Data.Packages.Catalog;
|
||||||
using isnd.Services;
|
using isnd.Services;
|
||||||
@ -18,7 +19,7 @@ namespace isnd.Interfaces
|
|||||||
|
|
||||||
CatalogIndex GetCatalogIndex();
|
CatalogIndex GetCatalogIndex();
|
||||||
string[] GetVersions(string pkgid, NuGetVersion parsedVersion, bool prerelease = false, string packageType = null, int skip = 0, int take = 25);
|
string[] GetVersions(string pkgid, NuGetVersion parsedVersion, bool prerelease = false, string packageType = null, int skip = 0, int take = 25);
|
||||||
PackageIndexViewModel SearchByName(string query, int skip, int take, bool prerelease = false, string packageType = null);
|
PackageRegistrationIndexViewModel SearchByName(string query, int skip, int take, bool prerelease = false, string packageType = null);
|
||||||
IEnumerable<Resource> GetResources(IUnleash unleashĈlient);
|
IEnumerable<Resource> GetResources(IUnleash unleashĈlient);
|
||||||
void ÛpdateCatalogFor(Commit commit);
|
void ÛpdateCatalogFor(Commit commit);
|
||||||
Task<PackageDeletionReport> DeletePackageAsync(string pkgid, string version, string type);
|
Task<PackageDeletionReport> DeletePackageAsync(string pkgid, string version, string type);
|
||||||
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
|||||||
using isn.Abstract;
|
using isn.Abstract;
|
||||||
using isnd.Controllers;
|
using isnd.Controllers;
|
||||||
using isnd.Data;
|
using isnd.Data;
|
||||||
|
using isnd.Data.Catalog;
|
||||||
using isnd.Data.Packages;
|
using isnd.Data.Packages;
|
||||||
using isnd.Data.Packages.Catalog;
|
using isnd.Data.Packages.Catalog;
|
||||||
using isnd.Entities;
|
using isnd.Entities;
|
||||||
@ -121,13 +122,14 @@ namespace isnd.Services
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PackageIndexViewModel SearchByName(string query,
|
public PackageRegistrationIndexViewModel SearchByName(string query,
|
||||||
int skip, int take, bool prerelease = false,
|
int skip, int take, bool prerelease = false,
|
||||||
string packageType = null)
|
string packageType = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
var scope = dbContext.Packages
|
var scope = dbContext.Packages
|
||||||
.Include(p=>p.Versions)
|
.Include(p=>p.Versions)
|
||||||
|
.Include(p => p.Owner)
|
||||||
.Where(
|
.Where(
|
||||||
p => (PackageIdHelpers.CamelCaseMatch(p.Id, query) || PackageIdHelpers.SeparatedByMinusMatch(p.Id, query))
|
p => (PackageIdHelpers.CamelCaseMatch(p.Id, query) || PackageIdHelpers.SeparatedByMinusMatch(p.Id, query))
|
||||||
&& (prerelease || p.Versions.Any(v => !v.IsPrerelease))
|
&& (prerelease || p.Versions.Any(v => !v.IsPrerelease))
|
||||||
@ -136,18 +138,11 @@ namespace isnd.Services
|
|||||||
var total = scope.Count();
|
var total = scope.Count();
|
||||||
var pkgs = scope.Skip(skip).Take(take).ToArray();
|
var pkgs = scope.Skip(skip).Take(take).ToArray();
|
||||||
|
|
||||||
return new PackageIndexViewModel
|
return new PackageRegistrationIndexViewModel
|
||||||
{
|
{
|
||||||
Query = query,
|
Query = query,
|
||||||
TotalHits = total,
|
TotalHits = total,
|
||||||
Data = pkgs
|
Data = pkgs.Select(p => p.ToLeave()).ToArray()
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private object PackageVersionToRegentry(Package v)
|
|
||||||
{
|
|
||||||
return new {
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,18 +320,7 @@ namespace isnd.Services
|
|||||||
v.Type == type
|
v.Type == type
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<CatalogRegistration> GetPackageRegistrationAsync(string pkgid, string version, string type)
|
|
||||||
{
|
|
||||||
var pkgVersion = await GetPackageAsync(pkgid, version, type);
|
|
||||||
return new CatalogRegistration
|
|
||||||
{
|
|
||||||
Id = pkgVersion.PackageId,
|
|
||||||
CommitTimeStamp = pkgVersion.LatestCommit.CommitTimeStamp,
|
|
||||||
PackageContent = extUrl + pkgVersion.FullString
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<PackageVersion> GetCatalogLeaf(string id, string version, string lower)
|
public IEnumerable<PackageVersion> GetCatalogLeaf(string id, string version, string lower)
|
||||||
{
|
{
|
||||||
return dbContext.PackageVersions
|
return dbContext.PackageVersions
|
||||||
|
45
src/isnd/ViewModels/PackageRegistrationViewModel.cs
Normal file
45
src/isnd/ViewModels/PackageRegistrationViewModel.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
using isnd.Data.Packages;
|
||||||
|
|
||||||
|
namespace isnd.ViewModels
|
||||||
|
{
|
||||||
|
public class RegistrationLeaf
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
@id string yes The URL to the registration leaf
|
||||||
|
catalogEntry object yes The catalog entry containing the package metadata
|
||||||
|
packageContent string yes The URL to the package content (.nupkg)
|
||||||
|
*/
|
||||||
|
public static RegistrationLeaf FromPackage(Package p)
|
||||||
|
{
|
||||||
|
RegistrationLeaf v = new RegistrationLeaf
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class CatalogEntry
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
@id string yes The URL to the document used to produce this object
|
||||||
|
authors string or array of strings no
|
||||||
|
dependencyGroups array of objects no The dependencies of the package, grouped by target framework
|
||||||
|
deprecation object no The deprecation associated with the package
|
||||||
|
description string no
|
||||||
|
iconUrl string no
|
||||||
|
id string yes The ID of the package
|
||||||
|
licenseUrl string no
|
||||||
|
licenseExpression string no
|
||||||
|
listed boolean no Should be considered as listed if absent
|
||||||
|
minClientVersion string no
|
||||||
|
projectUrl string no
|
||||||
|
published string no A string containing a ISO 8601 timestamp of when the package was published
|
||||||
|
requireLicenseAcceptance boolean no
|
||||||
|
summary string no
|
||||||
|
tags string or array of string no
|
||||||
|
title string no
|
||||||
|
version string yes The full version string after normalization
|
||||||
|
vulnerabilities array of objects no The security vulnerabilities of the package
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
@ -43,7 +43,7 @@
|
|||||||
@foreach (var item in Model.Versions) {
|
@foreach (var item in Model.Versions) {
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.Package.Id)
|
@Html.DisplayFor(modelItem => item.PackageId)
|
||||||
<a href="@item.NugetLink">
|
<a href="@item.NugetLink">
|
||||||
nuget
|
nuget
|
||||||
</a>
|
</a>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
@model PackageIndexViewModel
|
@model PackageRegistrationIndexViewModel
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Index";
|
ViewData["Title"] = "Index";
|
||||||
@ -28,7 +28,7 @@
|
|||||||
@Html.DisplayNameFor(model => model.Data[0].Id)
|
@Html.DisplayNameFor(model => model.Data[0].Id)
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.Data[0].Description)
|
@Html.DisplayNameFor(model => model.Data[0].Entry.Description)
|
||||||
</th>
|
</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.Description)
|
@Html.DisplayFor(modelItem => item.Entry.Description)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.ActionLink("Details", "Details", new { pkgid = item.Id })
|
@Html.ActionLink("Details", "Details", new { pkgid = item.Id })
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<title>@ViewData["Title"] - isnd</title>
|
<title>@ViewData["Title"] - isnd</title>
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
||||||
<link rel="stylesheet" href="~/css/site.css" />
|
<link rel="stylesheet" href="~/css/site.css" />
|
||||||
|
<link rel="shortcut icon" href="favicon.ico#1" >
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
@using isnd.Data
|
@using isnd.Data
|
||||||
@using isnd.ViewModels
|
@using isnd.ViewModels
|
||||||
@using isnd.Helpers
|
@using isnd.Helpers
|
||||||
|
@using isnd.Data.Catalog;
|
||||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
@ -7848,3 +7848,6 @@ a.text-dark:hover, a.text-dark:focus {
|
|||||||
|
|
||||||
.fa-copy {
|
.fa-copy {
|
||||||
cursor: copy; }
|
cursor: copy; }
|
||||||
|
|
||||||
|
.border-top.footer.text-muted {
|
||||||
|
padding: 1em; }
|
||||||
|
@ -111,3 +111,8 @@ background-color: black;
|
|||||||
.fa-copy {
|
.fa-copy {
|
||||||
cursor: copy;
|
cursor: copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.border-top.footer.text-muted {
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user