orthograph
This commit is contained in:
@ -2,8 +2,8 @@ namespace isn.abst
|
|||||||
{
|
{
|
||||||
public static class Constants
|
public static class Constants
|
||||||
{
|
{
|
||||||
public const string PaquetFileEstension = "nupkg";
|
public const string PacketFileExtension = "nupkg";
|
||||||
public const string SpecFileEstension = "nuspec";
|
public const string SpecFileExtension = "nuspec";
|
||||||
public const string ApiVersionPrefix = "/v3";
|
public const string ApiVersionPrefix = "/v3";
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,16 +12,16 @@ namespace isnd.Controllers
|
|||||||
{
|
{
|
||||||
// Web get the paquet
|
// Web get the paquet
|
||||||
[HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Nuget + "/{id}/{lower}/{idf}-{lowerf}."
|
[HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Nuget + "/{id}/{lower}/{idf}-{lowerf}."
|
||||||
+ Constants.PaquetFileEstension)]
|
+ Constants.PacketFileExtension)]
|
||||||
[HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Content + "/{id}/{lower}/{idf}-{lowerf}."
|
[HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Content + "/{id}/{lower}/{idf}-{lowerf}."
|
||||||
+ Constants.PaquetFileEstension)]
|
+ Constants.PacketFileExtension)]
|
||||||
public IActionResult GetPackage(
|
public IActionResult GetPackage(
|
||||||
[FromRoute][SafeName][Required] string id,
|
[FromRoute][SafeName][Required] string id,
|
||||||
[FromRoute][SafeName][Required] string lower,
|
[FromRoute][SafeName][Required] string lower,
|
||||||
[FromRoute] string idf, [FromRoute] string lowerf)
|
[FromRoute] string idf, [FromRoute] string lowerf)
|
||||||
{
|
{
|
||||||
var pkgpath = Path.Combine(isndSettings.PackagesRootDir,
|
var pkgpath = Path.Combine(isndSettings.PackagesRootDir,
|
||||||
id, lower, $"{id}-{lower}." + Constants.PaquetFileEstension
|
id, lower, $"{id}-{lower}." + Constants.PacketFileExtension
|
||||||
);
|
);
|
||||||
|
|
||||||
FileInfo pkgfi = new FileInfo(pkgpath);
|
FileInfo pkgfi = new FileInfo(pkgpath);
|
||||||
@ -35,7 +35,7 @@ namespace isnd.Controllers
|
|||||||
|
|
||||||
// Web get spec
|
// Web get spec
|
||||||
[HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Nuspec + "/{id}/{lower}/{idf}-{lowerf}."
|
[HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Nuspec + "/{id}/{lower}/{idf}-{lowerf}."
|
||||||
+ Constants.SpecFileEstension)]
|
+ Constants.SpecFileExtension)]
|
||||||
public IActionResult GetNuspec(
|
public IActionResult GetNuspec(
|
||||||
[FromRoute][SafeName][Required] string id,
|
[FromRoute][SafeName][Required] string id,
|
||||||
[FromRoute][SafeName][Required] string lower,
|
[FromRoute][SafeName][Required] string lower,
|
||||||
@ -43,7 +43,7 @@ namespace isnd.Controllers
|
|||||||
[FromRoute][SafeName][Required] string lowerf)
|
[FromRoute][SafeName][Required] string lowerf)
|
||||||
{
|
{
|
||||||
var pkgpath = Path.Combine(isndSettings.PackagesRootDir,
|
var pkgpath = Path.Combine(isndSettings.PackagesRootDir,
|
||||||
id, lower, $"{id}." + Constants.SpecFileEstension);
|
id, lower, $"{id}." + Constants.SpecFileExtension);
|
||||||
|
|
||||||
FileInfo pkgfi = new FileInfo(pkgpath);
|
FileInfo pkgfi = new FileInfo(pkgpath);
|
||||||
if (!pkgfi.Exists)
|
if (!pkgfi.Exists)
|
||||||
|
@ -55,7 +55,7 @@ namespace isnd.Controllers
|
|||||||
{
|
{
|
||||||
string initpath = Path.Combine(Environment.GetEnvironmentVariable("TEMP") ??
|
string initpath = Path.Combine(Environment.GetEnvironmentVariable("TEMP") ??
|
||||||
Environment.GetEnvironmentVariable("TMP") ?? "/tmp",
|
Environment.GetEnvironmentVariable("TMP") ?? "/tmp",
|
||||||
$"isn-{Guid.NewGuid()}."+Constants.PaquetFileEstension);
|
$"isn-{Guid.NewGuid()}."+Constants.PacketFileExtension);
|
||||||
|
|
||||||
using (FileStream fw = new FileStream(initpath, FileMode.Create))
|
using (FileStream fw = new FileStream(initpath, FileMode.Create))
|
||||||
{
|
{
|
||||||
@ -66,8 +66,8 @@ namespace isnd.Controllers
|
|||||||
{
|
{
|
||||||
var archive = new ZipArchive(fw);
|
var archive = new ZipArchive(fw);
|
||||||
|
|
||||||
var spec = archive.Entries.FirstOrDefault(e => e.FullName.EndsWith("." + Constants.SpecFileEstension));
|
var spec = archive.Entries.FirstOrDefault(e => e.FullName.EndsWith("." + Constants.SpecFileExtension));
|
||||||
if (spec == null) return BadRequest(new { error = "no " + Constants.SpecFileEstension + " from archive" });
|
if (spec == null) return BadRequest(new { error = "no " + Constants.SpecFileExtension + " from archive" });
|
||||||
string pkgpath;
|
string pkgpath;
|
||||||
NuGetVersion version;
|
NuGetVersion version;
|
||||||
string pkgid;
|
string pkgid;
|
||||||
@ -85,7 +85,7 @@ namespace isnd.Controllers
|
|||||||
string pkgidpath = Path.Combine(isndSettings.PackagesRootDir,
|
string pkgidpath = Path.Combine(isndSettings.PackagesRootDir,
|
||||||
pkgid);
|
pkgid);
|
||||||
pkgpath = Path.Combine(pkgidpath, version.ToFullString());
|
pkgpath = Path.Combine(pkgidpath, version.ToFullString());
|
||||||
string name = $"{pkgid}-{version}."+Constants.PaquetFileEstension;
|
string name = $"{pkgid}-{version}."+Constants.PacketFileExtension;
|
||||||
fullpath = Path.Combine(pkgpath, name);
|
fullpath = Path.Combine(pkgpath, name);
|
||||||
|
|
||||||
var destpkgiddir = new DirectoryInfo(pkgidpath);
|
var destpkgiddir = new DirectoryInfo(pkgidpath);
|
||||||
@ -201,7 +201,7 @@ namespace isnd.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string nuspecfullpath = Path.Combine(pkgpath, pkgid + "." + Constants.SpecFileEstension);
|
string nuspecfullpath = Path.Combine(pkgpath, pkgid + "." + Constants.SpecFileExtension);
|
||||||
FileInfo nfpi = new(nuspecfullpath);
|
FileInfo nfpi = new(nuspecfullpath);
|
||||||
|
|
||||||
if (nfpi.Exists)
|
if (nfpi.Exists)
|
||||||
|
@ -17,7 +17,7 @@ namespace isnd.Data.Catalog
|
|||||||
this.registration = apiBase + ApiConfig.Registration + "/" + pkgId + "/" + fullVersionString + ".json";
|
this.registration = apiBase + ApiConfig.Registration + "/" + pkgId + "/" + fullVersionString + ".json";
|
||||||
Id = registration;
|
Id = registration;
|
||||||
this.PackageContent = apiBase + ApiConfig.Nuget + "/" + pkgId + "/" + fullVersionString
|
this.PackageContent = apiBase + ApiConfig.Nuget + "/" + pkgId + "/" + fullVersionString
|
||||||
+ "/" + pkgId + "-" + fullVersionString + "." + Constants.PaquetFileEstension;
|
+ "/" + pkgId + "-" + fullVersionString + "." + Constants.PacketFileExtension;
|
||||||
Entry = entry;
|
Entry = entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,9 +60,9 @@ namespace isnd.Data
|
|||||||
|
|
||||||
public virtual Commit LatestCommit { get; set; }
|
public virtual Commit LatestCommit { get; set; }
|
||||||
public string NugetLink => $"{ApiConfig.Nuget}/{PackageId}/{FullString}/{PackageId}-{FullString}."
|
public string NugetLink => $"{ApiConfig.Nuget}/{PackageId}/{FullString}/{PackageId}-{FullString}."
|
||||||
+ Constants.PaquetFileEstension;
|
+ Constants.PacketFileExtension;
|
||||||
public string NuspecLink => $"{ApiConfig.Nuspec}/{PackageId}/{FullString}/{PackageId}-{FullString}."
|
public string NuspecLink => $"{ApiConfig.Nuspec}/{PackageId}/{FullString}/{PackageId}-{FullString}."
|
||||||
+ Constants.SpecFileEstension;
|
+ Constants.SpecFileExtension;
|
||||||
|
|
||||||
public string SementicVersionString { get => $"{Major}.{Minor}.{Patch}"; }
|
public string SementicVersionString { get => $"{Major}.{Minor}.{Patch}"; }
|
||||||
public NuGetVersion NugetVersion { get => new NuGetVersion(FullString); }
|
public NuGetVersion NugetVersion { get => new NuGetVersion(FullString); }
|
||||||
|
@ -15,13 +15,13 @@ namespace isnd.Services
|
|||||||
public class EmailSender : IEmailSender, IMailer
|
public class EmailSender : IEmailSender, IMailer
|
||||||
{
|
{
|
||||||
public EmailSender(IOptions<SmtpSettings> smtpSettings,
|
public EmailSender(IOptions<SmtpSettings> smtpSettings,
|
||||||
IHostingEnvironment env)
|
IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
Options = smtpSettings.Value;
|
Options = smtpSettings.Value;
|
||||||
Env = env;
|
Env = env;
|
||||||
}
|
}
|
||||||
public SmtpSettings Options { get; } //set only via Secret Manager
|
public SmtpSettings Options { get; } //set only via Secret Manager
|
||||||
public IHostingEnvironment Env { get; }
|
public IWebHostEnvironment Env { get; }
|
||||||
public Task SendEmailAsync(string email, string subject, string message)
|
public Task SendEmailAsync(string email, string subject, string message)
|
||||||
{
|
{
|
||||||
return Execute(Options.SenderName, subject, message, email);
|
return Execute(Options.SenderName, subject, message, email);
|
||||||
@ -32,7 +32,7 @@ namespace isnd.Services
|
|||||||
await SendMailAsync(name, email, subject, message);
|
await SendMailAsync(name, email, subject, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SendMailAsync(string name, string email, string subjet, string body)
|
public async Task SendMailAsync(string name, string email, string subject, string body)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
var message = new MimeMessage();
|
var message = new MimeMessage();
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Data;
|
|
||||||
using System.IO;
|
|
||||||
using System.Xml;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -10,7 +7,6 @@ using isn.Abstract;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using isn.abst;
|
using isn.abst;
|
||||||
using isnd.Entities;
|
|
||||||
|
|
||||||
namespace isn.tests
|
namespace isn.tests
|
||||||
{
|
{
|
||||||
@ -22,12 +18,12 @@ namespace isn.tests
|
|||||||
{
|
{
|
||||||
string pass = "a lame and big pass";
|
string pass = "a lame and big pass";
|
||||||
isn.IDataProtector _protector = new isn.DefaultDataProtector();
|
isn.IDataProtector _protector = new isn.DefaultDataProtector();
|
||||||
string protectedpass = _protector.Protect(pass);
|
string protectedPassword = _protector.Protect(pass);
|
||||||
string unprotectedpass = _protector.UnProtect(protectedpass);
|
string unprotectedPassword = _protector.UnProtect(protectedPassword);
|
||||||
Console.WriteLine(protectedpass);
|
Console.WriteLine(protectedPassword);
|
||||||
Assert.Equal(pass, unprotectedpass);
|
Assert.Equal(pass, unprotectedPassword);
|
||||||
Assert.True(protectedpass != null);
|
Assert.True(protectedPassword != null);
|
||||||
Assert.True(protectedpass.Length > 0);
|
Assert.True(protectedPassword.Length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@ -49,7 +45,7 @@ namespace isn.tests
|
|||||||
{
|
{
|
||||||
Program.LoadConfig();
|
Program.LoadConfig();
|
||||||
var report = Program.PushPkg(new string[] { "./src/isn.abst/bin/Debug/isn.abst.1.0.1.nupkg"
|
var report = Program.PushPkg(new string[] { "./src/isn.abst/bin/Debug/isn.abst.1.0.1.nupkg"
|
||||||
+ Constants.PaquetFileEstension });
|
+ Constants.PacketFileExtension });
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
Reference in New Issue
Block a user