-
Notifications
You must be signed in to change notification settings - Fork 138
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
v14.19.0 #854
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updated README.md to include a new section under "Deployment Options" informing users that Moonglade will operate in read-only mode when deployed in China due to regulatory concerns. Users in China are advised to consider using a different blogging platform.
- Updated `AzureBlobConfiguration` to include an optional `secondaryContainerName` parameter. - Added `SecondaryContainerName` property to `AzureStorageSettings`. - Modified `AddAzureStorage` method to pass `SecondaryContainerName` to `AzureBlobConfiguration`. - Updated `appsettings.json` to include `SecondaryContainerName` field under `AzureStorageSettings`.
Updated IBlogImageStorage interface to include InsertSecondaryAsync. Modified AzureBlobImageStorage to initialize _container via CreateContainer. Added InsertSecondaryAsync to AzureBlobImageStorage, FileSystemImageStorage, and MinioBlobImageStorage, all currently throwing NotImplementedException.
- Change `_container` to private readonly and add `_secondaryContainer` - Update constructor to initialize containers with `InitializeContainer` - Replace `CreateContainer` with `InitializeContainer` for logging - Add `InsertAsync` and `InsertSecondaryAsync` for image insertion - Add `InsertInternalAsync` for common insertion logic - Move content type logic to `GetContentType` - Update `DeleteAsync` and `GetAsync` with checks and logging - Improve log message consistency and clarity - Add `ConfigureAwait(false)` to async calls
Replaced the `InsertAsync` method with `InsertSecondaryAsync` in the `StoreOriginalImageAsync` method of the `ImageController` class. This change updates the way images are inserted into storage, reflecting a shift in the `IBlogImageStorage` implementation.
Updated the `Directory.Build.props` file: - `AssemblyVersion` updated from `14.18.0` to `14.19.0` - `FileVersion` updated from `14.18.0` to `14.19.0` - `Version` updated from `14.18.0` to `14.19.0-preview` These changes indicate a new release and a preview version.
The InsertSecondaryAsync method was changed from an unimplemented method that threw a NotImplementedException to a method that calls InsertAsync with the provided fileName and imageBytes parameters. This change allows InsertSecondaryAsync to function correctly by leveraging the existing InsertAsync method.
Updated MinioBlobConfiguration to include optional secondaryBucketName and withSSL parameters. Added SecondaryBucketName property to MinioStorageSettings. Modified ServiceCollectionExtensions to pass SecondaryBucketName to MinioBlobConfiguration. Updated appsettings.json to include SecondaryBucketName setting.
Added a new private readonly field `_secondaryBucketName` to the `MinioBlobImageStorage` class. This field is initialized in the constructor using the `SecondaryBucketName` property from the `blobConfiguration` parameter, similar to how `_bucketName` is set.
Refactored InsertAsync to use a new internal method, InsertInternalAsync, which takes a bucket name as a parameter. Added InsertSecondaryAsync to handle insertion into a secondary bucket, logging an error if the secondary bucket name is not configured. Introduced InsertInternalAsync to encapsulate common insertion logic, ensuring the bucket exists and uploading the image. Removed the previous InsertSecondaryAsync method that threw a NotImplementedException. Updated PutObjectArgs in InsertInternalAsync to use the bucketName parameter for dynamic bucket selection.
- Conditionally initialize `_secondaryContainer` in the constructor only if `SecondaryContainerName` is provided. - Add a null check in `InsertSecondaryAsync` to log an error and return null if `_secondaryContainer` is not configured.
Added a line of text to inform users about configuring `SecondaryContainerName` or `SecondaryBucketName` in `appsettings.json`. Changed the column width class from `col-5` to `col-3` for the text-end div.
Modified the import statement for the `utils` module to import only the `toMagicJson` function instead of importing all exports. Updated the `handleSettingsSubmit` function to directly use the `toMagicJson` function.
Modified import statement to import only getPreferredTheme from themeService.mjs. Updated loadTinyMCE function to use getPreferredTheme directly.
The `deletePost` and `restorePost` functions were moved from the bottom to the top of the `admin.recyclebin.mjs` file, right after the import statements. The functionality of these functions remains unchanged.
Modified `setTheme` in `themeService.mjs` to always call `setStoredTheme(theme)`, even when the theme is 'auto'. Removed `localStorage.removeItem('theme')` from the 'auto' theme condition. This change ensures consistent tracking of user theme preferences.
Added an event listener for changes in the user's color scheme preference using `window.matchMedia('(prefers-color-scheme: dark)')`. When the color scheme preference changes, it checks if the preferred theme is set to 'auto' and, if so, calls the `setTheme` function with 'auto' as the argument. This ensures the theme dynamically updates based on the user's system preferences.
Refactored `setStoredTheme` for parameter consistency. Simplified `getPreferredTheme` to return 'auto' if no stored theme is found. Introduced `applyTheme` to centralize theme application logic. Refactored `setTheme` to use `applyTheme`. Moved event listener logic into `handleThemeSelection`. Consolidated initialization logic into `initializeTheme`, which is now called on `DOMContentLoaded`. Simplified system theme preference handling within `initializeTheme`.
Added a new block in mssql-migration.sql to check if the 'Revision' column exists in the 'Post' table within INFORMATION_SCHEMA.COLUMNS. If it exists, the script will drop the 'Revision' column, similar to the existing logic for the 'Id' column in the 'BlogConfiguration' table.
The code first checks if the column 'Revision' exists in the table '[dbo].[Post]'. If it does, the column is dropped. The code then checks if the table '[dbo].[PostView]' does not exist. If it does not exist, the code creates the table '[dbo].[PostView]' with the following columns: * 'PostId' of type 'uniqueidentifier' which is not nullable. * 'RequestCount' of type 'int' which is not nullable. * 'ViewCount' of type 'int' which is not nullable. The table '[dbo].[PostView]' is created with a primary key constraint on the 'PostId' column, and various table options are set for the primary key.
- Added DbSet<PostViewEntity> to BlogDbContext to manage PostViewEntity objects. - Updated ClearAllData method in BlogDbContextExtension to clear PostView data. - Created PostViewEntity class with PostId, RequestCount, and ViewCount properties.
Introduce AddRequestCountCommand and its handler in Moonglade.Core.PostFeature. - Define AddRequestCountCommand to handle PostId and implement IRequest<int>. - Implement AddRequestCountCommandHandler to manage request counts. - Use MoongladeRepository<PostViewEntity> for data operations. - Add logging for new requests and updates to request counts.
Added BeginTimeUtc column to PostView table in mssql-migration.sql. Updated AddRequestCountCommandHandler to set BeginTimeUtc to current UTC time when creating a new PostViewEntity. Added BeginTimeUtc property to PostViewEntity class.
The PostModel class now includes an IMediator parameter for handling requests and commands. After retrieving the post using GetPostBySlugQuery, an AddRequestCountCommand is sent to increment the request count for the post. The assignment to ViewData["TitlePrefix"] has been moved to use the Post property instead of the local post variable. Additionally, the return Page(); statement has been moved to a new line for better readability.
Updated the AddAsync method of the postViewRepo object to include an additional parameter, cancellationToken. This change improves the method's ability to handle task cancellation during asynchronous operations.
Updated the GetByIdAsync method call on the postViewRepo object to include a cancellationToken parameter. This change enhances the responsiveness and robustness of the code by allowing the operation to be canceled if needed, improving performance and reliability in long-running or abortable scenarios.
Introduce a ConcurrentDictionary to manage locks for each PostId, ensuring thread-safe request handling. Add a static ConcurrentDictionary<Guid, SemaphoreSlim> named _locks to store locks. Update the Handle method to use SemaphoreSlim for locking and ensure locks are released in a finally block. Catch and log exceptions, returning -1 on failure. Update logging statements to reflect the new structure.
Updated the UpdateAsync method call on the postViewRepo object to include a cancellationToken parameter. This change improves the method's responsiveness to cancellation requests, allowing the update operation to be canceled if needed. The rest of the code remains unchanged, maintaining the logging of information before and after the update operation.
Introduce AddViewCountCommand and AddViewCountCommandHandler to handle view count updates for posts. Add necessary namespaces for logging, data access, and concurrency. Implement concurrency control using ConcurrentDictionary and SemaphoreSlim. Handle exceptions and log updates.
Introduce PostViewController in Moonglade.Web.Controllers. Decorate with [Route("api/[controller]")] and [ApiController]. Inherit from ControllerBase for API functionality. Add using directives for ASP.NET Core support.
- Added semicolon to `callApi` import statement. - Introduced constants for expiration and timeout values. - Updated `cleanupLocalStorage`: - Replaced hardcoded values with constants. - Used `Date.now()` for current time. - Improved `forEach` loop with arrow function. - Added error handling for JSON parsing. - Refactored `recordPostView`: - Added constant for interaction timeout. - Separated event listener functions for clarity. - Used shorthand property names in `callApi`. - Added fallback to remove listeners after timeout.
Moved calculateReadingTime to post.readingtime.mjs for better modularity. Enhanced function with support for multiple languages (English, German, Chinese, Japanese) and improved structure. Updated DOMContentLoaded event listener in post.mjs to use the new function. Added validation for empty/invalid input, constants for reading speeds, and regex patterns for efficiency. Reading time now rounds up to the nearest minute.
Moved `resizeImages`, `applyImageZooming`, and `getImageWidthInDevicePixelRatio` from `post.mjs` to `post.imageutils.mjs`. Updated `resizeImages` and `applyImageZooming` to accept a `selector` parameter. Imported `parseMetaContent` into `post.imageutils.mjs` for use in `applyImageZooming`. Updated `post.mjs` to use the new module and pass the selector `'.post-content img'`. Adjusted `DOMContentLoaded` event listener accordingly.
Changed the version tag in the `Directory.Build.props` file from `14.19.0-preview` to `14.19.0-beta`, indicating a progression from a preview release to a beta release in the software development lifecycle.
Updated the Microsoft.Identity.Web package from version 3.6.1 to 3.6.2 in the Moonglade.Auth.csproj file to ensure compatibility and include the latest fixes and improvements.
Upgraded the TinyMCE package from version 7.6.0 to 7.6.1 in the Moonglade.Web.csproj file. This update likely includes bug fixes, new features, or other improvements.
The `renderLaTeX` function has been moved from `post.mjs` to `post.highlight.mjs` and refactored to accept a `selector` parameter for more flexible usage. The call to `renderLaTeX` in `post.mjs` has been updated to pass the selector `'pre.language-latex code'`. The `renderCodeHighlighter` function in `post.mjs` no longer includes the `renderLaTeX` call. The import statements in `post.mjs` have been updated accordingly.
Moved `renderCodeHighlighter` to `post.highlight.mjs` and enhanced it to wrap `<pre>` contents, add `lang-xml` class, and use `hljs.highlightElement`. Updated `post.mjs` to import `renderCodeHighlighter` and `renderLaTeX` from `post.highlight.mjs`.
Streamlined and updated the list of bot user agents: - Removed "Google Page Speed" - Replaced "DuckDuckGo-Favicons-Bot" with "DuckDuckGo" - Removed "Slack-ImgProxy" - Replaced "Slackbot" with "Slack" These changes reflect more current or accurate bot names.
The `PostModel` class now includes a `PostView` property of type `PostViewEntity`. In the `OnGetAsync` method, after setting the `Post` property and updating the `ViewData["TitlePrefix"]`, a new line has been added to fetch the `PostView` data using the `mediator` and the `GetPostViewQuery` with the `post.Id` as a parameter. This ensures that the view has all necessary information when the page is rendered.
Introduced a conditional block to display the view count of a post if the `PostView` model is not null. This includes rendering an eye icon and the view count incremented by 1 within a new HTML span element, positioned after the reading time span.
Enhanced the UI by adding a `title` attribute to the `span` element with `id="view-count"`. This tooltip provides additional information about the post's view statistics, including the number of requests, total reads, and start time in UTC. The `title` attribute is dynamically populated using `Model.PostView` properties.
Updated PostViewController and PostModel to include IConfiguration dependency for reading configuration settings. Introduced a new private field `_isEnabled` in PostViewController and a new property `IsViewCountEnabled` in PostModel to check if the view count feature is enabled. Modified AddViewCount method to return NotFound if the feature is disabled. Updated Post.cshtml view to conditionally display view count based on `IsViewCountEnabled`. Added `EnableViewCount` setting in appsettings.json.
Refactor code to use Configuration.GetValue<EditorChoice>("Post:Editor") instead of Configuration.GetSection("Post:Editor").Get<EditorChoice>(). This change makes the code more concise and potentially more efficient.
Updated configuration retrieval in `Program.cs` and `WebApplicationExtensions.cs` to use `GetValue<T>()` instead of `GetSection().Get<T>()`. This change simplifies the code and makes it more concise, specifically for boolean values and arrays of strings.
The version number in the Directory.Build.props file has been updated from 14.19.0-beta to 14.19.0-rc.1, indicating a transition from beta to release candidate as the software approaches final release.
Updated CreatePostCommand.cs and EditPost.cshtml to use configuration.GetValue<EditorChoice>("Post:Editor") instead of configuration.GetSection("Post:Editor").Get<EditorChoice>(). This change simplifies the retrieval process and makes the code more concise.
Updated `UpdatePostCommand.cs` and `SyndicationDataSource.cs` to use `GetValue<EditorChoice>("Post:Editor")` instead of `GetSection("Post:Editor").Get<EditorChoice>()`. This change streamlines the code, improving readability and maintainability.
Updated the `UseServerSideDarkMode` method in the `Helper` class to use `configuration.GetValue<bool>("PrefersColorSchemeHeader:Enabled")` instead of the more verbose `configuration.GetSection("PrefersColorSchemeHeader:Enabled").Get<bool>()`. This change enhances code readability and maintainability by simplifying the retrieval of the configuration value.
Changed the method of retrieving the "Editor" configuration value in About.cshtml from using Configuration.GetSection("Post:Editor").Get<EditorChoice>() to Configuration.GetValue<EditorChoice>("Post:Editor"). This change simplifies the code by directly using the GetValue method.
…ionExtension Modified IndexNowClient.cs and ServiceCollectionExtension.cs to use configuration.GetValue<string[]>("IndexNow:PingTargets") instead of configuration.GetSection("IndexNow:PingTargets").Get<string[]>() for retrieving PingTargets. This change makes the code more concise and easier to maintain.
Updated the way the `EditorChoice` configuration value is retrieved. Instead of using `Configuration.GetSection("Post:Editor").Get<EditorChoice>()`, it now uses `Configuration.GetValue<EditorChoice>("Post:Editor")`. This change simplifies the retrieval process by directly getting the value of the specified type from the configuration.
Extracted indexing logic into new ProcessIndexing method for better readability and separation of concerns. Updated using directives to include Moonglade.Data.Entities. Added TypeFilter attribute to apply ClearBlogCache filter with specific BlogCacheType arguments.
Updated ProcessIndexing in PostController to accept a boolean isNewPublish instead of a PostEntity object. Moved the logic to determine isNewPublish to the calling method, which checks if postEntity.LastModifiedUtc equals postEntity.PubDateUtc. Updated method signature and removed internal logic for determining isNewPublish.
Moved Pingback and Webmention logic to `NotifyExternalServices` method in `PostController` for better readability and maintainability. Removed inline code from the main method and replaced it with a call to the new method, passing necessary parameters.
Changed the retrieval of `pingTargets` from `GetValue<string[]>("PingTargets")` to `GetSection("PingTargets").Get<string[]>()`. Added a null check to return the `services` object immediately if `pingTargets` is null.
Updated the method of retrieving the knownProxies configuration value. Replaced app.Configuration.GetValue<string[]> with app.Configuration.GetSection().Get<string[]> to improve the way the configuration section is accessed and parsed into an array of strings. This change ensures correct configuration access and parsing, potentially fixing related issues.
Updated the method of retrieving the _pingTargets array from the configuration. Instead of using `configuration.GetValue<string[]>("IndexNow:PingTargets")`, the code now uses `configuration.GetSection("IndexNow:PingTargets").Get<string[]>()`. This change ensures the configuration section is properly accessed and converted to a string array, providing more robust handling of the configuration settings.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.