Skip to content

Code clean up round 2 - #776

Merged
poppastring merged 9 commits into
mainfrom
refactor/code-cleanup-round2
Feb 15, 2026
Merged

poppastring merged 9 commits into
mainfrom
refactor/code-cleanup-round2

Conversation

@poppastring

Copy link
Copy Markdown
Owner

PR Classification

Code cleanup and modernization to remove Newtonsoft.Json, streamline dependencies, and improve test coverage.

PR Summary

This pull request replaces Newtonsoft.Json with System.Text.Json, removes obsolete XML-RPC and authentication code, and refactors dependency injection for maintainability.

  • All usages of Newtonsoft.Json are replaced with System.Text.Json, and related package references are removed.
  • BloggerAPI and related XML-RPC MoveableType classes/interfaces are deleted.
  • ISiteSecuriy, SiteSecurity, UserCollection, and UserToken classes are removed.
  • DasBlogServiceCollectionExtensions is introduced and Startup.cs is refactored to use new DI extension methods.
  • New unit tests are added for CommentManager, FileSystemBinaryManager, and SearchManager.

Aligns folder name with csproj (DasBlog.Core.csproj) and namespaces
(DasBlog.Core.*). Updates solution, csproj refs, and Dockerfile.
This folder had no .csproj file, was not referenced by any project, and
was not included in the solution. Its Security and XmlRpc classes were
duplicates of code already in DasBlog.Services and DasBlog.Core.
- Veriifier.cs → Verifier.cs (class name also fixed)
- UrlInfocs.cs → UrlInfo.cs (filename only, class was already correct)
Move IDasBlogSettings, IUrlResolver, ITimeZoneService, IContentProcessor,
IMailProvider, and IUserManager into DasBlog.Services/Interfaces/ for
consistent organization matching the pattern in DasBlog.Managers.
Replace all Newtonsoft.Json usage with System.Text.Json across 6 files:
- WebManifest.cs: JsonProperty → JsonPropertyName, NullValueHandling →
  JsonIgnore(WhenWritingNull), JsonConvert → JsonSerializer
- OEmbed.cs: JsonProperty → JsonPropertyName
- ExternalEmbeddingHandler.cs: JsonConvert.DeserializeObject → JsonSerializer.Deserialize
- OEmbedProvidersFileService.cs: Newtonsoft JsonSerializer → System.Text.Json
- PostViewModel.cs, StaticPageViewModel.cs: removed unused Newtonsoft using

Remove Newtonsoft.Json from DasBlog.Services.csproj and Directory.Packages.props.
One fewer third-party dependency.
…aryManager

Add 3 new test files and extend existing SiteSecurityManagerTest:
- CommentManagerTest: constructor, GetComments, GetAllComments,
  DeleteComment (valid/invalid), ApproveComment
- SearchManagerTest: constructor, empty search returns all,
  matching term returns matches
- FileSystemBinaryManagerTest: constructor with full mock setup
- SiteSecurityManagerTest: added VerifyHashedPassword tests

Test count: 139 → 151 (12 new tests, all passing)
- Remove duplicate static file registration for binaries path (exact
  duplicate block, lines 358-363)
- Remove redundant IHttpContextAccessor singleton registration (already
  registered via AddHttpContextAccessor() on line 192)
…vices

Add ILogger injection to MetaConfigFileService, SiteConfigFileService,
OEmbedProvidersFileService, and SiteSecurityConfigFileService. Replace
'// TODO log' + Console.WriteLine(e) with structured logger.LogError()
calls including the file path context.
…hods

Create DasBlogServiceCollectionExtensions with three focused methods:
- AddDasBlogDataServices(): IBlogDataService, ILoggingDataService factories
- AddDasBlogManagers(): all 11 manager singletons
- AddDasBlogServices(): core services, config file services, transients

Reduces Startup.cs from 525 to 481 lines and makes the DI registration
structure clear and navigable.
@poppastring
poppastring merged commit 35b7bc7 into main Feb 15, 2026
3 checks passed
@poppastring
poppastring deleted the refactor/code-cleanup-round2 branch February 15, 2026 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant