chore: cleanup usings and run dotnet format
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
global using System.IO.Abstractions;
|
||||
global using System.ServiceModel.Syndication;
|
||||
global using System.Text;
|
||||
global using System.Text.Json;
|
||||
global using System.Xml;
|
||||
global using System.Xml.Linq;
|
||||
|
||||
global using Blog.Components;
|
||||
global using Blog.Posts;
|
||||
|
||||
@@ -16,7 +16,7 @@ class FilePostService(
|
||||
.UseAdvancedExtensions()
|
||||
.UsePrism()
|
||||
.Build();
|
||||
|
||||
|
||||
private const string MetaFence = "meta";
|
||||
private const string IndexFile = "index.md";
|
||||
|
||||
@@ -68,12 +68,12 @@ class FilePostService(
|
||||
try
|
||||
{
|
||||
var indexFilePath = _fileSystem.Path.Combine(subDirectory, IndexFile);
|
||||
|
||||
|
||||
if (_fileSystem.File.Exists(indexFilePath) is false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
var postText = await _fileSystem.File.ReadAllTextAsync(indexFilePath);
|
||||
|
||||
var (metaContent, document) = ParsePost(postText);
|
||||
@@ -108,7 +108,7 @@ class FilePostService(
|
||||
|
||||
public async Task<PostWithContent?> GetPostAsync(string slug)
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
var postPath = _fileSystem.Path.Combine(_options.PostsDirectory, slug, IndexFile);
|
||||
|
||||
@@ -133,10 +133,10 @@ class FilePostService(
|
||||
return null;
|
||||
}
|
||||
|
||||
var postWithContent = post with
|
||||
{
|
||||
var postWithContent = post with
|
||||
{
|
||||
Slug = slug,
|
||||
Content = document.ToHtml(MarkdownPipeline)
|
||||
Content = document.ToHtml(MarkdownPipeline)
|
||||
};
|
||||
|
||||
return postWithContent;
|
||||
|
||||
+2
-7
@@ -1,8 +1,3 @@
|
||||
using System.ServiceModel.Syndication;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.ConfigureOptions<FilePostServiceOptionsSetup>();
|
||||
@@ -29,11 +24,11 @@ app.UseAntiforgery();
|
||||
app.UseStatusCodePagesWithRedirects("/Error/{0}");
|
||||
|
||||
app
|
||||
.MapGet("/rss", async (HttpContext context, IPostService postService) =>
|
||||
.MapGet("/rss", async (HttpContext context, IPostService postService) =>
|
||||
{
|
||||
var req = context.Request;
|
||||
var url = $"{req.Scheme}://{req.Host}{req.PathBase}";
|
||||
|
||||
|
||||
var posts = await postService.GetPostsAsync();
|
||||
|
||||
var items = posts.Select(post =>
|
||||
|
||||
Reference in New Issue
Block a user