新增rss功能
This commit is contained in:
@@ -14,7 +14,8 @@
|
||||
string Script,
|
||||
int PageSizeOfHomepage,
|
||||
int PageSizeOfListpage,
|
||||
string ArticleRoute,
|
||||
int RssGenerationIntervalHours,
|
||||
string ArticleRoute,
|
||||
string PageRoute,
|
||||
string CategoryRoute,
|
||||
string SearchRoute,
|
||||
@@ -33,6 +34,10 @@
|
||||
RuleFor(x => x.CategoryRoute).NotEmpty().WithMessage("分类页路径不能为空!");
|
||||
RuleFor(x => x.SearchRoute).NotEmpty().WithMessage("搜索页路径不能为空!");
|
||||
RuleFor(x => x.TagRoute).NotEmpty().WithMessage("标签页路径不能为空!");
|
||||
|
||||
RuleFor(x => x.PageSizeOfHomepage).GreaterThan(0).WithMessage("主页每页文章数必须大于0!");
|
||||
RuleFor(x => x.PageSizeOfListpage).GreaterThan(0).WithMessage("列表页每页文章数必须大于0!");
|
||||
RuleFor(x => x.RssGenerationIntervalHours).GreaterThan(0).WithMessage("RSS生成频率必须大于0!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
|
||||
namespace Yes.Blog.Endpoints.Blogs
|
||||
{
|
||||
public class RssEndpoint : BlogEndpointScheme, IEndpoint
|
||||
{
|
||||
public void Map(IEndpointRouteBuilder app) => app.MapGet("feed", Handle).AllowAnonymous();
|
||||
|
||||
private async Task<Microsoft.AspNetCore.Http.IResult> Handle(
|
||||
IMediator mediator,
|
||||
IMapper mapper,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var response = await mediator.Send(new GetRssQuery(), cancellationToken);
|
||||
|
||||
return Results.Text(response.Xml, "application/rss+xml; charset=utf-8");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user