Skip to content

Commit

Permalink
Merge pull request #827 from EdiWang/master
Browse files Browse the repository at this point in the history
v14.11.0
  • Loading branch information
EdiWang authored Oct 9, 2024
2 parents 1e607ea + 98e1bce commit bab4f24
Show file tree
Hide file tree
Showing 72 changed files with 2,330 additions and 627 deletions.
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) 2024 edi.wang@outlook.com</Copyright>
<AssemblyVersion>14.10.0.0</AssemblyVersion>
<FileVersion>14.10.0.0</FileVersion>
<Version>14.10.0</Version>
<AssemblyVersion>14.11.0.0</AssemblyVersion>
<FileVersion>14.11.0.0</FileVersion>
<Version>14.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>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Identity.Web" Version="3.2.0" />
<PackageReference Include="Microsoft.Identity.Web" Version="3.2.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Moonglade.Configuration\Moonglade.Configuration.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/Moonglade.Comments/Moonglade.Comments.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
<ProjectReference Include="..\Moonglade.Configuration\Moonglade.Configuration.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.9.1" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.10.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Moonglade.Core.CategoryFeature;
public class CreateCategoryCommand : IRequest
{
[Required]
[Display(Name = "Display Name")]
[Display(Name = "Display name")]
[MaxLength(64)]
public string DisplayName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.8" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Moonglade.Data\Moonglade.Data.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Moonglade.Data\Moonglade.Data.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/Moonglade.Data/Moonglade.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageReference Include="Ardalis.Specification" Version="8.0.0" />
<PackageReference Include="Ardalis.Specification.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.10" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Moonglade.Utils\Moonglade.Utils.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/Moonglade.Email.Client/Moonglade.Email.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.9.1" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.10.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Moonglade.Configuration\Moonglade.Configuration.csproj" />
Expand Down
2 changes: 2 additions & 0 deletions src/Moonglade.ImageStorage/ImageStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ public class ImageStorageSettings
{
public string[] AllowedExtensions { get; set; }

public int CacheMinutes { get; set; }

public string Provider { get; set; }

public string FileSystemPath { get; set; }
Expand Down
12 changes: 1 addition & 11 deletions src/Moonglade.ImageStorage/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,10 @@

namespace Moonglade.ImageStorage;

public class ImageStorageOptions
{
public string ContentRootPath { get; set; } = Directory.GetCurrentDirectory();
}

public static class ServiceCollectionExtensions
{
private static readonly ImageStorageOptions Options = new();

public static IServiceCollection AddImageStorage(
this IServiceCollection services, IConfiguration configuration, Action<ImageStorageOptions> options)
public static IServiceCollection AddImageStorage(this IServiceCollection services, IConfiguration configuration)
{
options(Options);

var section = configuration.GetSection(nameof(ImageStorage));
var settings = section.Get<ImageStorageSettings>();
services.Configure<ImageStorageSettings>(section);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.9.1" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.10.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Moonglade.Utils\Moonglade.Utils.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<ProjectReference Include="..\Moonglade.Utils\Moonglade.Utils.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.9.1" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.10.0" />
</ItemGroup>
</Project>
4 changes: 1 addition & 3 deletions src/Moonglade.Pingback/PingbackSender.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;
using Moonglade.Utils;

namespace Moonglade.Pingback;

public class PingbackSender(HttpClient httpClient,
IPingbackRequestor requestor,
IConfiguration configuration,
ILogger<PingbackSender> logger)
: IPingbackSender
{
Expand Down
3 changes: 1 addition & 2 deletions src/Moonglade.Web/Controllers/ImageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class ImageController(IBlogImageStorage imageStorage,
IBlogConfig blogConfig,
IMemoryCache cache,
IFileNameGenerator fileNameGen,
IConfiguration configuration,
IOptions<ImageStorageSettings> imageStorageSettings,
CannonService cannonService)
: ControllerBase
Expand Down Expand Up @@ -42,7 +41,7 @@ public async Task<IActionResult> Image([MaxLength(256)] string filename)

var image = await cache.GetOrCreateAsync(filename, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromMinutes(int.Parse(configuration["CacheSlidingExpirationMinutes:Image"]!));
entry.SlidingExpiration = TimeSpan.FromMinutes(_imageStorageSettings.CacheMinutes);
var imageInfo = await imageStorage.GetAsync(filename);
return imageInfo;
});
Expand Down
17 changes: 17 additions & 0 deletions src/Moonglade.Web/Middleware/PrefersColorSchemeMiddleware.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Moonglade.Web.Middleware;

public class PrefersColorSchemeMiddleware(RequestDelegate next)
{
public async Task InvokeAsync(HttpContext context)
{
context.Response.OnStarting(() =>
{
context.Response.Headers["Accept-CH"] = "Sec-CH-Prefers-Color-Scheme";
context.Response.Headers["Vary"] = "Sec-CH-Prefers-Color-Scheme";
context.Response.Headers["Critical-CH"] = "Sec-CH-Prefers-Color-Scheme";
return Task.CompletedTask;
});

await next(context);
}
}
6 changes: 5 additions & 1 deletion src/Moonglade.Web/Moonglade.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@
</ItemGroup>
<ItemGroup>
<Content Update="appsettings.Development.json" CopyToPublishDirectory="Never" />
<Content Update="wwwroot\css\tinymce-custom-dark.css">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Edi.Gravatar" Version="1.1.0" />
<PackageReference Include="Edi.ImageWatermark" Version="2.14.0" />
<PackageReference Include="Edi.PasswordGenerator" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="8.0.10" />

<PackageReference Include="TinyMCE" Version="7.3.0" />
<PackageReference Include="Moonglade.MonacoEditor" Version="0.50.0.1002" />
Expand Down
10 changes: 5 additions & 5 deletions src/Moonglade.Web/Pages/Admin/About.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@SharedLocalizer["Moonglade Configuration"]
</h4>

<div class="mb-4 rounded-3 shadow-sm border bg-white p-2">
<div class="admin-table-container mb-4 rounded-3 shadow-sm border p-2">
<table class="table table-borderless table-sm mb-0">
<tbody>
<tr>
Expand All @@ -30,12 +30,12 @@
</tr>

<tr>
<td>Forwarded Headers</td>
<td>@SharedLocalizer["Forwarded Headers"]</td>
<td class="text-muted">@Configuration["ForwardedHeaders:Enabled"]: @Configuration["ForwardedHeaders:HeaderName"]</td>
</tr>

<tr>
<td>Client IP Address</td>
<td>@SharedLocalizer["Client IP Address"]</td>
<td class="text-muted">@HttpContext.Connection.RemoteIpAddress?.ToString()</td>
</tr>
</tbody>
Expand All @@ -46,7 +46,7 @@
@SharedLocalizer["Server Information"]
</h4>

<div class="mb-4 rounded-3 shadow-sm border bg-white p-2">
<div class="admin-table-container mb-4 rounded-3 shadow-sm border p-2">
<table class="table table-borderless table-sm mb-0">
<tbody>
<tr>
Expand Down Expand Up @@ -124,7 +124,7 @@

<a class="btn btn-sm btn-outline-accent" href="https://github.com/EdiWang/Moonglade/issues" target="_blank">
<i class="bi-bug"></i>
Report an issue
@SharedLocalizer["Report an issue"]
</a>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/Moonglade.Web/Pages/Admin/Comments.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
{
foreach (var item in Model.CommentDetailedItems)
{
<div id="panel-comment-@item.Id" class="p-3 mb-3 rounded-3 shadow-sm border bg-white row g-1">
<div id="panel-comment-@item.Id" class="admin-comment-entry p-3 mb-3 rounded-3 shadow-sm border row g-1">
<div class="form-check col-auto">
<input type="checkbox" class="form-check-input chk-cid" id="comment-item-chk-@item.Id" data-cid="@item.Id" />
<label class="form-check-label" for="comment-item-chk-@item.Id"></label>
Expand Down
2 changes: 1 addition & 1 deletion src/Moonglade.Web/Pages/Admin/Draft.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

@foreach (var post in posts.OrderByDescending(p => p.LastModifiedUtc))
{
<div id="post-@post.Id" class="p-3 mb-2 rounded-3 shadow-sm border bg-white">
<div id="post-@post.Id" class="admin-post-entry p-3 mb-2 rounded-3 shadow-sm border">
<div class="d-flex">
<div class="flex-grow-1">
<a asp-page="./EditPost" asp-route-id="@post.Id">
Expand Down
2 changes: 1 addition & 1 deletion src/Moonglade.Web/Pages/Admin/EditPage.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
</div>
</div>
<div class="col-md-3 col-xl-2">
<div class="p-3 rounded-3 shadow-sm border bg-white mb-4">
<div class="admin-side-options-container p-3 rounded-3 shadow-sm border mb-4">
<div class="mb-3">
<div class="form-check form-switch mb-2">
<input type="checkbox" asp-for="EditPageRequest.HideSidebar" class="form-check-input">
Expand Down
21 changes: 4 additions & 17 deletions src/Moonglade.Web/Pages/Admin/EditPost.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}

@section scripts {
<script src="~/lib/tagify/tagify.min.js"></script>
<script src="~/lib/tagify/tagify.js"></script>
<script src="~/js/3rd/bs-custom-file-input.min.js"></script>
@{
switch (ec)
Expand Down Expand Up @@ -181,23 +181,10 @@
{
<text>
.monaco-target {
border: 1px solid #dee2e6;
border: 1px solid var(--bs-border-color);
width: 100%;
min-height: calc(100vh - 370px);
}
.md-editor-image-upload-area {
border-width: 2px;
border-style: dashed;
}
.md-editor-image-upload-area:focus,
.md-editor-image-upload-area:hover,
.md-editor-image-upload-area.drag-over {
color: var(--bs-warning-text-emphasis) !important;
background-color: var(--bs-warning-bg-subtle) !important;
border-color: var(--bs-warning-border-subtle) !important;
}
</text>
}
</style>
Expand Down Expand Up @@ -250,12 +237,12 @@
<div id="markdown-content-editor" class="monaco-target overflow-y-hidden">
</div>
<textarea asp-for="ViewModel.EditorContent" class="post-content-textarea d-none"></textarea>
<div class="md-editor-image-upload-area text-center border-secondary-subtle bg-light p-3 mt-1">
<div class="md-editor-image-upload-area text-center border-secondary-subtle p-3 mt-1">
Drag &amp; Drop / Paste image here to upload.
</div>
}
<div class="mt-1 bg-white">
<div class="mt-1 admin-taginput-container">
<input type="text" asp-for="ViewModel.Tags" placeholder="@SharedLocalizer["Tags"]" />
</div>
<div class="mt-1">
Expand Down
2 changes: 1 addition & 1 deletion src/Moonglade.Web/Pages/Admin/FriendLink.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<div>
@foreach (var item in Model.Links.OrderBy(m => m.Rank).ThenBy(m => m.Title))
{
<div class="p-3 mb-2 rounded-3 shadow-sm border bg-white">
<div class="friendlink-entry p-3 mb-2 rounded-3 shadow-sm border">
<div id="tr-@item.Id" class="row">
<div class="col">
<h6>
Expand Down
5 changes: 0 additions & 5 deletions src/Moonglade.Web/Pages/Admin/LocalAccount.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@
<i class="bi-key"></i>
@SharedLocalizer["Change Password"]
</a>

<a class="btn btn-outline-accent" href="javascript:alert('coming soon');">
<i class="bi-pass"></i>
@SharedLocalizer["Configure MFA"]
</a>
</div>
}

Expand Down
4 changes: 2 additions & 2 deletions src/Moonglade.Web/Pages/Admin/Mention.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<script>
document.getElementById("mentionFilter").addEventListener("keyup", function () {
var value = this.value.toLowerCase();
var mentionItems = document.querySelectorAll(".mention-item-container");
var mentionItems = document.querySelectorAll(".mention-item-entry");
mentionItems.forEach(function (item) {
var text = item.textContent.toLowerCase();
Expand Down Expand Up @@ -78,7 +78,7 @@
<div class="mentions-container">
@foreach (var item in mentionRecords.OrderByDescending(p => p.PingTimeUtc))
{
<div class="mention-item-container p-3 mb-2 rounded-3 shadow-sm border bg-white">
<div class="mention-item-entry p-3 mb-2 rounded-3 shadow-sm border">
<div id="mention-box-@item.Id" class="mention-item row">
<div class="col">
<strong>
Expand Down
Loading

0 comments on commit bab4f24

Please sign in to comment.