diff --git a/src/Directory.Build.props b/src/Directory.Build.props index a14e0a905..19a11617a 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,8 +3,8 @@ Edi Wang edi.wang (C) 2024 edi.wang@outlook.com - 14.4.0.0 - 14.4.0.0 - 14.4.0 + 14.4.1.0 + 14.4.1.0 + 14.4.1 \ No newline at end of file diff --git a/src/Moonglade.Configuration/BlogConfig.cs b/src/Moonglade.Configuration/BlogConfig.cs index d9660d06e..21d4553b2 100644 --- a/src/Moonglade.Configuration/BlogConfig.cs +++ b/src/Moonglade.Configuration/BlogConfig.cs @@ -1,9 +1,7 @@  namespace Moonglade.Configuration; -public interface IBlogSettings -{ -} +public interface IBlogSettings; public interface IBlogConfig { diff --git a/src/Moonglade.Data.PostgreSql/Moonglade.Data.PostgreSql.csproj b/src/Moonglade.Data.PostgreSql/Moonglade.Data.PostgreSql.csproj index 04c2b5ac3..d28abccfe 100644 --- a/src/Moonglade.Data.PostgreSql/Moonglade.Data.PostgreSql.csproj +++ b/src/Moonglade.Data.PostgreSql/Moonglade.Data.PostgreSql.csproj @@ -10,7 +10,7 @@ enable - + diff --git a/src/Moonglade.Data.SqlServer/Moonglade.Data.SqlServer.csproj b/src/Moonglade.Data.SqlServer/Moonglade.Data.SqlServer.csproj index 4e2a69f1a..620b2b737 100644 --- a/src/Moonglade.Data.SqlServer/Moonglade.Data.SqlServer.csproj +++ b/src/Moonglade.Data.SqlServer/Moonglade.Data.SqlServer.csproj @@ -10,7 +10,7 @@ enable - + diff --git a/src/Moonglade.Data/Moonglade.Data.csproj b/src/Moonglade.Data/Moonglade.Data.csproj index 895414053..8c193d884 100644 --- a/src/Moonglade.Data/Moonglade.Data.csproj +++ b/src/Moonglade.Data/Moonglade.Data.csproj @@ -17,6 +17,9 @@ - + + + + \ No newline at end of file diff --git a/src/Moonglade.Data/Seed.cs b/src/Moonglade.Data/Seed.cs index d96db321b..57b9b3bcc 100644 --- a/src/Moonglade.Data/Seed.cs +++ b/src/Moonglade.Data/Seed.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.Logging; using Moonglade.Data.Entities; +using Moonglade.Utils; namespace Moonglade.Data; @@ -46,12 +47,15 @@ public static async Task SeedAsync(BlogDbContext dbContext, ILogger logger, int LastModifiedUtc = DateTime.UtcNow, PubDateUtc = DateTime.UtcNow, ContentLanguageCode = "en-us", - HashCheckSum = -1688639577, IsOriginal = true, Tags = dbContext.Tag.ToList(), PostCategory = dbContext.PostCategory.ToList() }; + var input = $"{post.Slug}#{post.PubDateUtc.GetValueOrDefault():yyyyMMdd}"; + var checkSum = Helper.ComputeCheckSum(input); + post.HashCheckSum = checkSum; + await dbContext.Post.AddAsync(post); await dbContext.SaveChangesAsync(); diff --git a/src/Moonglade.Data/Specifications/BlogConfigurationSpec.cs b/src/Moonglade.Data/Specifications/BlogConfigurationSpec.cs index fef63e7e2..59a31fdad 100644 --- a/src/Moonglade.Data/Specifications/BlogConfigurationSpec.cs +++ b/src/Moonglade.Data/Specifications/BlogConfigurationSpec.cs @@ -2,7 +2,7 @@ namespace Moonglade.Data.Specifications; -public class BlogConfigurationSpec : SingleResultSpecification +public sealed class BlogConfigurationSpec : SingleResultSpecification { public BlogConfigurationSpec(string cfgKey) { diff --git a/src/Moonglade.Data/Specifications/BlogThemeForIdNameSpec.cs b/src/Moonglade.Data/Specifications/BlogThemeForIdNameSpec.cs index 608cebd03..59d7fda81 100644 --- a/src/Moonglade.Data/Specifications/BlogThemeForIdNameSpec.cs +++ b/src/Moonglade.Data/Specifications/BlogThemeForIdNameSpec.cs @@ -2,7 +2,7 @@ namespace Moonglade.Data.Specifications; -public class BlogThemeForIdNameSpec : Specification +public sealed class BlogThemeForIdNameSpec : Specification { public BlogThemeForIdNameSpec() { diff --git a/src/Moonglade.Data/Specifications/CategoryBySlugSpec.cs b/src/Moonglade.Data/Specifications/CategoryBySlugSpec.cs index 4a141933f..ef9b23d18 100644 --- a/src/Moonglade.Data/Specifications/CategoryBySlugSpec.cs +++ b/src/Moonglade.Data/Specifications/CategoryBySlugSpec.cs @@ -2,7 +2,7 @@ namespace Moonglade.Data.Specifications; -public class CategoryBySlugSpec : SingleResultSpecification +public sealed class CategoryBySlugSpec : SingleResultSpecification { public CategoryBySlugSpec(string slug) { diff --git a/src/Moonglade.Data/Specifications/PageBySlugSpec.cs b/src/Moonglade.Data/Specifications/PageBySlugSpec.cs index 52b7efb66..add2f4a90 100644 --- a/src/Moonglade.Data/Specifications/PageBySlugSpec.cs +++ b/src/Moonglade.Data/Specifications/PageBySlugSpec.cs @@ -2,7 +2,7 @@ namespace Moonglade.Data.Specifications; -public class PageBySlugSpec : SingleResultSpecification +public sealed class PageBySlugSpec : SingleResultSpecification { public PageBySlugSpec(string slug) { diff --git a/src/Moonglade.Data/Specifications/PingbackReadOnlySpec.cs b/src/Moonglade.Data/Specifications/PingbackReadOnlySpec.cs index 7fd89158c..5bb80f712 100644 --- a/src/Moonglade.Data/Specifications/PingbackReadOnlySpec.cs +++ b/src/Moonglade.Data/Specifications/PingbackReadOnlySpec.cs @@ -2,7 +2,7 @@ namespace Moonglade.Data.Specifications; -public class PingbackReadOnlySpec : Specification +public sealed class PingbackReadOnlySpec : Specification { public PingbackReadOnlySpec() { diff --git a/src/Moonglade.Data/Specifications/PostTagSpec.cs b/src/Moonglade.Data/Specifications/PostTagSpec.cs index 9e2eca9c4..ef8267b95 100644 --- a/src/Moonglade.Data/Specifications/PostTagSpec.cs +++ b/src/Moonglade.Data/Specifications/PostTagSpec.cs @@ -17,7 +17,7 @@ public PostTagSpec(int tagId, int pageSize, int pageIndex) } } -public class PostTagByTagIdSpec : SingleResultSpecification +public sealed class PostTagByTagIdSpec : SingleResultSpecification { public PostTagByTagIdSpec(int tagId) { diff --git a/src/Moonglade.ImageStorage/Moonglade.ImageStorage.csproj b/src/Moonglade.ImageStorage/Moonglade.ImageStorage.csproj index f1a2aa6d2..bf889b7d7 100644 --- a/src/Moonglade.ImageStorage/Moonglade.ImageStorage.csproj +++ b/src/Moonglade.ImageStorage/Moonglade.ImageStorage.csproj @@ -10,7 +10,7 @@ - + \ No newline at end of file diff --git a/src/Moonglade.ImageStorage/RegularFileNameGenerator.cs b/src/Moonglade.ImageStorage/RegularFileNameGenerator.cs deleted file mode 100644 index b959c2847..000000000 --- a/src/Moonglade.ImageStorage/RegularFileNameGenerator.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace Moonglade.ImageStorage; - -public class RegularFileNameGenerator : IFileNameGenerator -{ - public string Name => nameof(RegularFileNameGenerator); - - public string GetFileName(string fileName, string appendixName = "") - { - if (string.IsNullOrWhiteSpace(fileName)) - { - throw new ArgumentNullException(nameof(fileName)); - } - - var ext = Path.GetExtension(fileName); - if (string.IsNullOrEmpty(ext) || - string.IsNullOrWhiteSpace(Path.GetFileNameWithoutExtension(fileName))) - { - throw new ArgumentException("Invalid File Name", nameof(fileName)); - } - - var uniqueId = DateTime.Now.ToString("yyMMdd") + Guid.NewGuid().ToString("N")[..6]; - - var newFileName = $"img-{uniqueId}{(string.IsNullOrWhiteSpace(appendixName) ? string.Empty : "-" + appendixName)}{ext}".ToLower(); - return newFileName; - } -} \ No newline at end of file diff --git a/src/Moonglade.Utils/Helper.cs b/src/Moonglade.Utils/Helper.cs index 28f492cfb..fb358ffba 100644 --- a/src/Moonglade.Utils/Helper.cs +++ b/src/Moonglade.Utils/Helper.cs @@ -89,7 +89,7 @@ public static string TryGetFullOSVersion() if (currentVersion != null) { var name = currentVersion.GetValue("ProductName", "Microsoft Windows NT"); - var ubr = currentVersion.GetValue("UBR", string.Empty)?.ToString(); + var ubr = currentVersion.GetValue("UBR", string.Empty).ToString(); if (!string.IsNullOrWhiteSpace(ubr)) { return $"{name} {osVer.Version.Major}.{osVer.Version.Minor}.{osVer.Version.Build}.{ubr}"; diff --git a/src/Moonglade.Web/Moonglade.Web.csproj b/src/Moonglade.Web/Moonglade.Web.csproj index d530fc6cd..4d41b6ad1 100644 --- a/src/Moonglade.Web/Moonglade.Web.csproj +++ b/src/Moonglade.Web/Moonglade.Web.csproj @@ -38,7 +38,7 @@ - + diff --git a/src/Moonglade.Web/Pages/_CommentForm.cshtml b/src/Moonglade.Web/Pages/_CommentForm.cshtml index 7ff1162f3..a09197f83 100644 --- a/src/Moonglade.Web/Pages/_CommentForm.cshtml +++ b/src/Moonglade.Web/Pages/_CommentForm.cshtml @@ -16,7 +16,7 @@ id="input-comment-email" /> - * @SharedLocalizer["Enter your email to receive reply notifications and display your Gravatar"] + * @SharedLocalizer["Enter your email to receive reply notifications and display your Gravatar. Your email will not be displayed publicly."]