|
|
@ -3,6 +3,8 @@ using System.Threading.Tasks; |
|
|
using Microsoft.AspNetCore.Http; |
|
|
using Microsoft.AspNetCore.Http; |
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
using Volo.Abp.DependencyInjection; |
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
|
|
using Volo.Abp.Features; |
|
|
|
|
|
using Volo.CmsKit.Features; |
|
|
using Volo.CmsKit.Pages; |
|
|
using Volo.CmsKit.Pages; |
|
|
using Volo.CmsKit.Public.Pages; |
|
|
using Volo.CmsKit.Public.Pages; |
|
|
|
|
|
|
|
|
@ -11,6 +13,10 @@ namespace Volo.CmsKit.Public.Web; |
|
|
public class DefaultHomePageMiddleware : IMiddleware, ITransientDependency |
|
|
public class DefaultHomePageMiddleware : IMiddleware, ITransientDependency |
|
|
{ |
|
|
{ |
|
|
public async Task InvokeAsync(HttpContext context, RequestDelegate next) |
|
|
public async Task InvokeAsync(HttpContext context, RequestDelegate next) |
|
|
|
|
|
{ |
|
|
|
|
|
var featureChecker = context.RequestServices.GetRequiredService<IFeatureChecker>(); |
|
|
|
|
|
|
|
|
|
|
|
if (await featureChecker.IsEnabledAsync(CmsKitFeatures.PageEnable)) |
|
|
{ |
|
|
{ |
|
|
if (context.Request.Path.Value == "/") |
|
|
if (context.Request.Path.Value == "/") |
|
|
{ |
|
|
{ |
|
|
@ -21,7 +27,7 @@ public class DefaultHomePageMiddleware : IMiddleware, ITransientDependency |
|
|
{ |
|
|
{ |
|
|
context.Request.Path = $"{PageConsts.UrlPrefix}{page.Slug}"; |
|
|
context.Request.Path = $"{PageConsts.UrlPrefix}{page.Slug}"; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
await next(context); |
|
|
await next(context); |
|
|
|