orthograph

main
Paul Schneider 7 months ago
parent 16258d1c33
commit e1a012e15b
7 changed files with 25 additions and 29 deletions

@ -2,8 +2,8 @@ namespace isn.abst
{
public static class Constants
{
public const string PaquetFileEstension = "nupkg";
public const string SpecFileEstension = "nuspec";
public const string PacketFileExtension = "nupkg";
public const string SpecFileExtension = "nuspec";
public const string ApiVersionPrefix = "/v3";
}
}

@ -12,16 +12,16 @@ namespace isnd.Controllers
{
// Web get the paquet
[HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Nuget + "/{id}/{lower}/{idf}-{lowerf}."
+ Constants.PaquetFileEstension)]
+ Constants.PacketFileExtension)]
[HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Content + "/{id}/{lower}/{idf}-{lowerf}."
+ Constants.PaquetFileEstension)]
+ Constants.PacketFileExtension)]
public IActionResult GetPackage(
[FromRoute][SafeName][Required] string id,
[FromRoute][SafeName][Required] string lower,
[FromRoute] string idf, [FromRoute] string lowerf)
{
var pkgpath = Path.Combine(isndSettings.PackagesRootDir,
id, lower, $"{id}-{lower}." + Constants.PaquetFileEstension
id, lower, $"{id}-{lower}." + Constants.PacketFileExtension
);
FileInfo pkgfi = new FileInfo(pkgpath);
@ -35,7 +35,7 @@ namespace isnd.Controllers
// Web get spec
[HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Nuspec + "/{id}/{lower}/{idf}-{lowerf}."
+ Constants.SpecFileEstension)]
+ Constants.SpecFileExtension)]
public IActionResult GetNuspec(
[FromRoute][SafeName][Required] string id,
[FromRoute][SafeName][Required] string lower,
@ -43,7 +43,7 @@ namespace isnd.Controllers
[FromRoute][SafeName][Required] string lowerf)
{
var pkgpath = Path.Combine(isndSettings.PackagesRootDir,
id, lower, $"{id}." + Constants.SpecFileEstension);
id, lower, $"{id}." + Constants.SpecFileExtension);
FileInfo pkgfi = new FileInfo(pkgpath);
if (!pkgfi.Exists)

@ -55,7 +55,7 @@ namespace isnd.Controllers
{
string initpath = Path.Combine(Environment.GetEnvironmentVariable("TEMP") ??
Environment.GetEnvironmentVariable("TMP") ?? "/tmp",
$"isn-{Guid.NewGuid()}."+Constants.PaquetFileEstension);
$"isn-{Guid.NewGuid()}."+Constants.PacketFileExtension);
using (FileStream fw = new FileStream(initpath, FileMode.Create))
{
@ -66,8 +66,8 @@ namespace isnd.Controllers
{
var archive = new ZipArchive(fw);
var spec = archive.Entries.FirstOrDefault(e => e.FullName.EndsWith("." + Constants.SpecFileEstension));
if (spec == null) return BadRequest(new { error = "no " + Constants.SpecFileEstension + " from archive" });
var spec = archive.Entries.FirstOrDefault(e => e.FullName.EndsWith("." + Constants.SpecFileExtension));
if (spec == null) return BadRequest(new { error = "no " + Constants.SpecFileExtension + " from archive" });
string pkgpath;
NuGetVersion version;
string pkgid;
@ -85,7 +85,7 @@ namespace isnd.Controllers
string pkgidpath = Path.Combine(isndSettings.PackagesRootDir,
pkgid);
pkgpath = Path.Combine(pkgidpath, version.ToFullString());
string name = $"{pkgid}-{version}."+Constants.PaquetFileEstension;
string name = $"{pkgid}-{version}."+Constants.PacketFileExtension;
fullpath = Path.Combine(pkgpath, name);
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);
if (nfpi.Exists)

@ -17,7 +17,7 @@ namespace isnd.Data.Catalog
this.registration = apiBase + ApiConfig.Registration + "/" + pkgId + "/" + fullVersionString + ".json";
Id = registration;
this.PackageContent = apiBase + ApiConfig.Nuget + "/" + pkgId + "/" + fullVersionString
+ "/" + pkgId + "-" + fullVersionString + "." + Constants.PaquetFileEstension;
+ "/" + pkgId + "-" + fullVersionString + "." + Constants.PacketFileExtension;
Entry = entry;
}

@ -60,9 +60,9 @@ namespace isnd.Data
public virtual Commit LatestCommit { get; set; }
public string NugetLink => $"{ApiConfig.Nuget}/{PackageId}/{FullString}/{PackageId}-{FullString}."
+ Constants.PaquetFileEstension;
+ Constants.PacketFileExtension;
public string NuspecLink => $"{ApiConfig.Nuspec}/{PackageId}/{FullString}/{PackageId}-{FullString}."
+ Constants.SpecFileEstension;
+ Constants.SpecFileExtension;
public string SementicVersionString { get => $"{Major}.{Minor}.{Patch}"; }
public NuGetVersion NugetVersion { get => new NuGetVersion(FullString); }

@ -15,13 +15,13 @@ namespace isnd.Services
public class EmailSender : IEmailSender, IMailer
{
public EmailSender(IOptions<SmtpSettings> smtpSettings,
IHostingEnvironment env)
IWebHostEnvironment env)
{
Options = smtpSettings.Value;
Env = env;
}
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)
{
return Execute(Options.SenderName, subject, message, email);
@ -32,7 +32,7 @@ namespace isnd.Services
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 {
var message = new MimeMessage();

@ -1,7 +1,4 @@
using System;
using System.Data;
using System.IO;
using System.Xml;
using System.Net.Http;
using System.Threading.Tasks;
@ -10,7 +7,6 @@ using isn.Abstract;
using System.Linq;
using Xunit;
using isn.abst;
using isnd.Entities;
namespace isn.tests
{
@ -22,12 +18,12 @@ namespace isn.tests
{
string pass = "a lame and big pass";
isn.IDataProtector _protector = new isn.DefaultDataProtector();
string protectedpass = _protector.Protect(pass);
string unprotectedpass = _protector.UnProtect(protectedpass);
Console.WriteLine(protectedpass);
Assert.Equal(pass, unprotectedpass);
Assert.True(protectedpass != null);
Assert.True(protectedpass.Length > 0);
string protectedPassword = _protector.Protect(pass);
string unprotectedPassword = _protector.UnProtect(protectedPassword);
Console.WriteLine(protectedPassword);
Assert.Equal(pass, unprotectedPassword);
Assert.True(protectedPassword != null);
Assert.True(protectedPassword.Length > 0);
}
[Fact]
@ -49,7 +45,7 @@ namespace isn.tests
{
Program.LoadConfig();
var report = Program.PushPkg(new string[] { "./src/isn.abst/bin/Debug/isn.abst.1.0.1.nupkg"
+ Constants.PaquetFileEstension });
+ Constants.PacketFileExtension });
}
[Fact]

Loading…