Commit 99cd897
authored
Update and cleanup (#200)
* Cleaned and commented.
modified: src/BlogSettings.cs
modified: src/Controllers/AccountController.cs
modified: src/Controllers/BlogController.cs
modified: src/Controllers/RobotsController.cs
modified: src/Controllers/SharedController.cs
modified: src/Models/Comment.cs
modified: src/Models/LoginViewModel.cs
modified: src/Models/Post.cs
modified: src/PostListView.cs
modified: src/Services/BlogUserServices.cs
modified: src/Services/FileBlogService.cs
modified: src/Services/IBlogService.cs
modified: src/Services/IUserServices.cs
modified: src/Services/InMemoryBlogServiceBase.cs
modified: src/Services/MetaWeblogService.cs
modified: src/Startup.cs
* Removed auto-gen docs
modified: src/BlogSettings.cs
modified: src/Controllers/AccountController.cs
modified: src/Controllers/BlogController.cs
modified: src/Controllers/RobotsController.cs
modified: src/Controllers/SharedController.cs
modified: src/Models/LoginViewModel.cs
modified: src/PostListView.cs
modified: src/Services/FileBlogService.cs
modified: src/Services/IUserServices.cs
* Fix some ConfigureAwait issues introduced earlier, add some constants/resources, change index view to use IAsyncEnumerable foreach and modify controller accordingly.
modified: src/Controllers/BlogController.cs
modified: src/Controllers/RobotsController.cs
modified: src/Models/Comment.cs
modified: src/Models/Post.cs
modified: src/Services/FileBlogService.cs
modified: src/Services/IBlogService.cs
modified: src/Services/InMemoryBlogServiceBase.cs
modified: src/Services/MetaWeblogService.cs
modified: src/Startup.cs
modified: src/Views/Shared/_Layout.cshtml
modified: src/appsettings.json
* Update solution and localization files for VS 17.0
- Updated `Miniblog.Core.sln` to Visual Studio version 17.0 and added new global properties for RESX synchronization.
- Created new XLIFF files for localization in `en-CA`, `en-GB`, `es-US`, `fr-CA`, and `fr-FR`, enhancing multilingual support.
- Updated `Resources.Designer.cs` to reflect the new StronglyTypedResourceBuilder version.
- Modified `.resx` files to include a new XML schema and updated resource entries for compatibility with the latest standards.
* Update package references and resource settings
Upgraded versions of several packages in `Miniblog.Core.csproj`, including `JavaScriptEngineSwitcher.V8`, `LigerShark.WebOptimizer.Core`, `Microsoft.ClearScript.V8.Native.win-x64`, and `WebMarkupMin.AspNetCoreLatest`. Changed the `CopyToOutputDirectory` property for `Properties\Resources.resx` from `Always` to `PreserveNewest`.
* Refactor .NET application and update configurations
- Updated `.editorconfig` for coding styles and preferences.
- Refactored classes in `BlogSettings.cs`, `Constants.cs`, and `AccountController.cs` for improved readability and maintainability.
- Modified `Miniblog.Core.csproj` to enable .NET analyzers and enforce code style.
- Enhanced `FileBlogService.cs` and `MetaWeblogService.cs` for better handling of posts, categories, and tags.
- Updated `Startup.cs` for service and middleware configuration, including output caching and authentication.
- Added `workload-install.ps1` script for installing Tizen workload manifests.
- General code structure improvements, including expression-bodied members and better null handling.
* Remove Microsoft.CodeAnalysis.NetAnalyzers package
This commit removes the `Microsoft.CodeAnalysis.NetAnalyzers` package reference from the `Miniblog.Core.csproj` file. The package was previously included with version `9.0.0` and had specific asset inclusion settings, which are no longer needed in the project.
* Add log level for Microsoft.AspNetCore in settings
Updated appsettings.Development.json and appsettings.json
to include a new log level for Microsoft.AspNetCore,
setting it to "Warning". The existing log level for
Microsoft remains unchanged at "Information", and
the default log level in appsettings.json remains "Warning".
* Refactor app setup to use minimal hosting model
Moved application configuration from Startup.cs to Program.cs,
aligning with .NET 6 practices. Added services for authentication,
output caching, HTML minification, and Progressive Web Apps.
Removed Startup class and integrated its methods into the new
builder pattern for a simplified application structure.
* Enhance slug handling and input validation
Updated `UpdatePost` method for better null checking and slug creation.
The `CreateSlug` method now accepts a `maxLength` parameter to limit slugs to 50 characters and truncates titles as needed.
The `Edit.cshtml` file enforces a maximum length of 50 characters for the slug input field.
Implemented upstream PR: #195
* Add HTTP response compression support
This commit introduces support for HTTP response compression in the ASP.NET Core application. It includes the necessary namespace imports, configuration for Brotli and Gzip compression providers, and enables response compression in the middleware pipeline. JSON responses are also configured to be compressed.
Implemented PR: #154
* Enhance pagination and improve code clarity
- Added `PostsPerPage` and `TotalPages` constants in `Constants.cs`.
- Refined comments in `AddComment` method of `BlogController.cs`.
- Improved pagination logic in `Category` and `Index` methods, replacing `filteredPosts` with `pagedPosts`.
- Updated comments in `Post` method and added a new `Tag` method for tag-based post display.
- Modified `UpdatePost` to accept a `slug` parameter for better post handling.
- Enhanced comments and consistency in `SaveFilesToDisk` method.
- Updated `Index.cshtml` to accurately calculate `currentPage` and `totalPages` using new view data properties.
Implements PR: #149
Issue: madskristensen/MiniBlog#262
* Refactor file handling and improve performance
- Streamlined `SaveFile` method with concise `using` syntax.
- Added null-forgiving operators in `SavePost` for safety.
- Replaced `ForEach` with `foreach` in `LoadCategories` and `LoadTags`.
- Updated `Initialize` to call `LoadPosts` asynchronously.
- Refactored `LoadPosts` to use PLINQ and async enumerables for parallel file loading.
* Refactor FileBlogService for asynchronous initialization
Updated the constructor to call an asynchronous method,
`InitializeAsync`, instead of a synchronous one. This change
allows for proper handling of asynchronous operations during
initialization. The `LoadPosts` method is now awaited,
ensuring that posts are loaded correctly before sorting the
cache.
* Refactor methods for asynchronous operations
- Changed `GetCategories` to return `IAsyncEnumerable<string>` for asynchronous streaming.
- Updated `GetPostById` and `GetPostBySlug` to be asynchronous, using `Task<Post?>` and `async` keyword.
- Modified return statements to use `await Task.FromResult(...)` for better async handling.
* Refactor FileBlogService for improved structure
Updated FileBlogService to use constructor injection for dependencies, added SuppressMessage attributes for security, and changed folder handling to a property. Implemented async methods with yield return for better performance and ensured initialization checks are in place. Simplified IsAdmin method and improved overall readability and maintainability.
* Create dotnet.yml
* Update .NET version in workflow configuration
Changed the `dotnet-version` in the `Setup .NET` step from `8.0.x` to `9.0.x` to utilize the latest .NET version for the workflow.
* Create dependabot.yml1 parent 3866f01 commit 99cd897
File tree
40 files changed
+3573
-1767
lines changed- .github
- workflows
- src
- Controllers
- Models
- MultilingualResources
- Properties
- Services
- Views
- Blog
40 files changed
+3573
-1767
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
94 | 103 | | |
95 | 104 | | |
96 | 105 | | |
| |||
139 | 148 | | |
140 | 149 | | |
141 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
15 | 14 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
4 | 27 | | |
5 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
6 | 33 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 34 | + | |
31 | 35 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 11 | + | |
| 12 | + | |
14 | 13 | | |
15 | | - | |
16 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
17 | 21 | | |
18 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
19 | 25 | | |
20 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
21 | 31 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 32 | + | |
27 | 33 | | |
28 | | - | |
29 | | - | |
| 34 | + | |
| 35 | + | |
30 | 36 | | |
31 | 37 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 38 | + | |
36 | 39 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
50 | 43 | | |
51 | | - | |
52 | | - | |
| 44 | + | |
| 45 | + | |
53 | 46 | | |
54 | | - | |
55 | | - | |
56 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
57 | 50 | | |
58 | | - | |
59 | | - | |
| 51 | + | |
| 52 | + | |
60 | 53 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
67 | 59 | | |
68 | 60 | | |
0 commit comments