Merge branch 'v10/dev' into v10/feature/nullable-reference-types-in-Umbraco.Web.Backoffice
# Conflicts: # src/Umbraco.Core/Cache/MacroCacheRefresher.cs # src/Umbraco.Core/Services/MacroService.cs # src/Umbraco.Core/StaticApplicationLogging.cs # src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs # src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MacroRepository.cs # src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TrackedReferencesRepository.cs # src/Umbraco.Infrastructure/PropertyEditors/GridPropertyEditor.cs # src/Umbraco.Infrastructure/Security/UmbracoPasswordHasher.cs # src/Umbraco.Web.BackOffice/Controllers/ImagesController.cs
This commit is contained in:
@@ -19,8 +19,11 @@ using Umbraco.Cms.Core.Routing;
|
||||
using Umbraco.Cms.Core.Scoping;
|
||||
using Umbraco.Cms.Core.Services;
|
||||
using Umbraco.Cms.Core.Web;
|
||||
using Umbraco.Cms.Infrastructure.PublishedCache;
|
||||
using Umbraco.Cms.Infrastructure.WebAssets;
|
||||
using Umbraco.Cms.Web.Common.DependencyInjection;
|
||||
using Umbraco.Cms.Web.Common.Profiler;
|
||||
using Umbraco.Cms.Web.Common.Routing;
|
||||
using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Web.Common.Middleware
|
||||
@@ -50,6 +53,7 @@ namespace Umbraco.Cms.Web.Common.Middleware
|
||||
private readonly IRuntimeState _runtimeState;
|
||||
private readonly IVariationContextAccessor _variationContextAccessor;
|
||||
private readonly IDefaultCultureAccessor _defaultCultureAccessor;
|
||||
private readonly IOptions<UmbracoRequestOptions> _umbracoRequestOptions;
|
||||
private SmidgeOptions _smidgeOptions;
|
||||
private readonly WebProfiler? _profiler;
|
||||
|
||||
@@ -59,6 +63,41 @@ namespace Umbraco.Cms.Web.Common.Middleware
|
||||
private static object s_firstBackOfficeRequestLocker = new object();
|
||||
#pragma warning restore IDE0044 // Add readonly modifier
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UmbracoRequestMiddleware"/> class.
|
||||
/// </summary>
|
||||
// Obsolete, scheduled for removal in V11
|
||||
[Obsolete("Use constructor that takes an IOptions<UmbracoRequestOptions>")]
|
||||
public UmbracoRequestMiddleware(
|
||||
ILogger<UmbracoRequestMiddleware> logger,
|
||||
IUmbracoContextFactory umbracoContextFactory,
|
||||
IRequestCache requestCache,
|
||||
IEventAggregator eventAggregator,
|
||||
IProfiler profiler,
|
||||
IHostingEnvironment hostingEnvironment,
|
||||
UmbracoRequestPaths umbracoRequestPaths,
|
||||
BackOfficeWebAssets backOfficeWebAssets,
|
||||
IOptionsMonitor<SmidgeOptions> smidgeOptions,
|
||||
IRuntimeState runtimeState,
|
||||
IVariationContextAccessor variationContextAccessor,
|
||||
IDefaultCultureAccessor defaultCultureAccessor)
|
||||
: this(
|
||||
logger,
|
||||
umbracoContextFactory,
|
||||
requestCache,
|
||||
eventAggregator,
|
||||
profiler,
|
||||
hostingEnvironment,
|
||||
umbracoRequestPaths,
|
||||
backOfficeWebAssets,
|
||||
smidgeOptions,
|
||||
runtimeState,
|
||||
variationContextAccessor,
|
||||
defaultCultureAccessor,
|
||||
StaticServiceProvider.Instance.GetRequiredService<IOptions<UmbracoRequestOptions>>())
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UmbracoRequestMiddleware"/> class.
|
||||
/// </summary>
|
||||
@@ -74,7 +113,8 @@ namespace Umbraco.Cms.Web.Common.Middleware
|
||||
IOptionsMonitor<SmidgeOptions> smidgeOptions,
|
||||
IRuntimeState runtimeState,
|
||||
IVariationContextAccessor variationContextAccessor,
|
||||
IDefaultCultureAccessor defaultCultureAccessor)
|
||||
IDefaultCultureAccessor defaultCultureAccessor,
|
||||
IOptions<UmbracoRequestOptions> umbracoRequestOptions)
|
||||
{
|
||||
_logger = logger;
|
||||
_umbracoContextFactory = umbracoContextFactory;
|
||||
@@ -86,6 +126,7 @@ namespace Umbraco.Cms.Web.Common.Middleware
|
||||
_runtimeState = runtimeState;
|
||||
_variationContextAccessor = variationContextAccessor;
|
||||
_defaultCultureAccessor = defaultCultureAccessor;
|
||||
_umbracoRequestOptions = umbracoRequestOptions;
|
||||
_smidgeOptions = smidgeOptions.CurrentValue;
|
||||
_profiler = profiler as WebProfiler; // Ignore if not a WebProfiler
|
||||
|
||||
@@ -96,7 +137,7 @@ namespace Umbraco.Cms.Web.Common.Middleware
|
||||
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
|
||||
{
|
||||
// do not process if client-side request
|
||||
if (context.Request.IsClientSideRequest())
|
||||
if (context.Request.IsClientSideRequest() && !_umbracoRequestOptions.Value.HandleAsServerSideRequest(context.Request))
|
||||
{
|
||||
// we need this here because for bundle requests, these are 'client side' requests that we need to handle
|
||||
LazyInitializeBackOfficeServices(context.Request.Path);
|
||||
|
||||
Reference in New Issue
Block a user