Skip to content

Commit

Permalink
Merge pull request #727 from EdiWang/master
Browse files Browse the repository at this point in the history
Release v12.11.0
  • Loading branch information
EdiWang authored Jun 15, 2023
2 parents 3864f29 + a4b36ee commit 2aaa52a
Show file tree
Hide file tree
Showing 106 changed files with 521 additions and 1,286 deletions.
2 changes: 1 addition & 1 deletion Deployment/AzureQuickDeploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ $storageAccountCheck = az storage account list --query "[?name=='$storageAccount
$storageAccountExists = $storageAccountCheck.Length -gt 0
if (!$storageAccountExists) {
Write-Host "Creating Storage Account"
$echo = az storage account create --name $storageAccountName --resource-group $rsgName --location $regionName --sku Standard_LRS --kind --allow-blob-public-access true StorageV2
$echo = az storage account create --name $storageAccountName --resource-group $rsgName --location $regionName --sku Standard_LRS --kind StorageV2 --allow-blob-public-access true
}

$storageConn = az storage account show-connection-string -g $rsgName -n $storageAccountName | ConvertFrom-Json
Expand Down
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.10.1.0</AssemblyVersion>
<FileVersion>12.10.1.0</FileVersion>
<Version>12.10.1</Version>
<AssemblyVersion>12.11.0.0</AssemblyVersion>
<FileVersion>12.11.0.0</FileVersion>
<Version>12.11.0</Version>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Moonglade.Auth/Moonglade.Auth.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />

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

<ItemGroup>
Expand Down
100 changes: 0 additions & 100 deletions src/Moonglade.Caching/BlogMemoryCache.cs

This file was deleted.

63 changes: 0 additions & 63 deletions src/Moonglade.Caching/Filters/ClearBlogCache.cs

This file was deleted.

12 changes: 0 additions & 12 deletions src/Moonglade.Caching/IBlogCache.cs

This file was deleted.

12 changes: 0 additions & 12 deletions src/Moonglade.Caching/Moonglade.Caching.csproj

This file was deleted.

13 changes: 0 additions & 13 deletions src/Moonglade.Caching/ServiceCollectionExtensions.cs

This file was deleted.

3 changes: 0 additions & 3 deletions src/Moonglade.Configuration/AdvancedSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public class AdvancedSettings : IBlogSettings
[Display(Name = "Show warning when clicking external links")]
public bool WarnExternalLink { get; set; }

[Display(Name = "Allow javascript in pages")]
public bool AllowScriptsInPage { get; set; }

public string MetaWeblogPasswordHash { get; set; }

[JsonIgnore]
Expand Down
6 changes: 0 additions & 6 deletions src/Moonglade.Configuration/GeneralSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ public class GeneralSettings : IBlogSettings
[MaxLength(256)]
public string Description { get; set; }

[Required]
[Display(Name = "Short description")]
[MaxLength(32)]
public string ShortDescription { get; set; }

[Display(Name = "Side bar HTML code")]
[DataType(DataType.MultilineText)]
[MaxLength(2048)]
Expand Down Expand Up @@ -118,7 +113,6 @@ public class GeneralSettings : IBlogSettings
OwnerEmail = "admin@edi.wang",
SiteTitle = "Moonglade",
Description = "Moonglade Admin",
ShortDescription = "Moonglade Admin",
AutoDarkLightTheme = true,
LogoText = "moonglade",
MetaKeyword = "moonglade",
Expand Down
12 changes: 12 additions & 0 deletions src/Moonglade.Core/BlogCachePartition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Moonglade.Core;

public enum BlogCachePartition
{
General,
Post,
Page,
PostCountCategory,
PostCountTag,
PostCountFeatured,
RssCategory
}
8 changes: 4 additions & 4 deletions src/Moonglade.Core/CategoryFeature/CreateCategoryCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Moonglade.Caching;
using Edi.CacheAside.InMemory;
using System.ComponentModel.DataAnnotations;

namespace Moonglade.Core.CategoryFeature;
Expand All @@ -25,9 +25,9 @@ public class CreateCategoryCommand : IRequest
public class CreateCategoryCommandHandler : IRequestHandler<CreateCategoryCommand>
{
private readonly IRepository<CategoryEntity> _catRepo;
private readonly IBlogCache _cache;
private readonly ICacheAside _cache;

public CreateCategoryCommandHandler(IRepository<CategoryEntity> catRepo, IBlogCache cache)
public CreateCategoryCommandHandler(IRepository<CategoryEntity> catRepo, ICacheAside cache)
{
_catRepo = catRepo;
_cache = cache;
Expand All @@ -47,6 +47,6 @@ public async Task Handle(CreateCategoryCommand request, CancellationToken ct)
};

await _catRepo.AddAsync(category, ct);
_cache.Remove(CacheDivision.General, "allcats");
_cache.Remove(BlogCachePartition.General.ToString(), "allcats");
}
}
8 changes: 4 additions & 4 deletions src/Moonglade.Core/CategoryFeature/DeleteCategoryCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Moonglade.Caching;
using Edi.CacheAside.InMemory;
using Moonglade.Data;

namespace Moonglade.Core.CategoryFeature;
Expand All @@ -9,12 +9,12 @@ public class DeleteCategoryCommandHandler : IRequestHandler<DeleteCategoryComman
{
private readonly IRepository<CategoryEntity> _catRepo;
private readonly IRepository<PostCategoryEntity> _postCatRepo;
private readonly IBlogCache _cache;
private readonly ICacheAside _cache;

public DeleteCategoryCommandHandler(
IRepository<CategoryEntity> catRepo,
IRepository<PostCategoryEntity> postCatRepo,
IBlogCache cache)
ICacheAside cache)
{
_catRepo = catRepo;
_postCatRepo = postCatRepo;
Expand All @@ -30,7 +30,7 @@ public async Task<OperationCode> Handle(DeleteCategoryCommand request, Cancellat
if (pcs is not null) await _postCatRepo.DeleteAsync(pcs, ct);

await _catRepo.DeleteAsync(request.Id, ct);
_cache.Remove(CacheDivision.General, "allcats");
_cache.Remove(BlogCachePartition.General.ToString(), "allcats");

return OperationCode.Done;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Moonglade.Core/CategoryFeature/GetCategoriesQuery.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Moonglade.Caching;
using Edi.CacheAside.InMemory;

namespace Moonglade.Core.CategoryFeature;

Expand All @@ -7,17 +7,17 @@ public record GetCategoriesQuery : IRequest<IReadOnlyList<Category>>;
public class GetCategoriesQueryHandler : IRequestHandler<GetCategoriesQuery, IReadOnlyList<Category>>
{
private readonly IRepository<CategoryEntity> _repo;
private readonly IBlogCache _cache;
private readonly ICacheAside _cache;

public GetCategoriesQueryHandler(IRepository<CategoryEntity> repo, IBlogCache cache)
public GetCategoriesQueryHandler(IRepository<CategoryEntity> repo, ICacheAside cache)
{
_repo = repo;
_cache = cache;
}

public Task<IReadOnlyList<Category>> Handle(GetCategoriesQuery request, CancellationToken ct)
{
return _cache.GetOrCreateAsync(CacheDivision.General, "allcats", async entry =>
return _cache.GetOrCreateAsync(BlogCachePartition.General.ToString(), "allcats", async entry =>
{
entry.SlidingExpiration = TimeSpan.FromHours(1);
var list = await _repo.SelectAsync(Category.EntitySelector, ct);
Expand Down
8 changes: 4 additions & 4 deletions src/Moonglade.Core/CategoryFeature/UpdateCategoryCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Moonglade.Caching;
using Edi.CacheAside.InMemory;
using Moonglade.Data;

namespace Moonglade.Core.CategoryFeature;
Expand All @@ -11,9 +11,9 @@ public class UpdateCategoryCommand : CreateCategoryCommand, IRequest<OperationCo
public class UpdateCategoryCommandHandler : IRequestHandler<UpdateCategoryCommand, OperationCode>
{
private readonly IRepository<CategoryEntity> _repo;
private readonly IBlogCache _cache;
private readonly ICacheAside _cache;

public UpdateCategoryCommandHandler(IRepository<CategoryEntity> repo, IBlogCache cache)
public UpdateCategoryCommandHandler(IRepository<CategoryEntity> repo, ICacheAside cache)
{
_repo = repo;
_cache = cache;
Expand All @@ -29,7 +29,7 @@ public async Task<OperationCode> Handle(UpdateCategoryCommand request, Cancellat
cat.Note = request.Note?.Trim();

await _repo.UpdateAsync(cat, ct);
_cache.Remove(CacheDivision.General, "allcats");
_cache.Remove(BlogCachePartition.General.ToString(), "allcats");

return OperationCode.Done;
}
Expand Down
Loading

0 comments on commit 2aaa52a

Please sign in to comment.