Compare commits

...

10 Commits

Author SHA1 Message Date
Paul Schneider 6936d98840 refacts 2 weeks ago
Paul Schneider 5334646c1b code quality ? 2 months ago
Paul Schneider 1084bb3f3c Delete blogspot articles 3 months ago
Paul Schneider f732fc3fe2 MEF++ 3 months ago
Paul Schneider 1d06bdae0e using AscDocCsharp, and fixing the tag helper 3 months ago
Paul Schneider accfecb93e Format 3 months ago
Paul Schneider 963d49359d color theme update 3 months ago
Paul Schneider c5fbcc2ebb obsolete 3 months ago
Paul Schneider 8a6e7c33ec cleanup 3 months ago
Paul Schneider 94e9ffabac MEF++ 3 months ago
27 changed files with 327 additions and 414 deletions

@ -4,7 +4,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageVersion Include="IdentityModel.OidcClient" Version="6.0.0" /> <PackageVersion Include="IdentityModel.OidcClient" Version="6.0.0" />
<PackageVersion Include="AsciiDocNet" Version="1.0.0" /> <PackageVersion Include="AsciiDocSharp" Version="0.2.0" />
<PackageVersion Include="AsciiDocSharp.Converters.Html" Version="0.2.0" />
<PackageVersion Include="bootstrap" Version="5.3.7" /> <PackageVersion Include="bootstrap" Version="5.3.7" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" /> <PackageVersion Include="coverlet.collector" Version="6.0.4" />
<PackageVersion Include="Google.Apis.Calendar.v3" Version="1.69.0.3746" /> <PackageVersion Include="Google.Apis.Calendar.v3" Version="1.69.0.3746" />

@ -4,7 +4,7 @@ FRAMEWORK=net8.0
DESTDIR=/tmp/yavsc DESTDIR=/tmp/yavsc
all: all:
@dotnet build --nologo 2>/dev/null |grep error dotnet build --nologo
clean: clean:
dotnet clean dotnet clean
@ -15,7 +15,7 @@ src/Yavsc/bin/output/wwwroot:
test: test:
dotnet test dotnet test
web: watch:
dotnet watch -p:Configuration=$(CONFIG) --project src/Yavsc/Yavsc.csproj dotnet watch -p:Configuration=$(CONFIG) --project src/Yavsc/Yavsc.csproj
src/Yavsc.Abstract/bin/$(CONFIG)/$(FRAMEWORK)/Yavsc.Abstract.dll: src/Yavsc.Abstract/bin/$(CONFIG)/$(FRAMEWORK)/Yavsc.Abstract.dll:

@ -57,7 +57,7 @@ namespace Yavsc.ApiControllers
List<FileReceivedInfo> received = new List<FileReceivedInfo>(); List<FileReceivedInfo> received = new List<FileReceivedInfo>();
InvalidPathException pathex = null; InvalidPathException pathex = null;
try { try {
destDir = User.InitPostToFileSystem(subdir); destDir = User.EnsureDestinationDirectory(subdir);
} catch (InvalidPathException ex) { } catch (InvalidPathException ex) {
pathex = ex; pathex = ex;
} }

@ -35,8 +35,6 @@ namespace Yavsc.ApiControllers
logger.LogInformation("Put : " + filename); logger.LogInformation("Put : " + filename);
if (!HttpContext.WebSockets.IsWebSocketRequest) if (!HttpContext.WebSockets.IsWebSocketRequest)
return BadRequest("not a web socket"); return BadRequest("not a web socket");
if (!HttpContext.User.Identity.IsAuthenticated)
return new UnauthorizedResult();
var subdirs = filename.Split('/'); var subdirs = filename.Split('/');
var filePath = subdirs.Length > 1 ? string.Join("/", subdirs.Take(subdirs.Length-1)) : null; var filePath = subdirs.Length > 1 ? string.Join("/", subdirs.Take(subdirs.Length-1)) : null;
var shortFileName = subdirs[subdirs.Length-1]; var shortFileName = subdirs[subdirs.Length-1];
@ -55,17 +53,18 @@ namespace Yavsc.ApiControllers
filename filename
); );
hubContext.Clients.All.SendAsync("addPublicStream", new PublicStreamInfo
{
sender = userName,
url = url,
}, $"{userName} is starting a stream!");
string destDir = HttpContext.User.InitPostToFileSystem(filePath); string destDir = HttpContext.User.EnsureDestinationDirectory(filePath);
logger.LogInformation($"Saving flow to {destDir}"); logger.LogInformation($"Saving flow to {destDir}");
var userId = User.GetUserId(); var userId = User.GetUserId();
var user = await dbContext.Users.FirstAsync(u => u.Id == userId); var user = await dbContext.Users.FirstAsync(u => u.Id == userId);
logger.LogInformation("Accepting stream ..."); logger.LogInformation("Accepting stream ...");
_ = hubContext.Clients.All.SendAsync("addPublicStream", new PublicStreamInfo
{
sender = userName,
url = url,
}, $"{userName} is starting a stream!");
await liveProcessor.AcceptStream(HttpContext, user, destDir, shortFileName); await liveProcessor.AcceptStream(HttpContext, user, destDir, shortFileName);
return Ok(); return Ok();
} }

@ -69,7 +69,6 @@ namespace Yavsc.WebApi.Controllers
[HttpPost("~/api/setavatar")] [HttpPost("~/api/setavatar")]
public async Task<IActionResult> SetAvatar() public async Task<IActionResult> SetAvatar()
{ {
var root = User.InitPostToFileSystem(null);
var user = await GetUserData(User.GetUserId()); var user = await GetUserData(User.GetUserId());
if (Request.Form.Files.Count!=1) if (Request.Form.Files.Count!=1)
return new BadRequestResult(); return new BadRequestResult();

@ -1,3 +1,4 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation; using Yavsc.Attributes.Validation;
namespace Yavsc.Models.FileSystem namespace Yavsc.Models.FileSystem
{ {
@ -5,10 +6,10 @@ namespace Yavsc.Models.FileSystem
public class MoveFileQuery public class MoveFileQuery
{ {
[ValidRemoteUserFilePath] [ValidRemoteUserFilePath]
[YaStringLength(1, 512)] [StringLength(512)]
public required string Id { get; set; } public required string Id { get; set; }
[YaStringLength(0, 512)] [StringLength(512)]
[ValidRemoteUserFilePath] [ValidRemoteUserFilePath]
public required string To { get; set; } public required string To { get; set; }
} }

@ -47,14 +47,13 @@ namespace Yavsc.Server.Helpers
return $"/{Config.SiteSetup.Avatars}/{user.UserName}.png"; return $"/{Config.SiteSetup.Avatars}/{user.UserName}.png";
} }
public static string InitPostToFileSystem( public static string EnsureDestinationDirectory(
this ClaimsPrincipal user, this ClaimsPrincipal user,
string subpath) string subpath)
{ {
var root = Path.Combine(AbstractFileSystemHelpers.UserFilesDirName, user.Identity.Name); var root = Path.Combine(AbstractFileSystemHelpers.UserFilesDirName, user.Identity.Name);
var diRoot = new DirectoryInfo(root); if (!string.IsNullOrWhiteSpace(subpath))
if (!diRoot.Exists) diRoot.Create(); {
if (!string.IsNullOrWhiteSpace(subpath)) {
if (!subpath.IsValidYavscPath()) if (!subpath.IsValidYavscPath())
{ {
throw new InvalidPathException(); throw new InvalidPathException();
@ -230,7 +229,6 @@ namespace Yavsc.Server.Helpers
var item = new FileReceivedInfo var item = new FileReceivedInfo
(Config.AvatarsOptions.RequestPath.ToUriComponent(), (Config.AvatarsOptions.RequestPath.ToUriComponent(),
user.UserName + ".png"); user.UserName + ".png");
using (var org = formFile.OpenReadStream()) using (var org = formFile.OpenReadStream())
{ {
using Image image = Image.Load(org); using Image image = Image.Load(org);

@ -204,7 +204,6 @@ namespace Yavsc.Models
return base.SaveChanges(); return base.SaveChanges();
} }
public async Task<int> SaveChangesAsync(string userId, CancellationToken ctoken = default(CancellationToken)) public async Task<int> SaveChangesAsync(string userId, CancellationToken ctoken = default(CancellationToken))
{ {
AddTimestamps(userId); AddTimestamps(userId);

@ -7,7 +7,6 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Diagnostics;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Yavsc.Server.Helpers; using Yavsc.Server.Helpers;
using Org.BouncyCastle.Asn1.X509.Qualified;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
@ -79,7 +78,7 @@ namespace Yavsc.Controllers
public IActionResult Contact() public IActionResult Contact()
{ {
return View(); return View(siteSettings);
} }
public IActionResult Dash() public IActionResult Dash()
{ {

@ -37,6 +37,7 @@ using Npgsql;
using System.Reflection; using System.Reflection;
using IdentityServer8.EntityFramework.DbContexts; using IdentityServer8.EntityFramework.DbContexts;
using IdentityServer8.EntityFramework.Mappers; using IdentityServer8.EntityFramework.Mappers;
using System.IdentityModel.Tokens.Jwt;
namespace Yavsc.Extensions; namespace Yavsc.Extensions;
@ -340,26 +341,16 @@ public static class HostingExtensions
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
JwtSecurityTokenHandler.DefaultMapInboundClaims = true;
if (app.Environment.IsDevelopment()) if (app.Environment.IsDevelopment())
{ {
app.UseDeveloperExceptionPage(); // to fix Home/Error app.UseDeveloperExceptionPage();
app.UseExceptionHandler("/Home/Error");
} }
else else
{ {
app.UseExceptionHandler("/Home/Error"); app.UseExceptionHandler("/Home/Error");
try app.InitializeDatabase();
{
using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
await db.Database.MigrateAsync();
}
}
catch (Exception ex)
{
logger.LogError("Error migrating the database : {0}", ex);
}
} }
app.Use(async (context, next) => app.Use(async (context, next) =>
@ -398,7 +389,6 @@ public static class HostingExtensions
payPalSettings, googleAuthSettings, localization, loggerFactory, payPalSettings, googleAuthSettings, localization, loggerFactory,
app.Environment.EnvironmentName); app.Environment.EnvironmentName);
app.ConfigureFileServerApp(); app.ConfigureFileServerApp();
app.InitializeDatabase();
return app; return app;
} }
private static void InitializeDatabase(this IApplicationBuilder app) private static void InitializeDatabase(this IApplicationBuilder app)
@ -411,36 +401,7 @@ public static class HostingExtensions
try try
{ {
context.Database.Migrate(); context.Database.Migrate();
if (!context.Clients.Any())
{
foreach (var client in Config.Clients)
{
context.Clients.Add(client.ToEntity());
}
context.SaveChanges();
}
if (!context.IdentityResources.Any())
{
foreach (var resource in Config.IdentityResources)
{
context.IdentityResources.Add(resource.ToEntity());
}
context.SaveChanges();
}
if (!context.ApiScopes.Any())
{
foreach (var resource in Config.ApiScopes)
{
context.ApiScopes.Add(resource.ToEntity());
}
context.SaveChanges();
}
} }
catch (InvalidOperationException ex) catch (InvalidOperationException ex)
{ {

@ -69,14 +69,16 @@ public class PermissionHandler : IAuthorizationHandler
else else
if (resource is DefaultHttpContext httpContext) if (resource is DefaultHttpContext httpContext)
{ {
if (httpContext.Request.Path.StartsWithSegments("/blogpost/Delete", StringComparison.OrdinalIgnoreCase)) if (httpContext.Request.Path.StartsWithSegments(
"/Blogspot/Delete",
StringComparison.OrdinalIgnoreCase))
{ {
string postId = (string)httpContext.GetRouteValue("id"); string? postId = (string?) httpContext.GetRouteValue("id");
if (long.TryParse(postId, out long id)) if (long.TryParse(postId, out long id))
{ {
BlogPost b = applicationDbContext.BlogSpot.FirstOrDefault(b => b.Id == id && b.AuthorId == user.GetUserId()); BlogPost? b = applicationDbContext.BlogSpot.FirstOrDefault
(b => b.Id == id && b.AuthorId == user.GetUserId());
return b != null; return b != null;
} }
} }
} }

@ -1,238 +0,0 @@
using Microsoft.AspNetCore.Html;
using AsciiDocNet;
namespace Yavsc.Helpers
{
public static class AsciiDocHelpers
{
static void ToHtml(this IElement elt, IHtmlContentBuilder contentbuilder)
{
switch (elt.GetType().FullName)
{
case "AsciiDocNet.Paragraph":
Paragraph p = (Paragraph)elt;
contentbuilder.AppendHtmlLine("<p>");
foreach (var pitem in p)
{
pitem.ToHtml(contentbuilder);
}
contentbuilder.AppendHtmlLine("</p>");
break;
case "AsciiDocNet.SectionTitle":
SectionTitle stitle = (SectionTitle)elt;
contentbuilder.AppendHtmlLine($"<h{stitle.Level}>");
foreach (var titem in stitle)
{
titem.ToHtml(contentbuilder);
}
contentbuilder.AppendHtmlLine("</h>");
break;
case "AsciiDocNet.UnorderedList":
UnorderedList ul = (UnorderedList)elt;
contentbuilder.AppendHtmlLine("<ul>");
foreach (var li in ul.Items)
{
contentbuilder.AppendHtmlLine("<li>");
foreach (var lii in li)
{
lii.ToHtml(contentbuilder);
}
contentbuilder.AppendHtmlLine("</li>");
}
contentbuilder.AppendHtmlLine("</ul>");
break;
case "AsciiDocNet.Source":
Source source = (Source)elt;
// TODO syntact hilighting and fun js modules
contentbuilder.AppendHtmlLine("<pre><code>");
contentbuilder.AppendHtml(source.Text);
contentbuilder.AppendHtmlLine("</code></pre>");
break;
default:
string unsupportedType = elt.GetType().FullName;
throw new InvalidProgramException(unsupportedType);
}
}
public static string GetValidHRef(this Link link)
{
if (link.Href.StartsWith("link:\\"))
return link.Href.Substring(7);
if (link.Href.StartsWith("link:"))
return link.Href.Substring(5);
return link.Href;
}
static void ToHtml(this IInlineElement elt, IHtmlContentBuilder sb)
{
switch (elt.GetType().FullName)
{
case "AsciiDocNet.Monospace":
sb.AppendHtml("<code>");
Monospace mono = (Monospace)elt;
AllItemsToHtml(sb, mono);
break;
case "AsciiDocNet.Link":
Link link = (Link)elt;
Uri uri;
if (Uri.TryCreate(link.Href,
UriKind.RelativeOrAbsolute
, out uri))
{
if (string.IsNullOrEmpty(link.Text))
{
link.Text = $"{uri.Host}({uri.LocalPath})";
}
}
sb.AppendFormat("<a href=\"{0}\">{1}</a> ", link.GetValidHRef(), link.Text);
break;
case "AsciiDocNet.TextLiteral":
RenderLitteral(elt, sb);
break;
case "AsciiDocNet.Emphasis":
sb.AppendHtml("<i>");
AsciiDocNet.Emphasis em = (Emphasis)elt;
sb.AppendHtml(em.Text);
sb.AppendHtml("</i>");
break;
case "AsciiDocNet.Strong":
sb.AppendHtml("<b>");
Strong str = (Strong)elt;
AllItemsToHtml(sb, str);
sb.AppendHtml("</b>");
break;
case "AsciiDocNet.InternalAnchor":
InternalAnchor a = (InternalAnchor)elt;
sb.AppendFormat("<a name=\"{0}\">{1}</a> ", a.Id, a.XRefLabel);
break;
case "AsciiDocNet.Subscript":
sb.AppendHtml("<sup>");
Subscript sub = (Subscript)elt;
RenderLitteral(sub, sb);
sb.AppendHtml("</sup>");
break;
case "AsciiDocNet.Superscript":
sb.AppendHtml("<sup>");
Superscript sup = (Superscript)elt;
RenderLitteral(sup, sb);
sb.AppendHtml("</sup>");
break;
case "AsciiDocNet.Mark":
sb.AppendHtml("<em>");
Mark mark = (Mark)elt;
if (mark.DoubleDelimited)
{
sb.AppendHtml("<b>");
RenderLitteral(mark, sb);
sb.AppendHtml("</b>");
}
else
RenderLitteral(mark, sb);
sb.AppendHtml("</em>");
break;
default:
string unsupportedType = elt.GetType().FullName;
if (elt is InlineContainer inlineContainer)
{
sb.AppendHtml($"<span title=\"E NOT SUPPORTED : {unsupportedType}\">");
AllItemsToHtml(sb, inlineContainer);
sb.AppendHtml("</span>");
}
else if (elt is IInlineElement inlineElement)
{
sb.AppendHtml($"<span title=\"E NOT SUPPORTED : {unsupportedType}\">");
RenderLitteral(inlineElement, sb);
sb.AppendHtml("</span>");
}
else
{
throw new InvalidProgramException(unsupportedType);
}
break;
}
}
private static void AllItemsToHtml(IHtmlContentBuilder sb, InlineContainer mono)
{
foreach (var item in mono)
{
item.ToHtml(sb);
}
sb.AppendHtml("</code>");
}
private static void RenderLitteral(IInlineElement elt, IHtmlContentBuilder sb)
{
var tl = elt as TextLiteral;
if (tl?.Attributes.Anchor != null)
{
sb.AppendHtmlLine($"<a name=\"{tl.Attributes.Anchor.Id}\">{tl.Attributes.Anchor.XRefLabel}</a> ");
}
if (tl != null) sb.AppendHtml(tl.Text);
}
public static IHtmlContent ToHtml(this Document doc, int doclevel = 4)
{
var contentbuilder = new HtmlContentBuilder();
if (doc.Title != null)
{
if (!string.IsNullOrWhiteSpace(doc.Title.Title))
{
contentbuilder.AppendHtmlLine($"<h{doclevel}>{doc.Title.Title}</h{doclevel}>");
if (!string.IsNullOrWhiteSpace(doc.Title.Subtitle))
{
contentbuilder.AppendHtmlLine($"<i>{doc.Title.Title}</i><br/>");
}
}
}
foreach (var item in doc)
{
item.ToHtml(contentbuilder);
}
return contentbuilder;
}
/*
public static IHtmlContent AsciiDocFor<TModel>(this IHtmlHelper<TModel> html,
Expression<Func<TModel, string>> expression)
{
string ascii = html.ValueFor<string>(expression, "{0}");
if (string.IsNullOrWhiteSpace(ascii))
return new HtmlString(string.Empty);
Document document = Document.Parse(ascii);
var htmlDoc = document.ToHtml();
var span = new TagBuilder("p") { TagRenderMode = TagRenderMode.SelfClosing };
span.InnerHtml.AppendHtml(htmlDoc);
return span.RenderBody();
}
public static string AsciiDoc(IHtmlHelper<BlogPost> htmlHelper, string text)
{
return AsciiDoc(htmlHelper, text, null);
}
private static string AsciiDoc(IHtmlHelper<BlogPost> htmlHelper, string text, object htmlAttributes)
{
// Create tag builder
var builder = new TagBuilder("div");
var document = Document.Parse(text);
// builder.InnerHtml = .
// Add attributes
builder.MergeAttribute("class", "ascii");
builder.MergeAttributes(new RouteValueDictionary(htmlAttributes));
// Render tag
return builder.ToString();
} */
}
}

@ -1,5 +1,7 @@
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using AsciiDocNet; using System.Web;
using AsciiDocSharp;
using AsciiDocSharp.Converters.Html;
using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers;
@ -10,9 +12,10 @@ namespace Yavsc.Helpers
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{ {
await base.ProcessAsync(context, output); //await base.ProcessAsync(context, output);
var content = await output.GetChildContentAsync(); var content = await output.GetChildContentAsync();
string text = content.GetContent(); string text = HttpUtility.HtmlDecode(content.GetContent());
if (string.IsNullOrWhiteSpace(text)) return; if (string.IsNullOrWhiteSpace(text)) return;
try try
@ -31,12 +34,14 @@ namespace Yavsc.Helpers
} }
} }
} }
Document document = Document.Parse(text); var processor = new AsciiDocProcessor();
var html = document.ToHtml(2); var htmlConverter = new HtmlDocumentConverter();
using var stringWriter = new StringWriter();
html.WriteTo(stringWriter, HtmlEncoder.Default); var document = processor.ParseFromText(text);
var processedHere = stringWriter.ToString(); var htmlResult = processor.ConvertDocument(document, htmlConverter);
output.Content.AppendHtml(processedHere);
output.Content.AppendHtml(htmlResult);
} }
catch (ArgumentException ex) catch (ArgumentException ex)
{ {

@ -65,6 +65,6 @@ Nombre </dt><dd> @Model.AdminCount</dd>
<h3>Applications tièrces</h3> <h3>Applications tièrces</h3>
<a asp-controller="Client" class="btn btn-primary"> <a asp-controller="Client" class="btn btn-primary">
OAuth key management"] OAuth key management
</a> </a>

@ -1,4 +1,4 @@
@model BlogPostEditViewModel @model BlogPostCreateViewModel
@{ @{
ViewData["Title"] = "Blog post edition"; ViewData["Title"] = "Blog post edition";

@ -63,7 +63,7 @@ $('#commentValidation').html(
<div class="post"> <div class="post">
<div class="float-left"> <div class="float-left">
<img alt="" src="@Model.Photo" > <img class="photo" src="@Model.Photo" >
</div> </div>
<h1 ismarkdown>@Model.Title</h1> <h1 ismarkdown>@Model.Title</h1>

@ -55,7 +55,7 @@
<h2 title="Titre du post" class="blogtitle" id="titleview" >@Model.Title</h2> <h2 title="Titre du post" class="blogtitle" id="titleview" >@Model.Title</h2>
<div title="Contenu du post" id="contentview">@Model.Content</div> <div title="Contenu du post" id="contentview"><asciidoc>@Model.Content</asciidoc></div>
<hr> <hr>
<form asp-action="Edit"> <form asp-action="Edit">

@ -44,19 +44,17 @@
</p> </p>
} }
<div class="blog"> <div class="blog-index">
@{ @{
int maxTextLen = 75; int maxTextLen = 75;
foreach (var post in Model) { foreach (var post in Model) {
<div class="post"> <div class="post card">
<div class="float-left" > <a asp-action="Details" asp-route-id="@post.Id" class="bloglink" >
<a asp-action="Details" asp-route-id="@post.Id" class="bloglink" style="display: float-left;"> <div class="float-left"><img class="photo card-photo" src="@post.Photo" ></div>
<img src="@post.Photo" > <h3 class="index-post-title">@post.Title</h3>
</a> </a>
</div>
<h3>@post.Title</h3>
<div> <div>
<a asp-action="Details" asp-route-id="@post.Id"> <a asp-action="Details" asp-route-id="@post.Id">
<asciidoc summary="@maxTextLen">@post.Content</asciidoc></a> <asciidoc summary="@maxTextLen">@post.Content</asciidoc></a>

@ -1,17 +1,15 @@
@model SiteSettings
@{ @{
ViewData["Title"] = "Contact"; ViewData["Title"] = "Contact";
} }
<h2>@ViewData["Title"].</h2> <h2>@ViewData["Title"].</h2>
<h3>@ViewData["Message"]</h3> <h3>@ViewData["Message"]</h3>
<address> <p>
Paul Schneider<br> @Model.Owner.Name <br>
2 Boulevard Aristide Briand - @Html.DisplayFor(m=>m.Owner.PostalAddress)</p>
92150 Suresnes (France)
<abbr title="Phone">P:</abbr> +33 6 51 14 15 64
</address>
<address> <address>
<strong>Support:</strong> <a href="mailto:contact@pschneider.fr">contact@pschneider.fr</a><br /> <strong>Support:</strong> <a href="mailto:@Model.Admin.EMail">@(Model.Admin.Name)&lt;@(Model.Admin.EMail)&gt;</a><br />
<strong>Marketing:</strong> <a href="mailto:paul@pschneider.fr">paul@pschneider.fr</a> <strong>Marketing:</strong> <a href="mailto:@Model.Owner.EMail">@(Model.Owner.Name)&lt;@(Model.Owner.EMail)&gt;</a>
</address> </address>

@ -0,0 +1,8 @@
@model PostalAddress
<address>
@Model.Street1<br />
@Model.Street2<br />
@Model.PostalCode, @Model.City<br />
@Model.Province @Model.State @Model.Country
</address>

@ -1,23 +0,0 @@
<asciidoc>
# Title
## ![get:test] (/Test/Register)
![legacy_image](/images/logo-dev.png)
![input:text:name](Your name:)
!(input:email)(Email (ex:blouh&amp;john.net))
!(input:phone)(Enter your phone here, (ex:555 802 45 7897))
!(input:textarea:message)(Enter your message, and get some terrific WTF you want to do with.(ex:blouh&amp;john.net))
!(input:choice:yours)(And choose betwen [alpha,beta,gamma])
## ![post:Another](/test/Form)
Or else, ![input:textarea:yours](enter you life here :-))
</asciidoc>

@ -41,7 +41,8 @@
<PackageReference Include="System.Security.Cryptography.Pkcs" /> <PackageReference Include="System.Security.Cryptography.Pkcs" />
<PackageReference Include="Microsoft.AspNetCore.Antiforgery" /> <PackageReference Include="Microsoft.AspNetCore.Antiforgery" />
<PackageReference Include="Swashbuckle.AspNetCore" /> <PackageReference Include="Swashbuckle.AspNetCore" />
<PackageReference Include="AsciiDocNet" /> <PackageReference Include="AsciiDocSharp" />
<PackageReference Include="AsciiDocSharp.Converters.Html" />
<PackageReference Include="SixLabors.ImageSharp" /> <PackageReference Include="SixLabors.ImageSharp" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.Google" />
<PackageReference Include="Microsoft.Extensions.Logging" /> <PackageReference Include="Microsoft.Extensions.Logging" />

@ -1,6 +1,6 @@
.grants-page .card { .grants-page .card {
margin-top: 20px; margin-top: 20px;
border-bottom: 1px solid lightgray; } border-bottom: 1px solid #fd8134; }
.grants-page .card .card-title { .grants-page .card .card-title {
font-size: 120%; font-size: 120%;
font-weight: bold; } font-weight: bold; }
@ -15,7 +15,7 @@
div.carousel-inner > div.item > div.carousel-caption-s { div.carousel-inner > div.item > div.carousel-caption-s {
margin: .5em; margin: .5em;
background-color: rgba(0, 0, 0, 0.6); background-color: #11415faa;
color: #ffffc8; color: #ffffc8;
font-weight: bold; font-weight: bold;
padding: .5em; } padding: .5em; }
@ -30,17 +30,15 @@ input[type='checkbox'] {
min-height: 1em; } min-height: 1em; }
.container { .container {
background-color: #000000d5;
color: #fff;
padding: .5em; padding: .5em;
margin: .5em; } margin: .5em; }
.post { .post {
background-color: #000000dd; background-color: #290505;
color: #d1d1d1; color: #c4fbff;
padding: 2.3em; padding: .7em;
border-radius: 2em; border-radius: 2em;
border: solid #441515a4 2pt; } border: solid #b29e9e 2pt; }
.actiongroup { .actiongroup {
float: right; float: right;
@ -51,8 +49,94 @@ input[type='checkbox'] {
margin: .5em; } margin: .5em; }
a { a {
color: aquamarine; color: var(--blue); }
background-color: black; }
a.close { a.close {
cursor: pointer; } cursor: pointer; }
address {
padding: .2em;
margin: .2em; }
.grants-page .card {
margin-top: 20px;
border-bottom: 1px solid lightgray; }
.grants-page .card .card-title {
font-size: 120%;
font-weight: bold; }
.grants-page .card .card-title img {
width: 100px;
height: 100px; }
.grants-page .card label {
font-weight: bold; }
.navbar-dark .navbar-toggler-icon {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); }
div.carousel-inner > div.item > div.carousel-caption-s {
margin: .5em;
background-color: #11415faa;
color: #ffffc8;
font-weight: bold;
padding: .5em; }
img.blogphoto {
max-width: 100%;
max-height: 100%; }
input[type='checkbox'] {
appearance: auto;
min-width: 1em;
min-height: 1em; }
.container {
background-color: #000000;
color: #e0e0e0;
padding: 0;
margin: 0; }
.post {
background-color: #290505;
color: #c4fbff;
padding: .3em;
margin: .3em;
border-radius: 2em;
border: solid #b29e9e 2pt; }
.post .photo {
max-height: 100%;
max-width: 100%; }
.actiongroup {
float: right;
margin: .5em; }
.float-left {
float: left;
margin: .5em; }
body {
font: 1rem/1.5 var(--font-family-sans-serif);
color: #e0e0e0;
background-color: #000000; }
.card {
max-height: 20em;
max-width: 30em;
display: inline-table; }
.card .card-photo {
border: solid 1px #ffffffd4;
max-height: 15em;
max-width: 30em; }
.card .index-post-title {
display: inline; }
.display-label {
display: inline;
font-style: italic;
font-weight: 300; }
.display-field {
display: inline; }

@ -1,6 +1,11 @@
.grants-page.card{margin-top:20px;border-bottom:1px solid lightgray;}.grants-page.card.card-title{font-size:120%;font-weight:bold;}.grants-page.card.card-title img{width:100px;height:100px;}.grants-page.card label{font-weight:bold;}.navbar-dark.navbar-toggler-icon{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");} .grants-page.card{margin-top:20px;border-bottom:1px solid#fd8134;}.grants-page.card.card-title{font-size:120%;font-weight:bold;}.grants-page.card.card-title img{width:100px;height:100px;}.grants-page.card label{font-weight:bold;}.navbar-dark.navbar-toggler-icon{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");}
div.carousel-inner>div.item>div.carousel-caption-s{margin:.5em;background-color:rgba(0,0,0,0.6);color:#ffffc8;font-weight:bold;padding:.5em;} div.carousel-inner>div.item>div.carousel-caption-s{margin:.5em;background-color:#11415faa;color:#ffffc8;font-weight:bold;padding:.5em;}
img.blogphoto{max-width:100%;max-height:100%;} img.blogphoto{max-width:100%;max-height:100%;}
input[type='checkbox']{appearance:auto;min-width:1em;min-height:1em;}.container{background-color:#000000d5;color:#fff;padding:.5em;margin:.5em;}.post{background-color:#000000dd;color:#d1d1d1;padding:2.3em;border-radius:2em;border:solid#441515a4 2pt;}.actiongroup{float:right;margin:.5em;}.float-left{float:left;margin:.5em;} input[type='checkbox']{appearance:auto;min-width:1em;min-height:1em;}.container{padding:.5em;margin:.5em;}.post{background-color:#290505;color:#c4fbff;padding:.7em;border-radius:2em;border:solid#b29e9e 2pt;}.actiongroup{float:right;margin:.5em;}.float-left{float:left;margin:.5em;}
a{color:aquamarine;background-color:black;} a{color:var(--blue);}
a.close{cursor:pointer;} a.close{cursor:pointer;}
address{padding:.2em;margin:.2em;}.grants-page.card{margin-top:20px;border-bottom:1px solid lightgray;}.grants-page.card.card-title{font-size:120%;font-weight:bold;}.grants-page.card.card-title img{width:100px;height:100px;}.grants-page.card label{font-weight:bold;}.navbar-dark.navbar-toggler-icon{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");}
div.carousel-inner>div.item>div.carousel-caption-s{margin:.5em;background-color:#11415faa;color:#ffffc8;font-weight:bold;padding:.5em;}
img.blogphoto{max-width:100%;max-height:100%;}
input[type='checkbox']{appearance:auto;min-width:1em;min-height:1em;}.container{background-color:#000000;color:#e0e0e0;padding:0;margin:0;}.post{background-color:#290505;color:#c4fbff;padding:.3em;margin:.3em;border-radius:2em;border:solid#b29e9e 2pt;}.post.photo{max-height:100%;max-width:100%;}.actiongroup{float:right;margin:.5em;}.float-left{float:left;margin:.5em;}
body{font:1rem/1.5 var(--font-family-sans-serif);color:#e0e0e0;background-color:#000000;}.card{max-height:20em;max-width:30em;display:inline-table;}.card.card-photo{border:solid 1px#ffffffd4;max-height:15em;max-width:30em;}.card.index-post-title{display:inline;}.display-label{display:inline;font-style:italic;font-weight:300;}.display-field{display:inline;}

@ -1,9 +1,19 @@
$color: #e0e0e0;
$background-color: #000000;
$post-color: #c4fbff;
$post-background-color: #290505;
$post-border-color: rgb(178, 158, 158);
$card-border-color: rgb(253, 129, 52);
$card-photo-border-color: #ffffffd4;
$carousel-color: rgb(255, 255, 200);
$carousel-background-color: #11415faa;
$primary: #00c40d;
$danger: #dc0505d5;
.grants-page { .grants-page {
.card { .card {
margin-top: 20px; margin-top: 20px;
border-bottom: 1px solid lightgray; border-bottom: 1px solid $card-border-color;
.card-title { .card-title {
img { img {
@ -25,10 +35,10 @@
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
} }
div.carousel-inner > div.item > div.carousel-caption-s { div.carousel-inner>div.item>div.carousel-caption-s {
margin: .5em; margin: .5em;
background-color: rgba(0,0,0,.6); background-color: $carousel-background-color;
color: rgb(255,255,200); color: $carousel-color;
font-weight: bold; font-weight: bold;
padding: .5em; padding: .5em;
} }
@ -45,38 +55,146 @@ input[type='checkbox'] {
} }
.container { .container {
background-color: #000000d5;
color: #fff;
padding: .5em; padding: .5em;
margin: .5em; margin: .5em;
} }
.post { .post {
background-color: #000000dd; background-color: $post-background-color;
color:#d1d1d1; color: $post-color;
padding: 2.3em; padding: .7em;
border-radius: 2em; border-radius: 2em;
border: solid #441515a4 2pt; border: solid $post-border-color 2pt;
} }
.actiongroup .actiongroup {
{
float: right; float: right;
margin:.5em; margin: .5em;
} }
.float-left .float-left {
{
float: left; float: left;
margin:.5em; margin: .5em;
} }
a { a {
color:aquamarine; color: var(--blue);
background-color: black;
} }
a.close a.close {
{
cursor: pointer; cursor: pointer;
} }
address {
padding:.2em;
margin:.2em;
}
.grants-page .card {
margin-top: 20px;
border-bottom: 1px solid lightgray;
}
.grants-page .card .card-title {
font-size: 120%;
font-weight: bold;
}
.grants-page .card .card-title img {
width: 100px;
height: 100px;
}
.grants-page .card label {
font-weight: bold;
}
.navbar-dark .navbar-toggler-icon {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
div.carousel-inner>div.item>div.carousel-caption-s {
margin: .5em;
background-color: $carousel-background-color;
color: $carousel-color;
font-weight: bold;
padding: .5em;
}
img.blogphoto {
max-width: 100%;
max-height: 100%;
}
input[type='checkbox'] {
appearance: auto;
min-width: 1em;
min-height: 1em;
}
.container {
background-color: $background-color;
color: $color;
padding: 0;
margin: 0;
}
.post {
background-color: $post-background-color;
color: $post-color;
padding: .3em;
margin: .3em;
border-radius: 2em;
border: solid $post-border-color 2pt;
.photo {
max-height: 100%;
max-width: 100%;
}
}
.actiongroup {
float: right;
margin: .5em;
}
.float-left {
float: left;
margin: .5em;
}
body {
font: 1rem/1.5 var(--font-family-sans-serif);
color: $color;
background-color: $background-color;
}
.card {
max-height: 20em;
max-width: 30em;
display: inline-table;
.card-photo {
border: solid 1px $card-photo-border-color;
max-height: 15em;
max-width: 30em;
}
.index-post-title {
display: inline;
}
}
.display-label {
display: inline;
font-style: italic;
font-weight: 300;
}
.display-field {
display: inline;
}

@ -91,7 +91,14 @@ namespace isnd.tests
using (var migrationScope = app.Services.CreateScope()) using (var migrationScope = app.Services.CreateScope())
{ {
var db = migrationScope.ServiceProvider.GetRequiredService<ApplicationDbContext>(); var db = migrationScope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
await db.Database.MigrateAsync(); db.Database.EnsureDeleted();
db.Database.EnsureCreated();
db.Database.Migrate();
TestingUserName = "Tester";
TestingUserPassword = "test";
TestClientId = "testClientId";
TestingUser = await db.Users.FirstOrDefaultAsync(u => u.UserName == TestingUserName);
EnsureUser(TestingUserName, TestingUserPassword);
} }
await app.ConfigurePipeline(); await app.ConfigurePipeline();
app.UseSession(); app.UseSession();
@ -112,17 +119,8 @@ namespace isnd.tests
} }
SiteSettings = app.Services.GetRequiredService<IOptions<SiteSettings>>().Value; SiteSettings = app.Services.GetRequiredService<IOptions<SiteSettings>>().Value;
using IServiceScope scope = app.Services.CreateScope();
ApplicationDbContext dbContext =
scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
//dbContext.Database.EnsureCreated();
dbContext.Database.Migrate();
TestingUserName = "Tester";
TestingUserPassword = "test";
TestClientId = "testClientId";
TestingUser = await dbContext.Users.FirstOrDefaultAsync(u => u.UserName == TestingUserName);
EnsureUser(TestingUserName, TestingUserPassword);
} }

Loading…