Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v12.14.0 #752

Merged
merged 83 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
f68e9f2
Auto csproj fix and update by bot.
NugetNinja Aug 21, 2023
7054a0a
Merge pull request #746 from NugetNinja/users/nugetninja/evergreen
EdiWang Aug 22, 2023
1ecea2c
Update _ExternalLink.cshtml
EdiWang Aug 28, 2023
7215ef7
upgrade libs
EdiWang Aug 29, 2023
986b7df
Update jquery.slim.min.js
EdiWang Aug 29, 2023
3f2a97b
admin side menu design update
EdiWang Sep 3, 2023
9a7ca0c
update Markdig
EdiWang Sep 3, 2023
f921d2c
rename class
EdiWang Sep 3, 2023
06f4f53
rename RequestPath to DefaultPath
EdiWang Sep 3, 2023
0864aba
extract WriteStyleSheet method
EdiWang Sep 3, 2023
10e3609
add todo
EdiWang Sep 3, 2023
25e24db
fix blow up
EdiWang Sep 3, 2023
fd87341
check slug regex
EdiWang Sep 3, 2023
4295dff
Create StyleSheetEntity.cs
EdiWang Sep 3, 2023
c76a59e
Update BlogDbContext.cs
EdiWang Sep 3, 2023
ee14d48
StyleSheetConfiguration
EdiWang Sep 3, 2023
d232882
Create StyleSheetSpec.cs
EdiWang Sep 3, 2023
2a95c57
Create SaveStyleSheetCommand.cs
EdiWang Sep 3, 2023
1ec04b2
rename
EdiWang Sep 3, 2023
ee26b6e
Update BlogPage.cs
EdiWang Sep 3, 2023
13846d8
update PageConfiguration
EdiWang Sep 3, 2023
7b7e6cc
Update CreatePageCommand.cs
EdiWang Sep 3, 2023
3240d98
Update UpdatePageCommand.cs
EdiWang Sep 3, 2023
5d949a7
Update PageEntity.cs
EdiWang Sep 3, 2023
25ee9ba
Update ExportPageDataCommand.cs
EdiWang Sep 3, 2023
3422d3d
Update StyleSheetMiddleware.cs
EdiWang Sep 3, 2023
02bf5e0
comment out old css logic
EdiWang Sep 3, 2023
4b8aae6
Create DeleteStyleSheetCommand.cs
EdiWang Sep 3, 2023
3b0a1d1
Update DeletePageCommand.cs
EdiWang Sep 3, 2023
391ade6
add page_ prefix
EdiWang Sep 4, 2023
feaa313
rename conflict type
EdiWang Sep 4, 2023
b193251
Create GetStyleSheetQuery.cs
EdiWang Sep 4, 2023
199f84c
get css
EdiWang Sep 4, 2023
46b9e15
remove timeline.css
EdiWang Sep 4, 2023
6409224
use page.css on preview
EdiWang Sep 4, 2023
93b575f
check null
EdiWang Sep 4, 2023
17e2ac1
Update EditPage.cshtml.cs
EdiWang Sep 4, 2023
cac48d0
fix up
EdiWang Sep 4, 2023
af54fb7
Merge pull request #747 from EdiWang/page-css-refact
EdiWang Sep 4, 2023
a2bd406
rename page.css to content.css
EdiWang Sep 4, 2023
4ea87ad
Update _LayoutAdmin.cshtml
EdiWang Sep 4, 2023
d6a61d3
update about page design
EdiWang Sep 4, 2023
cf004b4
new settings header design
EdiWang Sep 4, 2023
6dfe81c
Update General.cshtml
EdiWang Sep 4, 2023
d62148a
Update Content.cshtml
EdiWang Sep 4, 2023
ae0a363
Update Image.cshtml
EdiWang Sep 4, 2023
b988641
Update Subscription.cshtml
EdiWang Sep 4, 2023
94f00ac
Update CustomStyleSheet.cshtml
EdiWang Sep 4, 2023
2bd016d
Update General.cshtml
EdiWang Sep 4, 2023
cbc72b4
Update Notification.cshtml
EdiWang Sep 4, 2023
2dfe727
Update Advanced.cshtml
EdiWang Sep 4, 2023
23eed13
Update Category.cshtml
EdiWang Sep 4, 2023
d86562f
Update BlogPage.cshtml
EdiWang Sep 4, 2023
9feccd1
add section
EdiWang Sep 4, 2023
79ef656
new post admin header
EdiWang Sep 4, 2023
6c460ba
Update RecycleBin.cshtml
EdiWang Sep 4, 2023
d66c846
Update Draft.cshtml
EdiWang Sep 4, 2023
bb103fd
Update Post.cshtml
EdiWang Sep 4, 2023
41b8cea
Update EditPost.cshtml
EdiWang Sep 4, 2023
0ff0b2a
Update EditPage.cshtml
EdiWang Sep 4, 2023
cb6d733
Update Comments.cshtml
EdiWang Sep 4, 2023
6017411
Update Tags.cshtml
EdiWang Sep 4, 2023
9571004
Update CustomMenu.cshtml
EdiWang Sep 4, 2023
626696c
update padding
EdiWang Sep 4, 2023
75961f4
Update FriendLink.cshtml
EdiWang Sep 4, 2023
46b8a32
Update Pingback.cshtml
EdiWang Sep 4, 2023
fdf4465
Merge pull request #748 from EdiWang/admin-design-update
EdiWang Sep 4, 2023
4303c63
update admin bg color
EdiWang Sep 4, 2023
903c333
UI fix up
EdiWang Sep 4, 2023
2464de6
move menu page location
EdiWang Sep 4, 2023
e5f258b
set comment admin pagesize to 5
EdiWang Sep 4, 2023
802cae0
update image settings page ui
EdiWang Sep 4, 2023
e7096a6
Update Content.cshtml
EdiWang Sep 4, 2023
e1ffc2a
Update Content.cshtml
EdiWang Sep 4, 2023
0fb22fb
admin ui update
EdiWang Sep 4, 2023
bb430c5
Fix an issue that server will boom boom with users comments.
Anduin2017 Sep 4, 2023
e3a2696
Merge pull request #749 from EdiWang/Anduin2017-patch-1
EdiWang Sep 4, 2023
11d6ae0
remove inline css
EdiWang Sep 5, 2023
ff7b93e
Merge pull request #750 from EdiWang/fix/remove-inline-css-for-post
EdiWang Sep 5, 2023
89ee2eb
bump version
EdiWang Sep 6, 2023
259b3ca
Auto csproj fix and update by bot.
NugetNinja Sep 11, 2023
b1dedcc
Merge pull request #751 from NugetNinja/users/nugetninja/evergreen
EdiWang Sep 11, 2023
b7a060e
patch azure and .net libs
EdiWang Sep 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<Authors>Edi Wang</Authors>
<Company>edi.wang</Company>
<Copyright>(C) 2023 edi.wang@outlook.com</Copyright>
<AssemblyVersion>12.13.0.0</AssemblyVersion>
<FileVersion>12.13.0.0</FileVersion>
<Version>12.13.0</Version>
<AssemblyVersion>12.14.0.0</AssemblyVersion>
<FileVersion>12.14.0.0</FileVersion>
<Version>12.14.0</Version>
</PropertyGroup>
</Project>
49 changes: 24 additions & 25 deletions src/Moonglade.Auth/Moonglade.Auth.csproj
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<Using Include="System.Text" />

<Using Include="Microsoft.AspNetCore.Mvc" />
<Using Include="Microsoft.AspNetCore.Authorization" />

<Using Include="MediatR" />
</ItemGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />

<PackageReference Include="Microsoft.Identity.Web" Version="2.13.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Moonglade.Data\Moonglade.Data.csproj" />
<ProjectReference Include="..\Moonglade.Utils\Moonglade.Utils.csproj" />
</ItemGroup>
</Project>
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net7.0</TargetFramework>
<AssemblyName>Moonglade.Auth</AssemblyName>
<RootNamespace>Moonglade.Auth</RootNamespace>
<IsTestProject>false</IsTestProject>
<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Using Include="System.Text" />
<Using Include="Microsoft.AspNetCore.Mvc" />
<Using Include="Microsoft.AspNetCore.Authorization" />
<Using Include="MediatR" />
</ItemGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Identity.Web" Version="2.13.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Moonglade.Data\Moonglade.Data.csproj" />
<ProjectReference Include="..\Moonglade.Utils\Moonglade.Utils.csproj" />
</ItemGroup>
</Project>
35 changes: 18 additions & 17 deletions src/Moonglade.Comments/Moonglade.Comments.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Edi.WordFilter" Version="1.7.0" />
<PackageReference Include="Edi.Captcha" Version="3.16.0" />
<PackageReference Include="Microsoft.Azure.CognitiveServices.ContentModerator" Version="2.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Moonglade.Configuration\Moonglade.Configuration.csproj" />
</ItemGroup>

</Project>
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net7.0</TargetFramework>
<AssemblyName>Moonglade.Comments</AssemblyName>
<RootNamespace>Moonglade.Comments</RootNamespace>
<IsTestProject>false</IsTestProject>
<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Edi.WordFilter" Version="1.7.0" />
<PackageReference Include="Edi.Captcha" Version="3.17.0" />
<PackageReference Include="Microsoft.Azure.CognitiveServices.ContentModerator" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Moonglade.Configuration\Moonglade.Configuration.csproj" />
</ItemGroup>
</Project>
29 changes: 2 additions & 27 deletions src/Moonglade.Configuration/ImageSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,12 @@ public class ImageSettings : IBlogSettings, IValidatableObject
[Required]
[Display(Name = "A")]
[Range(0, 255)]
public int WatermarkColorA { get; set; }

[Required]
[Display(Name = "R")]
[Range(0, 255)]
public int WatermarkColorR { get; set; }

[Required]
[Display(Name = "G")]
[Range(0, 255)]
public int WatermarkColorG { get; set; }

[Required]
[Display(Name = "B")]
[Range(0, 255)]
public int WatermarkColorB { get; set; }
public int WatermarkColorA { get; set; } = 128;

[Required]
[Display(Name = "Watermark skip pixel threshold")]
[Range(0, int.MaxValue)]
public int WatermarkSkipPixel { get; set; }
public int WatermarkSkipPixel { get; set; } = 40000;

[Display(Name = "Fit image to device pixel ratio")]
public bool FitImageToDevicePixelRatio { get; set; }
Expand All @@ -58,16 +43,6 @@ public class ImageSettings : IBlogSettings, IValidatableObject
[Display(Name = "CDN endpoint")]
public string CDNEndpoint { get; set; }

public ImageSettings()
{
WatermarkColorA = 128;
WatermarkColorR = 128;
WatermarkColorG = 128;
WatermarkColorB = 128;

WatermarkSkipPixel = 40000;
}

public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (EnableCDNRedirect)
Expand Down
35 changes: 18 additions & 17 deletions src/Moonglade.Configuration/Moonglade.Configuration.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Moonglade.Data\Moonglade.Data.csproj" />
<ProjectReference Include="..\Moonglade.Utils\Moonglade.Utils.csproj" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net7.0</TargetFramework>
<AssemblyName>Moonglade.Configuration</AssemblyName>
<RootNamespace>Moonglade.Configuration</RootNamespace>
<IsTestProject>false</IsTestProject>
<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Moonglade.Data\Moonglade.Data.csproj" />
<ProjectReference Include="..\Moonglade.Utils\Moonglade.Utils.csproj" />
</ItemGroup>
</Project>
21 changes: 21 additions & 0 deletions src/Moonglade.Core/DeleteStyleSheetCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace Moonglade.Core;

public record DeleteStyleSheetCommand(Guid Id) : IRequest;

public class DeleteStyleSheetCommandHandler : IRequestHandler<DeleteStyleSheetCommand>
{
private readonly IRepository<StyleSheetEntity> _repo;

public DeleteStyleSheetCommandHandler(IRepository<StyleSheetEntity> repo) => _repo = repo;

public async Task Handle(DeleteStyleSheetCommand request, CancellationToken cancellationToken)
{
var styleSheet = await _repo.GetAsync(request.Id, cancellationToken);
if (styleSheet is null)
{
throw new InvalidOperationException($"StyleSheetEntity with Id '{request.Id}' not found.");
}

await _repo.DeleteAsync(styleSheet, cancellationToken);
}
}
16 changes: 16 additions & 0 deletions src/Moonglade.Core/GetStyleSheetQuery.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Moonglade.Core;

public record GetStyleSheetQuery(Guid Id) : IRequest<StyleSheetEntity>;

public class GetStyleSheetQueryHandler : IRequestHandler<GetStyleSheetQuery, StyleSheetEntity>
{
private readonly IRepository<StyleSheetEntity> _repo;

public GetStyleSheetQueryHandler(IRepository<StyleSheetEntity> repo) => _repo = repo;

public async Task<StyleSheetEntity> Handle(GetStyleSheetQuery request, CancellationToken cancellationToken)
{
var result = await _repo.GetAsync(request.Id, cancellationToken);
return result;
}
}
48 changes: 24 additions & 24 deletions src/Moonglade.Core/Moonglade.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Edi.CacheAside.InMemory" Version="1.0.0" />
</ItemGroup>

<ItemGroup>
<Using Include="System.Text" />

<Using Include="Microsoft.AspNetCore.Mvc" />
<Using Include="Microsoft.AspNetCore.Authorization" />

<Using Include="MediatR" />

<Using Include="Moonglade.Data.Entities" />
<Using Include="Moonglade.Data.Infrastructure" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Moonglade.Configuration\Moonglade.Configuration.csproj" />
</ItemGroup>
</Project>
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net7.0</TargetFramework>
<AssemblyName>Moonglade.Core</AssemblyName>
<RootNamespace>Moonglade.Core</RootNamespace>
<IsTestProject>false</IsTestProject>
<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Edi.CacheAside.InMemory" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<Using Include="System.Text" />
<Using Include="Microsoft.AspNetCore.Mvc" />
<Using Include="Microsoft.AspNetCore.Authorization" />
<Using Include="MediatR" />
<Using Include="Moonglade.Data.Entities" />
<Using Include="Moonglade.Data.Infrastructure" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Moonglade.Configuration\Moonglade.Configuration.csproj" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/Moonglade.Core/PageFeature/BlogPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class BlogPage
public string Slug { get; set; }
public string MetaDescription { get; set; }
public string RawHtmlContent { get; set; }
public string CssContent { get; set; }
public string CssId { get; set; }
public bool HideSidebar { get; set; }
public bool IsPublished { get; set; }
public DateTime CreateTimeUtc { get; set; }
Expand All @@ -25,7 +25,7 @@ public BlogPage(PageEntity entity)
Id = entity.Id;
Title = entity.Title.Trim();
CreateTimeUtc = entity.CreateTimeUtc;
CssContent = entity.CssContent;
CssId = entity.CssId;
RawHtmlContent = entity.HtmlContent;
HideSidebar = entity.HideSidebar;
Slug = entity.Slug.Trim().ToLower();
Expand Down
22 changes: 18 additions & 4 deletions src/Moonglade.Core/PageFeature/CreatePageCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,36 @@ public record CreatePageCommand(EditPageRequest Payload) : IRequest<Guid>;
public class CreatePageCommandHandler : IRequestHandler<CreatePageCommand, Guid>
{
private readonly IRepository<PageEntity> _repo;
public CreatePageCommandHandler(IRepository<PageEntity> repo) => _repo = repo;
private readonly IMediator _mediator;

public CreatePageCommandHandler(IRepository<PageEntity> repo, IMediator mediator)
{
_repo = repo;
_mediator = mediator;
}

public async Task<Guid> Handle(CreatePageCommand request, CancellationToken ct)
{
var slug = request.Payload.Slug.ToLower().Trim();

Guid? cssId = null;
if (!string.IsNullOrWhiteSpace(request.Payload.CssContent))
{
cssId = await _mediator.Send(new SaveStyleSheetCommand(Guid.NewGuid(), slug, request.Payload.CssContent), ct);
}

var uid = Guid.NewGuid();
var page = new PageEntity
{
Id = uid,
Title = request.Payload.Title.Trim(),
Slug = request.Payload.Slug.ToLower().Trim(),
Slug = slug,
MetaDescription = request.Payload.MetaDescription,
CreateTimeUtc = DateTime.UtcNow,
HtmlContent = request.Payload.RawHtmlContent,
CssContent = request.Payload.CssContent,
HideSidebar = request.Payload.HideSidebar,
IsPublished = request.Payload.IsPublished
IsPublished = request.Payload.IsPublished,
CssId = cssId.ToString()
};

await _repo.AddAsync(page, ct);
Expand Down
23 changes: 21 additions & 2 deletions src/Moonglade.Core/PageFeature/DeletePageCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,27 @@ public record DeletePageCommand(Guid Id) : IRequest;
public class DeletePageCommandHandler : IRequestHandler<DeletePageCommand>
{
private readonly IRepository<PageEntity> _repo;
public DeletePageCommandHandler(IRepository<PageEntity> repo) => _repo = repo;
private readonly IMediator _mediator;

public DeletePageCommandHandler(IRepository<PageEntity> repo, IMediator mediator)
{
_repo = repo;
_mediator = mediator;
}

public async Task Handle(DeletePageCommand request, CancellationToken ct)
{
var page = await _repo.GetAsync(request.Id, ct);
if (page is null)
{
throw new InvalidOperationException($"PageEntity with Id '{request.Id}' not found.");
}

if (page.CssId != null)
{
await _mediator.Send(new DeleteStyleSheetCommand(new(page.CssId)), ct);
}

public async Task Handle(DeletePageCommand request, CancellationToken ct) =>
await _repo.DeleteAsync(request.Id, ct);
}
}
Loading
Loading